From 8256097c0c3dbcd0a8a0de7f5c7adfd763cfeb51 Mon Sep 17 00:00:00 2001 From: Georg Lehmann Date: Wed, 23 Apr 2025 17:25:13 +0200 Subject: [PATCH] radv: advertise VK_NV_cooperative_matrix2/cooperativeMatrixConversions behind an env var Reviewed-by: Samuel Pitoiset Reviewed-by: Rhys Perry Part-of: --- src/amd/vulkan/radv_instance.c | 3 +++ src/amd/vulkan/radv_instance.h | 1 + src/amd/vulkan/radv_physical_device.c | 24 ++++++++++++++++++++++++ src/util/00-radv-defaults.conf | 1 + src/util/driconf.h | 4 ++++ 5 files changed, 33 insertions(+) diff --git a/src/amd/vulkan/radv_instance.c b/src/amd/vulkan/radv_instance.c index 9d8deaaf669..44ee0a9939a 100644 --- a/src/amd/vulkan/radv_instance.c +++ b/src/amd/vulkan/radv_instance.c @@ -196,6 +196,7 @@ static const driOptionDescription radv_dri_options[] = { DRI_CONF_RADV_EMULATE_RT(false) DRI_CONF_RADV_ENABLE_FLOAT16_GFX8(false) DRI_CONF_RADV_DISABLE_HIZ_HIS_GFX12(false) + DRI_CONF_RADV_COOPERATIVE_MATRIX2_NV(false) DRI_CONF_SECTION_END }; // clang-format on @@ -300,6 +301,8 @@ radv_init_dri_options(struct radv_instance *instance) instance->drirc.expose_float16_gfx8 = driQueryOptionb(&instance->drirc.options, "radv_enable_float16_gfx8"); instance->drirc.disable_hiz_his_gfx12 = driQueryOptionb(&instance->drirc.options, "radv_disable_hiz_his_gfx12"); + + instance->drirc.cooperative_matrix2_nv = driQueryOptionb(&instance->drirc.options, "radv_cooperative_matrix2_nv"); } static const struct vk_instance_extension_table radv_instance_extensions_supported = { diff --git a/src/amd/vulkan/radv_instance.h b/src/amd/vulkan/radv_instance.h index 42285001563..a12610c3428 100644 --- a/src/amd/vulkan/radv_instance.h +++ b/src/amd/vulkan/radv_instance.h @@ -74,6 +74,7 @@ struct radv_instance { bool emulate_rt; bool expose_float16_gfx8; bool disable_hiz_his_gfx12; + bool cooperative_matrix2_nv; char *app_layer; uint8_t override_graphics_shader_version; uint8_t override_compute_shader_version; diff --git a/src/amd/vulkan/radv_physical_device.c b/src/amd/vulkan/radv_physical_device.c index ef6281e1f94..d8b8c4d4c77 100644 --- a/src/amd/vulkan/radv_physical_device.c +++ b/src/amd/vulkan/radv_physical_device.c @@ -140,6 +140,17 @@ radv_cooperative_matrix_enabled(const struct radv_physical_device *pdev) return pdev->info.gfx_level >= GFX11 && !pdev->use_llvm; } +static bool +radv_cooperative_matrix2_nv_enabled(const struct radv_physical_device *pdev) +{ + if (!radv_cooperative_matrix_enabled(pdev)) + return false; + + const struct radv_instance *instance = radv_physical_device_instance(pdev); + + return instance->drirc.cooperative_matrix2_nv; +} + bool radv_enable_rt(const struct radv_physical_device *pdev) { @@ -764,6 +775,7 @@ radv_physical_device_get_supported_extensions(const struct radv_physical_device .INTEL_shader_integer_functions2 = true, .MESA_image_alignment_control = pdev->info.gfx_level >= GFX9, .NV_compute_shader_derivatives = true, + .NV_cooperative_matrix2 = radv_cooperative_matrix2_nv_enabled(pdev), .VALVE_mutable_descriptor_type = true, }; *out_ext = ext; @@ -1345,6 +1357,9 @@ radv_physical_device_get_features(const struct radv_physical_device *pdev, struc /* VK_EXT_shader_float8 */ .shaderFloat8 = true, .shaderFloat8CooperativeMatrix = radv_cooperative_matrix_enabled(pdev), + + /* VK_NV_cooperative_matrix2 */ + .cooperativeMatrixConversions = true, }; } @@ -2988,3 +3003,12 @@ radv_GetPhysicalDeviceCooperativeMatrixPropertiesKHR(VkPhysicalDevice physicalDe return vk_outarray_status(&out); } + +VKAPI_ATTR VkResult VKAPI_CALL +radv_GetPhysicalDeviceCooperativeMatrixFlexibleDimensionsPropertiesNV( + VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount, + VkCooperativeMatrixFlexibleDimensionsPropertiesNV *pProperties) +{ + *pPropertyCount = 0; + return VK_SUCCESS; +} diff --git a/src/util/00-radv-defaults.conf b/src/util/00-radv-defaults.conf index 75c7fb25a51..b82e8d4da4d 100644 --- a/src/util/00-radv-defaults.conf +++ b/src/util/00-radv-defaults.conf @@ -42,6 +42,7 @@ Application bugs worked around in this file: