diff --git a/src/asahi/compiler/agx_nir_lower_subgroups.c b/src/asahi/compiler/agx_nir_lower_subgroups.c index 205f7ea8e08..2c783a7cd43 100644 --- a/src/asahi/compiler/agx_nir_lower_subgroups.c +++ b/src/asahi/compiler/agx_nir_lower_subgroups.c @@ -181,13 +181,9 @@ lower(nir_builder *b, nir_intrinsic_instr *intr, void *data) } static bool -lower_subgroup_filter(const nir_instr *instr, UNUSED const void *data) +lower_subgroup_filter(const nir_intrinsic_instr *intr, UNUSED const void *data) { - if (instr->type != nir_instr_type_intrinsic) - return false; - /* Use default behaviour for everything but scans */ - nir_intrinsic_instr *intr = nir_instr_as_intrinsic(instr); if (intr->intrinsic != nir_intrinsic_exclusive_scan && intr->intrinsic != nir_intrinsic_inclusive_scan && intr->intrinsic != nir_intrinsic_reduce) diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 48260c51643..0a910267635 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -5476,7 +5476,7 @@ typedef struct nir_lower_subgroups_options { * will filter instructions for lowering if non-NULL. The data passed will be * filter_data. */ - nir_instr_filter_cb filter; + nir_intrin_filter_cb filter; /* Extra data passed to the filter. */ const void *filter_data; diff --git a/src/compiler/nir/nir_lower_subgroups.c b/src/compiler/nir/nir_lower_subgroups.c index c9b4f606002..89ea74ad6ff 100644 --- a/src/compiler/nir/nir_lower_subgroups.c +++ b/src/compiler/nir/nir_lower_subgroups.c @@ -889,13 +889,16 @@ lower_scan_reduce(nir_builder *b, nir_intrinsic_instr *intrin, static bool lower_subgroups_filter(const nir_instr *instr, const void *_options) { + if (instr->type != nir_instr_type_intrinsic) + return false; + const nir_lower_subgroups_options *options = _options; if (options->filter) { - return options->filter(instr, options->filter_data); + return options->filter(nir_instr_as_intrinsic(instr), options->filter_data); } - return instr->type == nir_instr_type_intrinsic; + return true; } static nir_def * diff --git a/src/freedreno/ir3/ir3_lower_subgroups.c b/src/freedreno/ir3/ir3_lower_subgroups.c index e229b9f3d76..0bae999bfd4 100644 --- a/src/freedreno/ir3/ir3_lower_subgroups.c +++ b/src/freedreno/ir3/ir3_lower_subgroups.c @@ -712,13 +712,8 @@ ir3_nir_opt_subgroups(nir_shader *nir, struct ir3_shader_variant *v) } bool -ir3_nir_lower_subgroups_filter(const nir_instr *instr, const void *data) +ir3_nir_lower_subgroups_filter(const nir_intrinsic_instr *intrin, const void *data) { - if (instr->type != nir_instr_type_intrinsic) - return false; - - nir_intrinsic_instr *intrin = nir_instr_as_intrinsic(instr); - const struct ir3_compiler *compiler = data; switch (intrin->intrinsic) { diff --git a/src/freedreno/ir3/ir3_nir.h b/src/freedreno/ir3/ir3_nir.h index a3a475bcf8e..b0bb381875f 100644 --- a/src/freedreno/ir3/ir3_nir.h +++ b/src/freedreno/ir3/ir3_nir.h @@ -110,7 +110,7 @@ nir_def *ir3_nir_try_propagate_bit_shift(nir_builder *b, nir_def *offset, int32_t shift); -bool ir3_nir_lower_subgroups_filter(const nir_instr *instr, const void *data); +bool ir3_nir_lower_subgroups_filter(const nir_intrinsic_instr *intrin, const void *data); bool ir3_nir_lower_shuffle(nir_shader *nir, struct ir3_shader *shader); bool ir3_nir_opt_subgroups(nir_shader *nir, struct ir3_shader_variant *v);