ac,radv: move mesh scratch ring constants to ac
To be shared with radeonsi. Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Timur Kristóf <timur.kristof@gmail.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35931>
This commit is contained in:
@@ -411,6 +411,28 @@ uint32_t ac_memory_ops_per_clock(uint32_t vram_type);
|
||||
|
||||
uint32_t ac_gfx103_get_cu_mask_ps(const struct radeon_info *info);
|
||||
|
||||
/* Number of entries in the mesh shader scratch ring.
|
||||
* This depends on VGT_GS_MAX_WAVE_ID which is set by the kernel
|
||||
* and is impossible to query. We leave it on its maximum value
|
||||
* because real applications are unlikely to use it.
|
||||
*
|
||||
* The maximum ID on GFX10.3 is 2047 (0x7ff), so we need 2048 entries.
|
||||
*/
|
||||
#define AC_MESH_SCRATCH_NUM_ENTRIES 2048
|
||||
|
||||
/* Size of each entry in the mesh shader scratch ring.
|
||||
* We must ensure that the absolute maximum mesh shader output fits here.
|
||||
*
|
||||
* Mesh shaders can create up to 256 vertices/primitives per workgroup,
|
||||
* and up to the following amount of outputs:
|
||||
* - 32 parameters
|
||||
* - 4 positions (clip/cull distance, etc.)
|
||||
* - 4 per-primitive built-in outputs (layer, view index, prim id, VRS rate)
|
||||
* - primitive indices which are always kept in LDS
|
||||
* That is a total of 32+4+4=40 output slots x 16 bytes per slot x 256 = 160K bytes.
|
||||
*/
|
||||
#define AC_MESH_SCRATCH_ENTRY_BYTES (160 * 1024)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -210,7 +210,7 @@ lower_abi_instr(nir_builder *b, nir_intrinsic_instr *intrin, void *state)
|
||||
case nir_intrinsic_load_ring_mesh_scratch_offset_amd:
|
||||
/* gs_tg_info[0:11] is ordered_wave_id. Multiply by the ring entry size. */
|
||||
replacement = nir_imul_imm(b, nir_iand_imm(b, ac_nir_load_arg(b, &s->args->ac, s->args->ac.gs_tg_info), 0xfff),
|
||||
RADV_MESH_SCRATCH_ENTRY_BYTES);
|
||||
AC_MESH_SCRATCH_ENTRY_BYTES);
|
||||
break;
|
||||
case nir_intrinsic_load_lshs_vertex_stride_amd: {
|
||||
if (stage == MESA_SHADER_VERTEX) {
|
||||
|
||||
@@ -80,28 +80,6 @@
|
||||
*/
|
||||
#define RADV_MAX_MEMORY_ALLOCATION_SIZE 0xFFFFFFFCull
|
||||
|
||||
/* Number of entries in the mesh shader scratch ring.
|
||||
* This depends on VGT_GS_MAX_WAVE_ID which is set by the kernel
|
||||
* and is impossible to query. We leave it on its maximum value
|
||||
* because real applications are unlikely to use it.
|
||||
*
|
||||
* The maximum ID on GFX10.3 is 2047 (0x7ff), so we need 2048 entries.
|
||||
*/
|
||||
#define RADV_MESH_SCRATCH_NUM_ENTRIES 2048
|
||||
|
||||
/* Size of each entry in the mesh shader scratch ring.
|
||||
* We must ensure that the absolute maximum mesh shader output fits here.
|
||||
*
|
||||
* Mesh shaders can create up to 256 vertices/primitives per workgroup,
|
||||
* and up to the following amount of outputs:
|
||||
* - 32 parameters
|
||||
* - 4 positions (clip/cull distance, etc.)
|
||||
* - 4 per-primitive built-in outputs (layer, view index, prim id, VRS rate)
|
||||
* - primitive indices which are always kept in LDS
|
||||
* That is a total of 32+4+4=40 output slots x 16 bytes per slot x 256 = 160K bytes.
|
||||
*/
|
||||
#define RADV_MESH_SCRATCH_ENTRY_BYTES (160 * 1024)
|
||||
|
||||
/* Number of invocations in each subgroup. */
|
||||
#define RADV_SUBGROUP_SIZE 64
|
||||
|
||||
|
||||
@@ -334,7 +334,7 @@ radv_fill_shader_rings(struct radv_device *device, uint32_t *desc, struct radeon
|
||||
desc += 8;
|
||||
|
||||
if (mesh_scratch_ring_bo) {
|
||||
radv_set_ring_buffer(pdev, mesh_scratch_ring_bo, 0, RADV_MESH_SCRATCH_NUM_ENTRIES * RADV_MESH_SCRATCH_ENTRY_BYTES,
|
||||
radv_set_ring_buffer(pdev, mesh_scratch_ring_bo, 0, AC_MESH_SCRATCH_NUM_ENTRIES * AC_MESH_SCRATCH_ENTRY_BYTES,
|
||||
false, false, false, 0, 0, &desc[0]);
|
||||
}
|
||||
|
||||
@@ -1043,13 +1043,13 @@ radv_update_preamble_cs(struct radv_queue_state *queue, struct radv_device *devi
|
||||
if (!queue->ring_info.mesh_scratch_ring && needs->mesh_scratch_ring) {
|
||||
assert(pdev->info.gfx_level >= GFX10_3);
|
||||
result =
|
||||
radv_bo_create(device, NULL, RADV_MESH_SCRATCH_NUM_ENTRIES * RADV_MESH_SCRATCH_ENTRY_BYTES, 256,
|
||||
radv_bo_create(device, NULL, AC_MESH_SCRATCH_NUM_ENTRIES * AC_MESH_SCRATCH_ENTRY_BYTES, 256,
|
||||
RADEON_DOMAIN_VRAM, ring_bo_flags, RADV_BO_PRIORITY_SCRATCH, 0, true, &mesh_scratch_ring_bo);
|
||||
|
||||
if (result != VK_SUCCESS)
|
||||
goto fail;
|
||||
radv_rmv_log_command_buffer_bo_create(device, mesh_scratch_ring_bo, 0, 0,
|
||||
RADV_MESH_SCRATCH_NUM_ENTRIES * RADV_MESH_SCRATCH_ENTRY_BYTES);
|
||||
AC_MESH_SCRATCH_NUM_ENTRIES * AC_MESH_SCRATCH_ENTRY_BYTES);
|
||||
}
|
||||
|
||||
if (!queue->ring_info.ge_rings && needs->ge_rings) {
|
||||
|
||||
Reference in New Issue
Block a user