radv: Use linear_dispatch info in GFX11 task/mesh draw packet.

This helps the CP (command processor) optimize mesh shader
dispatch when Y = Z = 1.

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22222>
This commit is contained in:
Timur Kristóf 2023-03-30 20:08:35 +02:00 committed by Marge Bot
parent e42d2bd534
commit 50e9a8f7c2
3 changed files with 11 additions and 1 deletions

View file

@ -8167,11 +8167,14 @@ radv_cs_emit_dispatch_taskmesh_gfx_packet(struct radv_cmd_buffer *cmd_buffer)
uint32_t ring_entry_reg = ((base_reg + ring_entry_loc->sgpr_idx * 4) - SI_SH_REG_OFFSET) >> 2;
uint32_t xyz_dim_en = 1; /* TODO: disable XYZ_DIM when unneeded */
uint32_t mode1_en = 1; /* legacy fast launch mode */
uint32_t linear_dispatch_en =
cmd_buffer->state.shaders[MESA_SHADER_TASK]->info.cs.linear_taskmesh_dispatch;
radeon_emit(cs, PKT3(PKT3_DISPATCH_TASKMESH_GFX, 2, predicating));
radeon_emit(cs, S_4D0_RING_ENTRY_REG(ring_entry_reg) | S_4D0_XYZ_DIM_REG(xyz_dim_reg));
if (cmd_buffer->device->physical_device->rad_info.gfx_level >= GFX11)
radeon_emit(cs, S_4D1_XYZ_DIM_ENABLE(xyz_dim_en) | S_4D1_MODE1_ENABLE(mode1_en));
radeon_emit(cs, S_4D1_XYZ_DIM_ENABLE(xyz_dim_en) | S_4D1_MODE1_ENABLE(mode1_en) |
S_4D1_LINEAR_DISPATCH_ENABLE(linear_dispatch_en));
else
radeon_emit(cs, 0);
radeon_emit(cs, V_0287F0_DI_SRC_SEL_AUTO_INDEX);

View file

@ -373,6 +373,7 @@ struct radv_shader_info {
bool uses_dynamic_rt_callable_stack;
bool uses_rt;
bool uses_full_subgroups;
bool linear_taskmesh_dispatch;
bool regalloc_hang_bug;
} cs;

View file

@ -721,6 +721,12 @@ gather_shader_info_task(const nir_shader *nir, struct radv_shader_info *info)
/* Needed for storing draw ready only on the 1st thread. */
info->cs.uses_local_invocation_idx = true;
/* Task->Mesh dispatch is linear when Y = Z = 1.
* GFX11 CP can optimize this case with a field in its draw packets.
*/
info->cs.linear_taskmesh_dispatch = nir->info.mesh.ts_mesh_dispatch_dimensions[1] == 1 &&
nir->info.mesh.ts_mesh_dispatch_dimensions[2] == 1;
}
static uint32_t