nir/lower_subgroups: change filter to intrinsic callback
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37178>
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 *
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user