nir/validate: don't validate the GC list by default

This seems really slow.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13547>
This commit is contained in:
Rhys Perry
2021-10-27 11:25:27 +01:00
parent e6853de6b0
commit 925c5f817d
3 changed files with 10 additions and 4 deletions

View File

@@ -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,

View File

@@ -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 | \

View File

@@ -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;