intel/compiler: Lower 8-bit ops to 16-bit in NIR on all platforms
This fixes the Crucible func.shader.shift.int8_t test on Gen8 and Gen9. See https://gitlab.freedesktop.org/mesa/crucible/-/merge_requests/76. With the previous optimizations in place, this change seems to improve the quality of the generated code. Comparing a couple Vulkan CTS tests on Skylake had the following results. dEQP-VK.spirv_assembly.type.vec3.i8.bitwise_xor_frag: SIMD8 shader: 36 instructions. 1 loops. 3822 cycles. 0:0 spills:fills, 5 sends SIMD8 shader: 27 instructions. 1 loops. 2742 cycles. 0:0 spills:fills, 5 sends dEQP-VK.spirv_assembly.type.vec3.i8.max_frag: SIMD8 shader: 39 instructions. 1 loops. 3922 cycles. 0:0 spills:fills, 5 sends SIMD8 shader: 37 instructions. 1 loops. 3682 cycles. 0:0 spills:fills, 5 sends Reviewed-by: Francisco Jerez <currojerez@riseup.net> Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9025>
This commit is contained in:
@@ -675,15 +675,14 @@ lower_bit_size_callback(const nir_instr *instr, UNUSED void *data)
|
||||
assert(!"Should have been lowered by nir_opt_algebraic.");
|
||||
return 0;
|
||||
default:
|
||||
if (devinfo->ver >= 11) {
|
||||
if (nir_op_infos[alu->op].num_inputs >= 2 &&
|
||||
alu->dest.dest.ssa.bit_size == 8)
|
||||
return 16;
|
||||
if (nir_op_infos[alu->op].num_inputs >= 2 &&
|
||||
alu->dest.dest.ssa.bit_size == 8)
|
||||
return 16;
|
||||
|
||||
if (nir_alu_instr_is_comparison(alu) &&
|
||||
alu->src[0].src.ssa->bit_size == 8)
|
||||
return 16;
|
||||
|
||||
if (nir_alu_instr_is_comparison(alu) &&
|
||||
alu->src[0].src.ssa->bit_size == 8)
|
||||
return 16;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
@@ -704,7 +703,7 @@ lower_bit_size_callback(const nir_instr *instr, UNUSED void *data)
|
||||
case nir_intrinsic_quad_swap_horizontal:
|
||||
case nir_intrinsic_quad_swap_vertical:
|
||||
case nir_intrinsic_quad_swap_diagonal:
|
||||
if (intrin->src[0].ssa->bit_size == 8 && devinfo->ver >= 11)
|
||||
if (intrin->src[0].ssa->bit_size == 8)
|
||||
return 16;
|
||||
return 0;
|
||||
|
||||
@@ -737,7 +736,7 @@ lower_bit_size_callback(const nir_instr *instr, UNUSED void *data)
|
||||
|
||||
case nir_instr_type_phi: {
|
||||
nir_phi_instr *phi = nir_instr_as_phi(instr);
|
||||
if (devinfo->ver >= 11 && phi->dest.ssa.bit_size == 8)
|
||||
if (phi->dest.ssa.bit_size == 8)
|
||||
return 16;
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user