radv: move updating compute scratch for RT when stack size is emitted
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31347>
This commit is contained in:
committed by
Marge Bot
parent
ebe66dee08
commit
f7482e85ba
@@ -11983,8 +11983,22 @@ static void
|
||||
radv_emit_rt_stack_size(struct radv_cmd_buffer *cmd_buffer)
|
||||
{
|
||||
struct radv_device *device = radv_cmd_buffer_device(cmd_buffer);
|
||||
const struct radv_physical_device *pdev = radv_device_physical(device);
|
||||
const struct radv_shader *rt_prolog = cmd_buffer->state.rt_prolog;
|
||||
unsigned rsrc2 = rt_prolog->config.rsrc2;
|
||||
|
||||
/* Reserve scratch for stacks manually since it is not handled by the compute path. */
|
||||
uint32_t scratch_bytes_per_wave = rt_prolog->config.scratch_bytes_per_wave;
|
||||
const uint32_t wave_size = rt_prolog->info.wave_size;
|
||||
|
||||
/* The hardware register is specified as a multiple of 64 or 256 DWORDS. */
|
||||
const unsigned scratch_alloc_granule = pdev->info.gfx_level >= GFX11 ? 256 : 1024;
|
||||
|
||||
scratch_bytes_per_wave += align(cmd_buffer->state.rt_stack_size * wave_size, scratch_alloc_granule);
|
||||
|
||||
cmd_buffer->compute_scratch_size_per_wave_needed =
|
||||
MAX2(cmd_buffer->compute_scratch_size_per_wave_needed, scratch_bytes_per_wave);
|
||||
|
||||
if (cmd_buffer->state.rt_stack_size)
|
||||
rsrc2 |= S_00B12C_SCRATCH_EN(1);
|
||||
|
||||
@@ -12287,17 +12301,6 @@ radv_trace_rays(struct radv_cmd_buffer *cmd_buffer, VkTraceRaysIndirectCommand2K
|
||||
struct radv_compute_pipeline *pipeline = &cmd_buffer->state.rt_pipeline->base;
|
||||
struct radv_shader *rt_prolog = cmd_buffer->state.rt_prolog;
|
||||
|
||||
/* Reserve scratch for stacks manually since it is not handled by the compute path. */
|
||||
uint32_t scratch_bytes_per_wave = rt_prolog->config.scratch_bytes_per_wave;
|
||||
uint32_t wave_size = rt_prolog->info.wave_size;
|
||||
|
||||
/* The hardware register is specified as a multiple of 64 or 256 DWORDS. */
|
||||
unsigned scratch_alloc_granule = pdev->info.gfx_level >= GFX11 ? 256 : 1024;
|
||||
scratch_bytes_per_wave += align(cmd_buffer->state.rt_stack_size * wave_size, scratch_alloc_granule);
|
||||
|
||||
cmd_buffer->compute_scratch_size_per_wave_needed =
|
||||
MAX2(cmd_buffer->compute_scratch_size_per_wave_needed, scratch_bytes_per_wave);
|
||||
|
||||
/* Since the workgroup size is 8x4 (or 8x8), 1D dispatches can only fill 8 threads per wave at most. To increase
|
||||
* occupancy, it's beneficial to convert to a 2D dispatch in these cases. */
|
||||
if (tables && tables->height == 1 && tables->width >= cmd_buffer->state.rt_prolog->info.cs.block_size[0])
|
||||
|
||||
Reference in New Issue
Block a user