From 505dd284c1aefa11ac190265ff822d1863cd7bbe Mon Sep 17 00:00:00 2001 From: Konstantin Seurer Date: Sun, 2 Oct 2022 13:16:51 +0200 Subject: [PATCH] radv: Remove main_loop_case_visited Totals from 7 (14.00% of 50) affected shaders: CodeSize: 219168 -> 216732 (-1.11%) Instrs: 40211 -> 40040 (-0.43%) Latency: 963520 -> 961498 (-0.21%) InvThroughput: 221435 -> 220974 (-0.21%) Copies: 5634 -> 5562 (-1.28%) PreSGPRs: 387 -> 380 (-1.81%) Reviewed-by: Bas Nieuwenhuizen Part-of: --- src/amd/vulkan/radv_pipeline_rt.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/src/amd/vulkan/radv_pipeline_rt.c b/src/amd/vulkan/radv_pipeline_rt.c index 03eb298ccd3..a53d5e693fe 100644 --- a/src/amd/vulkan/radv_pipeline_rt.c +++ b/src/amd/vulkan/radv_pipeline_rt.c @@ -224,10 +224,6 @@ struct rt_variables { nir_variable *hit_kind; nir_variable *opaque; - /* Safeguard to ensure we don't end up in an infinite loop of non-existing case. Should not be - * needed but is extra anti-hang safety during bring-up. */ - nir_variable *main_loop_case_visited; - /* Output variables for intersection & anyhit shaders. */ nir_variable *ahit_accept; nir_variable *ahit_terminate; @@ -295,8 +291,6 @@ create_rt_variables(nir_shader *shader, const VkRayTracingPipelineCreateInfoKHR vars.hit_kind = nir_variable_create(shader, nir_var_shader_temp, glsl_uint_type(), "hit_kind"); vars.opaque = nir_variable_create(shader, nir_var_shader_temp, glsl_bool_type(), "opaque"); - vars.main_loop_case_visited = - nir_variable_create(shader, nir_var_shader_temp, glsl_bool_type(), "main_loop_case_visited"); vars.ahit_accept = nir_variable_create(shader, nir_var_shader_temp, glsl_bool_type(), "ahit_accept"); vars.ahit_terminate = @@ -731,7 +725,6 @@ insert_rt_case(nir_builder *b, nir_shader *shader, struct rt_variables *vars, ni reserve_stack_size(vars, shader->scratch_size); nir_push_if(b, nir_ieq_imm(b, idx, call_idx)); - nir_store_var(b, vars->main_loop_case_visited, nir_imm_bool(b, true), 1); nir_inline_function_impl(b, nir_shader_get_entrypoint(shader), NULL, var_remap); nir_pop_if(b, NULL); @@ -1504,7 +1497,6 @@ insert_traversal(struct radv_device *device, const VkRayTracingPipelineCreateInf /* For now, just inline the traversal shader */ nir_push_if(b, nir_ieq_imm(b, nir_load_var(b, vars->idx), 1)); - nir_store_var(b, vars->main_loop_case_visited, nir_imm_bool(b, true), 1); nir_inline_function_impl(b, nir_shader_get_entrypoint(shader), NULL, var_remap); nir_pop_if(b, NULL); @@ -1646,17 +1638,12 @@ create_rt_shader(struct radv_device *device, const VkRayTracingPipelineCreateInf else nir_store_var(&b, vars.stack_ptr, nir_imm_int(&b, MAX_STACK_SCRATCH_ENTRY_COUNT * 4), 0x1); - nir_store_var(&b, vars.main_loop_case_visited, nir_imm_bool(&b, true), 1); - nir_loop *loop = nir_push_loop(&b); - nir_push_if(&b, nir_ior(&b, nir_ieq_imm(&b, nir_load_var(&b, vars.idx), 0), - nir_inot(&b, nir_load_var(&b, vars.main_loop_case_visited)))); + nir_push_if(&b, nir_ieq_imm(&b, nir_load_var(&b, vars.idx), 0)); nir_jump(&b, nir_jump_break); nir_pop_if(&b, NULL); - nir_store_var(&b, vars.main_loop_case_visited, nir_imm_bool(&b, false), 1); - insert_traversal(device, pCreateInfo, &b, &vars); nir_ssa_def *idx = nir_load_var(&b, vars.idx);