Module: Mesa
Branch: main
Commit: fb5abb956d63691b56806bf534222ae204f892be
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=fb5abb956d63691b56806bf534222ae204f892be

Author: Jesse Natalie <[email protected]>
Date:   Thu Mar 30 14:44:11 2023 -0700

dzn: Add a driconf option for enabling subgroup ops in VS/GS

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22225>

---

 src/microsoft/vulkan/dzn_device.c | 10 +++++++---
 src/util/00-mesa-defaults.conf    |  1 +
 src/util/driconf.h                |  3 +++
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/microsoft/vulkan/dzn_device.c 
b/src/microsoft/vulkan/dzn_device.c
index 1ad89cd8ee9..efbea8d1dce 100644
--- a/src/microsoft/vulkan/dzn_device.c
+++ b/src/microsoft/vulkan/dzn_device.c
@@ -1136,6 +1136,9 @@ static const driOptionDescription dzn_dri_options[] = {
    DRI_CONF_SECTION_DEBUG
       DRI_CONF_DZN_CLAIM_WIDE_LINES(false)
       DRI_CONF_DZN_ENABLE_8BIT_LOADS_STORES(false)
+      /* Default-disabled because the CTS doesn't check 
subgroupQuadOperationsInAllStages
+       * and tries to do quad ops in VS/GS which is unsupported. */
+      DRI_CONF_DZN_ENABLE_SUBGROUP_OPS_IN_VTX_PIPELINE(false)
    DRI_CONF_SECTION_END
 };
 
@@ -1586,6 +1589,7 @@ dzn_GetPhysicalDeviceProperties2(VkPhysicalDevice 
physicalDevice,
                                  VkPhysicalDeviceProperties2 *pProperties)
 {
    VK_FROM_HANDLE(dzn_physical_device, pdevice, physicalDevice);
+   struct dzn_instance *instance = container_of(pdevice->vk.instance, struct 
dzn_instance, vk);
 
    (void)dzn_physical_device_get_d3d12_dev(pdevice);
 
@@ -1777,9 +1781,9 @@ dzn_GetPhysicalDeviceProperties2(VkPhysicalDevice 
physicalDevice,
                                      VK_SUBGROUP_FEATURE_SHUFFLE_RELATIVE_BIT |
                                      VK_SUBGROUP_FEATURE_QUAD_BIT |
                                      VK_SUBGROUP_FEATURE_ARITHMETIC_BIT,
-      /* Note: The CTS doesn't seem to respect the 
subgroupQuadOperationsInAllStages bit, and it
-       * seems more useful to support quad ops in FS/CS than subgroup ops at 
all in VS/GS. */
-      .subgroupSupportedStages = VK_SHADER_STAGE_FRAGMENT_BIT | 
VK_SHADER_STAGE_COMPUTE_BIT,
+      .subgroupSupportedStages = VK_SHADER_STAGE_FRAGMENT_BIT | 
VK_SHADER_STAGE_COMPUTE_BIT |
+                                 (driQueryOptionb(&instance->dri_options, 
"dzn_enable_subgroup_ops_in_vtx_pipeline") ?
+                                    (VK_SHADER_STAGE_GEOMETRY_BIT | 
VK_SHADER_STAGE_VERTEX_BIT) : 0),
       .subgroupQuadOperationsInAllStages = false,
       .subgroupSize = pdevice->options1.WaveOps ? 
pdevice->options1.WaveLaneCountMin : 1,
    };
diff --git a/src/util/00-mesa-defaults.conf b/src/util/00-mesa-defaults.conf
index 3452f16b950..f39825cde5d 100644
--- a/src/util/00-mesa-defaults.conf
+++ b/src/util/00-mesa-defaults.conf
@@ -1043,6 +1043,7 @@ TODO: document the other workarounds.
     <device driver="dzn">
         <application name="DOOMEternal" executable="DOOMEternalx64vk.exe">
             <option name="dzn_enable_8bit_loads_stores" value="true" />
+            <option name="dzn_enable_subgroup_ops_in_vtx_pipeline" 
value="true" />
             <option name="dzn_claim_wide_lines" value="true" />
         </application>
         <application name="No Man's Sky" executable="NMS.exe">
diff --git a/src/util/driconf.h b/src/util/driconf.h
index 83b2533fc57..32be1d7ab0b 100644
--- a/src/util/driconf.h
+++ b/src/util/driconf.h
@@ -664,4 +664,7 @@
 #define DRI_CONF_DZN_ENABLE_8BIT_LOADS_STORES(def) \
    DRI_CONF_OPT_B(dzn_enable_8bit_loads_stores, def, "Enable 
VK_KHR_8bit_loads_stores")
 
+#define DRI_CONF_DZN_ENABLE_SUBGROUP_OPS_IN_VTX_PIPELINE(def) \
+   DRI_CONF_OPT_B(dzn_enable_subgroup_ops_in_vtx_pipeline, def, "Enable 
subgroup ops in pre-rasterizer stages (VS/GS)")
+
 #endif

Reply via email to