From 3c3c94532a7e1980dc19a464fd02b2a433fae646 Mon Sep 17 00:00:00 2001 From: Sagar Ghuge Date: Thu, 16 Apr 2026 15:20:46 -0700 Subject: [PATCH] anv: Fix Wa_14021821874, Wa_14018813551, Wa_14026600921 StackSizePerRay is the RTDispatchGlobals::AsyncStackSize and DisableRTGlobalsKnownValues is to interpret how many Max BVH levels we need to use. It's not relevant to Vulkan, since we have just 2 fixed BVH levels. Fixes: cb423ee6 ("anv: Fix Wa_14021821874, Wa_14018813551, Wa_14026600921") Fixes: c1a44e8d ("anv: force StackIDControl value for Wa_14021821874") Signed-off-by: Sagar Ghuge Reviewed-by: Lionel Landwerlin (cherry picked from commit 7a627fa8f31657fcd3ee780dadf7fa5033464c13) Part-of: --- .pick_status.json | 2 +- src/intel/compiler/brw/brw_rt.h | 32 +++++++++++++++++++++++++---- src/intel/vulkan/genX_cmd_compute.c | 3 ++- 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index b6cda7655b2..996884ec050 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -3474,7 +3474,7 @@ "description": "anv: Fix Wa_14021821874, Wa_14018813551, Wa_14026600921", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "cb423ee63608551e0d20d9f1fe36598c9e8883fa", "notes": null diff --git a/src/intel/compiler/brw/brw_rt.h b/src/intel/compiler/brw/brw_rt.h index bbc1d901ca3..ae3abf6de4e 100644 --- a/src/intel/compiler/brw/brw_rt.h +++ b/src/intel/compiler/brw/brw_rt.h @@ -231,7 +231,26 @@ brw_rt_compute_scratch_layout(struct brw_rt_scratch_layout *layout, assert(size % 64 == 0); /* Cache-line aligned */ assert(size < UINT32_MAX); layout->ray_stack_start = size; - layout->ray_stack_stride = BRW_RT_ASYNC_STACK_STRIDE; + + /* Wa_14021821874, Wa_14018813551, Wa_14026600921: + * + * StackIDControlOverride_RTGlobals = 0 (i.e. 2k) + * SetStackSizePerRay = 64 (64*64B) + * DisableRTGlobalsKnownValues = 1 + * + * StackSizePerRay is the RTDispatchGlobals::AsyncStackSize and + * DisableRTGlobalsKnownValues is to interpret how many Max BVH levels we + * need to use. It's not relevant to Vulkan, since we have just 2 fixed BVH + * levels. + */ + if (intel_needs_workaround(devinfo, 14021821874) || + intel_needs_workaround(devinfo, 14018813551) || + intel_needs_workaround(devinfo, 14026600921)) { + layout->ray_stack_stride = 64 * 64; + } else { + layout->ray_stack_stride = BRW_RT_ASYNC_STACK_STRIDE; + } + size += num_stack_ids * layout->ray_stack_stride; /* Finally, we place the SW stacks for the individual ray-tracing shader @@ -281,9 +300,14 @@ brw_rt_ray_queries_stack_ids_per_dss(const struct intel_device_info *devinfo) /* Wa_14021821874, Wa_14018813551, Wa_14026600921: * - * "StackIDControlOverride_RTGlobals = 0 (i.e. 2k)". We - * already set stack size per ray to 64 in brw_nir_lower_rt_intrinsics - * as the workaround also requires. + * StackIDControlOverride_RTGlobals = 0 (i.e. 2k) + * SetStackSizePerRay = 64 (64*64B) + * DisableRTGlobalsKnownValues = 1 + * + * StackSizePerRay is the RTDispatchGlobals::AsyncStackSize and + * DisableRTGlobalsKnownValues is to interpret how many Max BVH levels we + * need to use. It's not relevant to Vulkan, since we have just 2 fixed BVH + * levels. */ if (intel_needs_workaround(devinfo, 14021821874) || intel_needs_workaround(devinfo, 14018813551) || diff --git a/src/intel/vulkan/genX_cmd_compute.c b/src/intel/vulkan/genX_cmd_compute.c index 0a741ec5c5b..3ff42e8cc96 100644 --- a/src/intel/vulkan/genX_cmd_compute.c +++ b/src/intel/vulkan/genX_cmd_compute.c @@ -852,7 +852,8 @@ genX(cmd_buffer_ray_query_globals)(struct anv_cmd_buffer *cmd_buffer) .bo = device->ray_query_bo[idx], .offset = (i + 1) * (device->ray_query_bo[idx]->size / 2), }, - .AsyncRTStackSize = BRW_RT_SIZEOF_RAY_QUERY / 64, + .AsyncRTStackSize = + cmd_buffer->state.rt.scratch.layout.ray_stack_stride / 64, .NumDSSRTStacks = stack_ids_per_dss, .MaxBVHLevels = BRW_RT_MAX_BVH_LEVELS, .Flags = RT_DEPTH_TEST_LESS_EQUAL,