Mesa (main): nir/validate: don't validate the GC list by default
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Feb 21 12:38:41 UTC 2022
Module: Mesa
Branch: main
Commit: 925c5f817db7702fdd2c894fd3e122f274af71dd
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=925c5f817db7702fdd2c894fd3e122f274af71dd
Author: Rhys Perry <pendingchaos02 at gmail.com>
Date: Wed Oct 27 11:25:27 2021 +0100
nir/validate: don't validate the GC list by default
This seems really slow.
Signed-off-by: Rhys Perry <pendingchaos02 at gmail.com>
Reviewed-by: Emma Anholt <emma at anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13547>
---
src/compiler/nir/nir.c | 2 ++
src/compiler/nir/nir.h | 1 +
src/compiler/nir/nir_validate.c | 11 +++++++----
3 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c
index 5a33ce82c66..7fb103f7faf 100644
--- a/src/compiler/nir/nir.c
+++ b/src/compiler/nir/nir.c
@@ -51,6 +51,8 @@ static const struct debug_named_value nir_debug_control[] = {
"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" },
+ { "validate_gc_list", NIR_DEBUG_VALIDATE_GC_LIST,
+ "Validate the instruction GC list at each successful lowering/optimization call" },
{ "tgsi", NIR_DEBUG_TGSI,
"Dump NIR/TGSI shaders when doing a NIR<->TGSI translation" },
{ "print", NIR_DEBUG_PRINT,
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index 45f025cd663..865b5ba454d 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -91,6 +91,7 @@ extern bool nir_debug_print_shader[MESA_SHADER_KERNEL + 1];
#define NIR_DEBUG_PRINT_CBS (1u << 18)
#define NIR_DEBUG_PRINT_KS (1u << 19)
#define NIR_DEBUG_PRINT_CONSTS (1u << 20)
+#define NIR_DEBUG_VALIDATE_GC_LIST (1u << 21)
#define NIR_DEBUG_PRINT (NIR_DEBUG_PRINT_VS | \
NIR_DEBUG_PRINT_TCS | \
diff --git a/src/compiler/nir/nir_validate.c b/src/compiler/nir/nir_validate.c
index 6721ca45582..c00dec9f189 100644
--- a/src/compiler/nir/nir_validate.c
+++ b/src/compiler/nir/nir_validate.c
@@ -1055,7 +1055,8 @@ validate_instr(nir_instr *instr, validate_state *state)
state->instr = instr;
- validate_assert(state, _mesa_set_search(state->shader_gc_list, instr));
+ if (state->shader_gc_list)
+ validate_assert(state, _mesa_set_search(state->shader_gc_list, instr));
switch (instr->type) {
case nir_instr_type_alu:
@@ -1660,7 +1661,8 @@ init_validate_state(validate_state *state)
state->blocks = _mesa_pointer_set_create(state->mem_ctx);
state->var_defs = _mesa_pointer_hash_table_create(state->mem_ctx);
state->errors = _mesa_pointer_hash_table_create(state->mem_ctx);
- state->shader_gc_list = _mesa_pointer_set_create(state->mem_ctx);
+ state->shader_gc_list = NIR_DEBUG(VALIDATE_GC_LIST) ?
+ _mesa_pointer_set_create(state->mem_ctx) : NULL;
state->loop = NULL;
state->instr = NULL;
@@ -1717,8 +1719,9 @@ nir_validate_shader(nir_shader *shader, const char *when)
validate_state state;
init_validate_state(&state);
- list_for_each_entry(nir_instr, instr, &shader->gc_list, gc_node) {
- _mesa_set_add(state.shader_gc_list, instr);
+ if (state.shader_gc_list) {
+ list_for_each_entry(nir_instr, instr, &shader->gc_list, gc_node)
+ _mesa_set_add(state.shader_gc_list, instr);
}
state.shader = shader;
More information about the mesa-commit
mailing list