nir/validate: validate ssa dominance by default

This no longer modifies dominance metadata, so enable it by default.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32005>
This commit is contained in:
Rhys Perry 2025-01-10 13:42:01 +00:00 committed by Marge Bot
parent b145045112
commit 0eb5f66660
8 changed files with 4 additions and 17 deletions

View file

@ -362,7 +362,6 @@ void
finish_isel_test(enum ac_hw_stage hw_stage, unsigned wave_size)
{
nir_validate_shader(nb->shader, "in finish_isel_test");
nir_validate_ssa_dominance(nb->shader, "in finish_isel_test");
program.reset(new Program);
program->debug.func = nullptr;

View file

@ -85,7 +85,6 @@ compile(void *memctx, const uint32_t *spirv, size_t spirv_size)
spirv_to_nir(spirv, spirv_size / 4, NULL, 0, MESA_SHADER_KERNEL,
"library", &spirv_options, nir_options);
nir_validate_shader(nir, "after spirv_to_nir");
nir_validate_ssa_dominance(nir, "after spirv_to_nir");
ralloc_steal(memctx, nir);
nir_fixup_is_exported(nir);

View file

@ -48,8 +48,6 @@ static const struct debug_named_value nir_debug_control[] = {
"Test serialize and deserialize shader at each successful lowering/optimization call" },
{ "novalidate", NIR_DEBUG_NOVALIDATE,
"Disable shader validation at each successful lowering/optimization call" },
{ "validate_ssa_dominance", NIR_DEBUG_VALIDATE_SSA_DOMINANCE,
"Validate SSA dominance in shader at each successful lowering/optimization call" },
{ "tgsi", NIR_DEBUG_TGSI,
"Dump NIR/TGSI shaders when doing a NIR<->TGSI translation" },
{ "print", NIR_DEBUG_PRINT,

View file

@ -73,7 +73,6 @@ extern bool nir_debug_print_shader[MESA_SHADER_KERNEL + 1];
#define NIR_DEBUG_CLONE (1u << 0)
#define NIR_DEBUG_SERIALIZE (1u << 1)
#define NIR_DEBUG_NOVALIDATE (1u << 2)
#define NIR_DEBUG_VALIDATE_SSA_DOMINANCE (1u << 3)
#define NIR_DEBUG_TGSI (1u << 4)
#define NIR_DEBUG_PRINT_VS (1u << 5)
#define NIR_DEBUG_PRINT_TCS (1u << 6)

View file

@ -1721,10 +1721,8 @@ validate_dominance(nir_function_impl *impl, validate_state *state)
state->block = NULL;
}
if (NIR_DEBUG(VALIDATE_SSA_DOMINANCE)) {
memset(state->ssa_defs_found, 0, BITSET_WORDS(impl->ssa_alloc) * sizeof(BITSET_WORD));
validate_ssa_dominance(impl, state);
}
memset(state->ssa_defs_found, 0, BITSET_WORDS(impl->ssa_alloc) * sizeof(BITSET_WORD));
validate_ssa_dominance(impl, state);
/* Restore the old dominance metadata */
set_foreach(state->blocks, entry) {
@ -1900,10 +1898,8 @@ validate_metadata_and_ssa_dominance(nir_function_impl *impl, validate_state *sta
if (impl->valid_metadata & nir_metadata_instr_index)
validate_instr_index(impl, state);
if (((impl->valid_metadata & nir_metadata_dominance) ||
NIR_DEBUG(VALIDATE_SSA_DOMINANCE))) {
validate_dominance(impl, state);
}
/* This validates both metadata and SSA dominance. */
validate_dominance(impl, state);
if (impl->valid_metadata & nir_metadata_live_defs)
validate_live_defs(impl, state);

View file

@ -307,7 +307,6 @@ brw_kernel_from_spirv(struct brw_compiler *compiler,
spirv_to_nir(spirv, spirv_size / 4, NULL, 0, MESA_SHADER_KERNEL,
entrypoint_name, &spirv_options, nir_options);
nir_validate_shader(nir, "after spirv_to_nir");
nir_validate_ssa_dominance(nir, "after spirv_to_nir");
ralloc_steal(mem_ctx, nir);
nir->info.name = ralloc_strdup(nir, entrypoint_name);
@ -623,7 +622,6 @@ brw_nir_from_spirv(void *mem_ctx, unsigned gfx_version, const uint32_t *spirv,
spirv_to_nir(spirv, spirv_size / 4, NULL, 0, MESA_SHADER_KERNEL,
"library", &spirv_options, nir_options);
nir_validate_shader(nir, "after spirv_to_nir");
nir_validate_ssa_dominance(nir, "after spirv_to_nir");
ralloc_steal(mem_ctx, nir);
nir->info.name = ralloc_strdup(nir, "library");

View file

@ -756,7 +756,6 @@ anv_load_fp64_shader(struct anv_device *device)
assert(nir != NULL);
nir_validate_shader(nir, "after spirv_to_nir");
nir_validate_ssa_dominance(nir, "after spirv_to_nir");
NIR_PASS_V(nir, nir_lower_variable_initializers, nir_var_function_temp);
NIR_PASS_V(nir, nir_lower_returns);

View file

@ -152,7 +152,6 @@ vk_spirv_to_nir(struct vk_device *device,
assert(nir->info.stage == stage);
nir_validate_shader(nir, "after spirv_to_nir");
nir_validate_ssa_dominance(nir, "after spirv_to_nir");
if (mem_ctx != NULL)
ralloc_steal(mem_ctx, nir);