nir/opt_gcm: allow resource_intel to be moved anywhere

The resouce_intel intrinsic doesn't not result in an actual
instruction, it's just a wrapper around another value, usually a
load_const.

Allowing this intrinsic to be moved anywhere means it's going to be
closer to the value it wraps, enabling opt_gcm to move a load_ubo
using this resource_intel.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21645>
This commit is contained in:
Lionel Landwerlin
2023-02-21 08:50:35 +02:00
committed by Marge Bot
parent 8a8382a78a
commit 3df3c38a65

View File

@@ -531,7 +531,9 @@ set_block_for_loop_instr(struct gcm_state *state, nir_instr *instr,
return true;
if (instr->type == nir_instr_type_load_const ||
instr->type == nir_instr_type_tex)
instr->type == nir_instr_type_tex ||
(instr->type == nir_instr_type_intrinsic &&
nir_instr_as_intrinsic(instr)->intrinsic == nir_intrinsic_resource_intel))
return true;
return false;
@@ -544,6 +546,10 @@ set_block_to_if_block(struct gcm_state *state, nir_instr *instr,
if (instr->type == nir_instr_type_load_const)
return true;
if (instr->type == nir_instr_type_intrinsic &&
nir_instr_as_intrinsic(instr)->intrinsic == nir_intrinsic_resource_intel)
return true;
/* TODO: Figure out some more heuristics to allow more to be moved into
* if-statements.
*/