From d630ff1f79b370883de7001ffa06b7b90f32ec3e Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Thu, 11 Jul 2024 14:17:32 -0700 Subject: [PATCH] intel/brw: Disallow scalar byte to float conversions on DG2+ I haven't been able to find this restriction mentioned anywhere in the hardware documentation, but the simulator has code to reject this case as invalid, and it doesn't appear to work on hardware anymore. Having lower_regioning() handle this takes care of the issue so we don't have to worry about generating it in random places. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11489 Reviewed-by: Caio Oliveira Reviewed-by: Ian Romanick Part-of: --- src/intel/compiler/brw_fs_lower_regioning.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/intel/compiler/brw_fs_lower_regioning.cpp b/src/intel/compiler/brw_fs_lower_regioning.cpp index 93991a48c92..7307ec9d6f2 100644 --- a/src/intel/compiler/brw_fs_lower_regioning.cpp +++ b/src/intel/compiler/brw_fs_lower_regioning.cpp @@ -380,6 +380,22 @@ namespace { } } + /** + * Return whether the instruction has an unsupported type conversion + * that must be handled by expanding the source operand. + */ + bool + has_invalid_src_conversion(const intel_device_info *devinfo, + const fs_inst *inst) + { + /* Scalar byte to float conversion is not allowed on DG2+ */ + return devinfo->verx10 >= 125 && + inst->opcode == BRW_OPCODE_MOV && + brw_type_is_float(inst->dst.type) && + brw_type_size_bits(inst->src[0].type) == 8 && + is_uniform(inst->src[0]); + } + /* * Return whether the instruction has unsupported source modifiers * specified for the i-th source region. @@ -392,7 +408,8 @@ namespace { (inst->src[i].negate || inst->src[i].abs)) || ((has_invalid_exec_type(devinfo, inst) & (1u << i)) && (inst->src[i].negate || inst->src[i].abs || - inst->src[i].type != get_exec_type(inst))); + inst->src[i].type != get_exec_type(inst))) || + has_invalid_src_conversion(devinfo, inst); } /*