intel/compiler: Document and assert some aspects of 8-bit integer lowering

In the vec4 compiler, 8-bit types should never exist.

In the scalar compiler, 8-bit types should only ever be able to exist on
Gfx ver 8 and 9.

Some instructions are handled in non-obvious ways.

Hopefully this will save the next person some time.

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:
Ian Romanick
2021-01-22 14:54:02 -08:00
committed by Marge Bot
parent fee4f7ef43
commit f9665040f1
3 changed files with 49 additions and 0 deletions

View File

@@ -645,6 +645,11 @@ lower_bit_size_callback(const nir_instr *instr, UNUSED void *data)
if (alu->dest.dest.ssa.bit_size >= 32)
return 0;
/* Note: nir_op_iabs and nir_op_ineg are not lowered here because the
* 8-bit ABS or NEG instruction should eventually get copy propagated
* into the MOV that does the type conversion. This results in far
* fewer MOV instructions.
*/
switch (alu->op) {
case nir_op_idiv:
case nir_op_imod:
@@ -666,6 +671,9 @@ lower_bit_size_callback(const nir_instr *instr, UNUSED void *data)
case nir_op_fsin:
case nir_op_fcos:
return devinfo->ver < 9 ? 32 : 0;
case nir_op_isign:
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 &&