radv: add support for computeDerivativeGroupQuads on < GFX12

This was also supported by PAL.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38771>
This commit is contained in:
Samuel Pitoiset
2025-12-02 15:26:49 +01:00
committed by Marge Bot
parent 6a8460297a
commit d1386e167e
2 changed files with 12 additions and 1 deletions

View File

@@ -1051,7 +1051,7 @@ radv_physical_device_get_features(const struct radv_physical_device *pdev, struc
.depthClipEnable = true,
/* VK_KHR_compute_shader_derivatives */
.computeDerivativeGroupQuads = pdev->info.gfx_level >= GFX12,
.computeDerivativeGroupQuads = true,
.computeDerivativeGroupLinear = true,
/* VK_EXT_ycbcr_image_arrays */

View File

@@ -628,6 +628,17 @@ radv_shader_spirv_to_nir(struct radv_device *device, const struct radv_shader_st
NIR_PASS(_, nir, nir_lower_view_index_to_device_index);
NIR_PASS(_, nir, nir_lower_system_values);
if (pdev->info.gfx_level < GFX12 && nir->info.derivative_group == DERIVATIVE_GROUP_QUADS) {
nir_lower_compute_system_values_options csv_options = {
.shuffle_local_ids_for_quad_derivatives = true,
.lower_local_invocation_index = true,
};
NIR_PASS(_, nir, nir_opt_cse); /* CSE load_local_invocation_id */
NIR_PASS(_, nir, nir_lower_compute_system_values, &csv_options);
}
nir_lower_compute_system_values_options csv_options = {
/* Mesh shaders run as NGG which can implement local_invocation_index from
* the wave ID in merged_wave_info, but they don't have local_invocation_ids on GFX10.3.