mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-06-23 22:58:33 +02:00
nir,panfrost: remove 8-bit and 16-bit booleans
We can use integers instead. Reviewed-by: Lorenzo Rossi <lorenzo.rossi@collabora.com> Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41472>
This commit is contained in:
parent
8dd24f57fe
commit
b0fd4ef7f8
12 changed files with 8 additions and 27 deletions
|
|
@ -931,9 +931,6 @@ static bool visit_alu(struct ac_nir_context *ctx, const nir_alu_instr *instr)
|
|||
case nir_op_b2b1: /* after loads */
|
||||
result = emit_i2b(&ctx->ac, src[0]);
|
||||
break;
|
||||
case nir_op_b2b16: /* before stores */
|
||||
result = LLVMBuildZExt(ctx->ac.builder, src[0], ctx->ac.i16, "");
|
||||
break;
|
||||
case nir_op_b2b32: /* before stores */
|
||||
result = LLVMBuildZExt(ctx->ac.builder, src[0], ctx->ac.i32, "");
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ lower_pack = [
|
|||
lower_selects = []
|
||||
for T, sizes, one in [('f', [16, 32], 1.0),
|
||||
('i', [8, 16, 32], 1),
|
||||
('b', [16, 32], -1)]:
|
||||
('b', [32], -1)]:
|
||||
for size in sizes:
|
||||
lower_selects.extend([
|
||||
((f'b2{T}{size}', ('inot', 'a@1')), ('bcsel', a, 0, one)),
|
||||
|
|
|
|||
|
|
@ -115,8 +115,6 @@ alu_cost(nir_alu_instr *alu)
|
|||
case nir_op_ineg:
|
||||
case nir_op_bcsel:
|
||||
case nir_op_b2b1:
|
||||
case nir_op_b2b8:
|
||||
case nir_op_b2b16:
|
||||
case nir_op_b2b32:
|
||||
case nir_op_b2i8:
|
||||
case nir_op_b2i16:
|
||||
|
|
|
|||
|
|
@ -425,10 +425,7 @@ typedef float float16_t;
|
|||
typedef float float32_t;
|
||||
typedef double float64_t;
|
||||
typedef bool bool1_t;
|
||||
typedef bool bool8_t;
|
||||
typedef bool bool16_t;
|
||||
typedef bool bool32_t;
|
||||
typedef bool bool64_t;
|
||||
|
||||
static inline bool
|
||||
util_add_check_overflow_int1_t(int1_t a, int1_t b)
|
||||
|
|
|
|||
|
|
@ -136,8 +136,6 @@ typedef enum ENUM_PACKED {
|
|||
nir_type_bool = 6,
|
||||
nir_type_float = 128,
|
||||
nir_type_bool1 = 1 | nir_type_bool,
|
||||
nir_type_bool8 = 8 | nir_type_bool,
|
||||
nir_type_bool16 = 16 | nir_type_bool,
|
||||
nir_type_bool32 = 32 | nir_type_bool,
|
||||
nir_type_int1 = 1 | nir_type_int,
|
||||
nir_type_int8 = 8 | nir_type_int,
|
||||
|
|
|
|||
|
|
@ -128,8 +128,6 @@ tfloat = "float"
|
|||
tint = "int"
|
||||
tbool = "bool"
|
||||
tbool1 = "bool1"
|
||||
tbool8 = "bool8"
|
||||
tbool16 = "bool16"
|
||||
tbool32 = "bool32"
|
||||
tuint = "uint"
|
||||
tuint8 = "uint8"
|
||||
|
|
@ -161,7 +159,7 @@ def type_sizes(type_):
|
|||
if type_has_size(type_):
|
||||
return [type_size(type_)]
|
||||
elif type_ == 'bool':
|
||||
return [1, 8, 16, 32]
|
||||
return [1, 32]
|
||||
elif type_ == 'float':
|
||||
return [16, 32, 64]
|
||||
else:
|
||||
|
|
@ -655,7 +653,7 @@ def binop_compare32(name, ty, alg_props, const_expr, description = "", ty2=None,
|
|||
|
||||
def binop_compare_pan(name, ty, alg_props, const_expr, description = "", ty2=None,
|
||||
valid_fp_math_ctrl=None):
|
||||
binop_convert(name, tbool, ty, alg_props, const_expr, description, ty2, False, valid_fp_math_ctrl)
|
||||
binop_convert(name, tuint, ty, alg_props, const_expr, description, ty2, False, valid_fp_math_ctrl)
|
||||
|
||||
def binop_compare_all_sizes(name, ty, alg_props, const_expr, description = "", ty2=None):
|
||||
valid_fp_math_ctrl = None
|
||||
|
|
@ -663,7 +661,7 @@ def binop_compare_all_sizes(name, ty, alg_props, const_expr, description = "", t
|
|||
valid_fp_math_ctrl = preserve_inf + preserve_nan
|
||||
binop_compare(name, ty, alg_props, const_expr, description, ty2, valid_fp_math_ctrl)
|
||||
binop_compare32(name + "32", ty, alg_props, const_expr, description, ty2, valid_fp_math_ctrl)
|
||||
binop_compare_pan(name + "_pan", ty, alg_props, const_expr, description, ty2, valid_fp_math_ctrl)
|
||||
binop_compare_pan(name + "_pan", ty, alg_props, const_expr + " ? -1 : 0", description, ty2, valid_fp_math_ctrl)
|
||||
|
||||
def binop_horiz(name, out_size, out_type, src1_size, src1_type, src2_size,
|
||||
src2_type, const_expr, description = ""):
|
||||
|
|
@ -1244,7 +1242,7 @@ opcode("b32csel", 0, tuint, [0, 0, 0],
|
|||
[tbool32, tuint, tuint], False, selection, "src0 ? src1 : src2",
|
||||
description = csel_description.format("a 32-bit", "0 vs ~0"))
|
||||
opcode("bcsel_pan", 0, tuint, [0, 0, 0],
|
||||
[tbool, tuint, tuint], False, selection, "src0 ? src1 : src2",
|
||||
[tuint, tuint, tuint], False, selection, "src0 ? src1 : src2",
|
||||
description = csel_description.format("a same-sized", "0 vs ~0"))
|
||||
|
||||
triop("icsel_eqz", tint, selection, "(src0 == 0) ? src1 : src2")
|
||||
|
|
|
|||
|
|
@ -1272,7 +1272,7 @@ for s in [16, 32, 64]:
|
|||
(('i2f{}'.format(s), ('f2i', ('fsign', 'a@{}'.format(s)))), ('fsign', a)),
|
||||
])
|
||||
|
||||
if s < 64:
|
||||
if s == 32:
|
||||
optimizations.extend([(('bcsel', a, ('b2f(is_used_once)', 'b@{}'.format(s)), ('b2f', 'c@{}'.format(s))), ('b2f', ('bcsel', a, b, c)))])
|
||||
|
||||
for B in [32, 64]:
|
||||
|
|
@ -1417,7 +1417,7 @@ for s in [8, 16, 32, 64]:
|
|||
])
|
||||
|
||||
# There are no 64bit booleans in NIR
|
||||
if s < 64:
|
||||
if s == 32:
|
||||
# True/False are ~0 and 0 in NIR. b2i of True is 1, and -1 is ~0 (True).
|
||||
optimizations.extend([(('ineg', ('b2i{}'.format(s), 'a@{}'.format(s))), a)])
|
||||
|
||||
|
|
|
|||
|
|
@ -95,8 +95,6 @@ get_bool_types_alu(nir_alu_instr *alu)
|
|||
case nir_op_b2i32:
|
||||
case nir_op_b2i64:
|
||||
return bool_type_single_bit;
|
||||
case nir_op_b2b8:
|
||||
case nir_op_b2b16:
|
||||
case nir_op_b2b32:
|
||||
return bool_type_all_bits;
|
||||
case nir_op_b2f16:
|
||||
|
|
|
|||
|
|
@ -3609,7 +3609,6 @@ get_tex_dest_type(nir_tex_instr *tex)
|
|||
case nir_type_bool32:
|
||||
case nir_type_uint32:
|
||||
return TYPE_U32;
|
||||
case nir_type_bool16:
|
||||
case nir_type_uint16:
|
||||
return TYPE_U16;
|
||||
case nir_type_invalid:
|
||||
|
|
|
|||
|
|
@ -3219,8 +3219,6 @@ do_alu_action(struct lp_build_nir_soa_context *bld,
|
|||
case nir_op_b2b1:
|
||||
result = LLVMBuildICmp(builder, LLVMIntNE, src[0], int_bld->zero, "");
|
||||
break;
|
||||
case nir_op_b2b8:
|
||||
case nir_op_b2b16:
|
||||
case nir_op_b2b32:
|
||||
if (src_bit_size[0] > instr->def.bit_size) {
|
||||
result = LLVMBuildTrunc(builder, src[0], dst_uint_bld->vec_type, "");
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ lower_bool = [
|
|||
|
||||
for T, sizes, one in [('f', [16, 32], 1.0),
|
||||
('i', [8, 16, 32], 1),
|
||||
('b', [8, 16, 32], -1)]:
|
||||
('b', [32], -1)]:
|
||||
for sz in sizes:
|
||||
if T in ['f', 'i']:
|
||||
lower_bool.extend([
|
||||
|
|
|
|||
|
|
@ -36,8 +36,6 @@ alu_type_to_string(nir_alu_type type)
|
|||
return "half";
|
||||
case nir_type_float32:
|
||||
return "float";
|
||||
case nir_type_bool8:
|
||||
return "bool";
|
||||
default:
|
||||
UNREACHABLE("Unsupported nir_alu_type");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue