nir/opt_load_skip_helpers: don't skip helpers for store_scratch data

Scratch stores store data for helper lanes that might be used later by an
instruction that cares about helpers, or even by control flow.

Fixes: a65009e808 ("nir: Add a nir_opt_tex_skip_helpers optimization")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/work_items/14965
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40770>
This commit is contained in:
Georg Lehmann 2026-04-02 21:13:48 +02:00 committed by Marge Bot
parent 7f07783569
commit fc19ce6c17

View file

@ -161,7 +161,11 @@ nir_opt_load_skip_helpers(nir_shader *shader, nir_opt_load_skip_helpers_options
case nir_instr_type_intrinsic: {
nir_intrinsic_instr *intr = nir_instr_as_intrinsic(instr);
if (nir_intrinsic_has_semantic(intr, NIR_INTRINSIC_SUBGROUP)) {
if (nir_intrinsic_has_semantic(intr, NIR_INTRINSIC_SUBGROUP) ||
intr->intrinsic == nir_intrinsic_store_scratch) {
/* Subgroup ops might access data from helper lanes and we don't
* know how scratch data is used without more complex tracking.
*/
nir_foreach_src(instr, set_src_needs_helpers, &hs);
} else if (intr->intrinsic == nir_intrinsic_terminate_if) {
/* Unlike demote, terminate disables invocations completely.