agx: return progress from passes

so we can be smarter about validation

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26976>
This commit is contained in:
Alyssa Rosenzweig
2024-01-09 15:49:53 -04:00
committed by Marge Bot
parent 26cedede0d
commit 8a6850d33c
5 changed files with 17 additions and 10 deletions

View File

@@ -244,7 +244,7 @@ void agx_preprocess_nir(nir_shader *nir, const nir_shader *libagx,
bool agx_nir_lower_discard_zs_emit(nir_shader *s);
void agx_nir_lower_cull_distance_fs(struct nir_shader *s,
bool agx_nir_lower_cull_distance_fs(struct nir_shader *s,
unsigned nr_distances);
bool agx_nir_needs_texture_crawl(nir_instr *instr);

View File

@@ -15,8 +15,8 @@ bool agx_nir_lower_algebraic_late(struct nir_shader *shader);
bool agx_nir_fuse_algebraic_late(struct nir_shader *shader);
bool agx_nir_fence_images(struct nir_shader *shader);
bool agx_nir_lower_multisampled_image_store(struct nir_shader *s);
void agx_nir_lower_layer(struct nir_shader *s);
void agx_nir_lower_cull_distance_vs(struct nir_shader *s);
void agx_nir_lower_subgroups(struct nir_shader *s);
bool agx_nir_lower_layer(struct nir_shader *s);
bool agx_nir_lower_cull_distance_vs(struct nir_shader *s);
bool agx_nir_lower_subgroups(struct nir_shader *s);
#endif

View File

@@ -58,7 +58,7 @@ lower_write(nir_builder *b, nir_intrinsic_instr *intr, UNUSED void *data)
return true;
}
void
bool
agx_nir_lower_cull_distance_vs(nir_shader *s)
{
assert(s->info.stage == MESA_SHADER_VERTEX);
@@ -70,9 +70,10 @@ agx_nir_lower_cull_distance_vs(nir_shader *s)
s->info.outputs_written |=
BITFIELD64_RANGE(VARYING_SLOT_CULL_PRIMITIVE,
DIV_ROUND_UP(s->info.cull_distance_array_size, 4));
return true;
}
void
bool
agx_nir_lower_cull_distance_fs(nir_shader *s, unsigned nr_distances)
{
assert(s->info.stage == MESA_SHADER_FRAGMENT);
@@ -109,4 +110,7 @@ agx_nir_lower_cull_distance_fs(nir_shader *s, unsigned nr_distances)
DIV_ROUND_UP(nr_distances, 4));
s->info.fs.uses_discard = true;
nir_metadata_preserve(b->impl,
nir_metadata_dominance | nir_metadata_block_index);
return true;
}

View File

@@ -7,7 +7,7 @@
#include "compiler/nir/nir_builder.h"
#include "agx_nir.h"
void
bool
agx_nir_lower_layer(nir_shader *s)
{
assert(s->info.stage == MESA_SHADER_VERTEX);
@@ -66,4 +66,5 @@ agx_nir_lower_layer(nir_shader *s)
nir_metadata_preserve(impl,
nir_metadata_dominance | nir_metadata_block_index);
return true;
}

View File

@@ -33,7 +33,7 @@ lower(nir_builder *b, nir_intrinsic_instr *intr, void *data)
}
}
void
bool
agx_nir_lower_subgroups(nir_shader *s)
{
/* First, do as much common lowering as we can */
@@ -47,9 +47,11 @@ agx_nir_lower_subgroups(nir_shader *s)
.ballot_bit_size = 32,
};
NIR_PASS_V(s, nir_lower_subgroups, &opts);
bool progress = nir_lower_subgroups(s, &opts);
/* Then do AGX-only lowerings on top */
nir_shader_intrinsics_pass(
progress |= nir_shader_intrinsics_pass(
s, lower, nir_metadata_block_index | nir_metadata_dominance, NULL);
return progress;
}