diff --git a/.pick_status.json b/.pick_status.json index 95a52ca3ffb..4d0b01fb2c2 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1039,7 +1039,7 @@ "description": "intel/nir/rt: change scratch check validation", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "c78be5da300ae386a12b91a22efb064335e2043a" }, diff --git a/src/intel/compiler/brw_nir_lower_shader_calls.c b/src/intel/compiler/brw_nir_lower_shader_calls.c index 9a7f330e70c..90beab18dc9 100644 --- a/src/intel/compiler/brw_nir_lower_shader_calls.c +++ b/src/intel/compiler/brw_nir_lower_shader_calls.c @@ -25,6 +25,28 @@ #include "brw_nir_rt_builder.h" #include "nir_phi_builder.h" +UNUSED static bool +no_load_scratch_base_ptr_intrinsic(nir_shader *shader) +{ + nir_foreach_function(func, shader) { + if (!func->impl) + continue; + + nir_foreach_block(block, func->impl) { + nir_foreach_instr(instr, block) { + if (instr->type != nir_instr_type_intrinsic) + continue; + + nir_intrinsic_instr *intrin = nir_instr_as_intrinsic(instr); + if (intrin->intrinsic == nir_intrinsic_load_scratch_base_ptr) + return false; + } + } + } + + return true; +} + /** Insert the appropriate return instruction at the end of the shader */ void brw_nir_lower_shader_returns(nir_shader *shader) @@ -46,7 +68,7 @@ brw_nir_lower_shader_returns(nir_shader *shader) * This isn't needed for ray-gen shaders because they end the thread and * never return to the calling trampoline shader. */ - assert(shader->scratch_size == 0); + assert(no_load_scratch_base_ptr_intrinsic(shader)); if (shader->info.stage != MESA_SHADER_RAYGEN) shader->scratch_size = BRW_BTD_STACK_CALLEE_DATA_SIZE;