panvk: Enable VK_ARM_shader_core_builtins

While the shaderCoreBuiltins feature is only supported on v9+, the
extension itself provides some useful physical device properties and is
supported on all GPUs.

Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36019>
This commit is contained in:
John Anthony 2025-07-07 22:05:23 +02:00
parent c46407de88
commit dff1d91c64
4 changed files with 19 additions and 1 deletions

View file

@ -698,6 +698,7 @@ Khronos extensions that are not part of any Vulkan version:
VK_AMD_shader_trinary_minmax DONE (radv)
VK_AMD_texture_gather_bias_lod DONE (anv, radv)
VK_ARM_rasterization_order_attachment_access DONE (lvp, tu, vn)
VK_ARM_shader_core_builtins DONE (panvk)
VK_ARM_shader_core_properties DONE (panvk/v10+)
VK_EXT_mutable_descriptor_type DONE (anv, hk, lvp, nvk, panvk/v9+, radv, tu, vn)
VK_EXT_swapchain_colorspace DONE (anv, hk, lvp, nvk, radv, tu, v3dv, vn)

View file

@ -2,3 +2,4 @@ EGL_EXT_create_context_robustness support on Panfrost V10+
GL_ARB_robust_buffer_access_behavior, GL_KHR_robust_buffer_access_behavior and GL_KHR_robustness support on Panfrost
VK_EXT_mutable_descriptor_type on panvk/v9+
GL_KHR_robustness on v3d
VK_ARM_shader_core_builtins on panvk

View file

@ -179,6 +179,7 @@ panvk_per_arch(get_physical_device_extensions)(
.GOOGLE_hlsl_functionality1 = true,
.GOOGLE_user_type = true,
.ARM_shader_core_builtins = true,
.ARM_shader_core_properties = has_vk1_1,
};
}
@ -503,6 +504,9 @@ panvk_per_arch(get_physical_device_features)(
/* VK_KHR_present_wait2 */
.presentWait2 = true,
#endif
/* VK_ARM_shader_core_builtins */
.shaderCoreBuiltins = PAN_ARCH >= 9,
};
}
@ -962,6 +966,12 @@ panvk_per_arch(get_physical_device_properties)(
/* VK_EXT_host_image_copy */
.identicalMemoryTypeRequirements = true,
/* VK_ARM_shader_core_builtins */
.shaderCoreMask = device->kmod.props.shader_present,
.shaderCoreCount = util_bitcount(device->kmod.props.shader_present),
.shaderWarpsPerCore = device->kmod.props.max_threads_per_core /
(pan_subgroup_size(PAN_ARCH) * 2),
};
snprintf(properties->deviceName, sizeof(properties->deviceName), "%s",

View file

@ -385,10 +385,12 @@ panvk_get_spirv_options(UNUSED struct vk_physical_device *vk_pdev,
}
static void
panvk_preprocess_nir(UNUSED struct vk_physical_device *vk_pdev,
panvk_preprocess_nir(struct vk_physical_device *vk_pdev,
nir_shader *nir,
UNUSED const struct vk_pipeline_robustness_state *rs)
{
struct panvk_physical_device *pdev = to_panvk_physical_device(vk_pdev);
/* Ensure to regroup output variables at the same location */
if (nir->info.stage == MESA_SHADER_FRAGMENT)
NIR_PASS(_, nir, nir_opt_vectorize_io_vars, nir_var_shader_out);
@ -456,6 +458,10 @@ panvk_preprocess_nir(UNUSED struct vk_physical_device *vk_pdev,
NIR_PASS(_, nir, nir_split_var_copies);
NIR_PASS(_, nir, nir_lower_var_copies);
uint64_t core_max_id = util_last_bit(pdev->kmod.props.shader_present) - 1;
NIR_PASS(_, nir, nir_inline_sysval, nir_intrinsic_load_core_max_id_arm,
core_max_id);
}
static void