Wire up support for maintenance4 validation
authorGraeme Leese <gleese@broadcom.com>
Mon, 9 Aug 2021 16:31:31 +0000 (17:31 +0100)
committerPeter Kohaut <peter.kohaut@gmail.com>
Sun, 5 Sep 2021 22:12:56 +0000 (00:12 +0200)
Pass the appropriate option to spirv-val if VK_KHR_maintenance4 is
supported.

Components: Vulkan
Affects: dEQP-VK.spirv_assembly.instruction.compute.*

Change-Id: I554bac9160dc55a017e1358a579b59249ed81079

external/fetch_sources.py
external/vulkancts/framework/vulkan/vkSpirVAsm.cpp
external/vulkancts/framework/vulkan/vkSpirVProgram.hpp
external/vulkancts/framework/vulkan/vkValidatorOptions.hpp
external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmComputeShaderCase.cpp

index c99c293..f9b91c3 100644 (file)
@@ -317,7 +317,7 @@ PACKAGES = [
        GitRepo(
                "https://github.com/KhronosGroup/SPIRV-Tools.git",
                None,
-               "11cd875ed88484f93943071083b4821b4c3d2193",
+               "ee30773650eca50b1cd3c913babcc2b50d7b91fd",
                "spirv-tools"),
        GitRepo(
                "https://github.com/KhronosGroup/glslang.git",
@@ -328,7 +328,7 @@ PACKAGES = [
        GitRepo(
                "https://github.com/KhronosGroup/SPIRV-Headers.git",
                None,
-               "cf653e4ca4858583802b0d1656bc934edff6bd7f",
+               "449bc986ba6f4c5e10e32828783f9daef2a77644",
                "spirv-headers"),
        GitRepo(
                "https://github.com/google/amber.git",
index e408665..576fa24 100644 (file)
@@ -189,6 +189,9 @@ bool validateSpirV (size_t binarySizeInWords, const deUint32* binary, std::ostre
                        spvValidatorOptionsSetWorkgroupScalarBlockLayout(options, true);
                }
 
+               if (val_options.flags & SpirvValidatorOptions::FLAG_SPIRV_VALIDATOR_ALLOW_LOCALSIZEID)
+                       spvValidatorOptionsSetAllowLocalSizeId(options, true);
+
                const spv_result_t              valid   = spvValidateWithOptions(context, options, &cbinary, &diagnostic);
                const bool                              passed  = (valid == SPV_SUCCESS);
 
index 896618b..cf15a4b 100644 (file)
@@ -42,23 +42,28 @@ struct SpirVAsmBuildOptions
        deUint32                vulkanVersion;
        SpirvVersion    targetVersion;
        bool                    supports_VK_KHR_spirv_1_4;
+       bool                    supports_VK_KHR_maintenance4;
 
-       SpirVAsmBuildOptions (deUint32 vulkanVersion_, SpirvVersion targetVersion_, bool allowSpirv14 = false)
-               : vulkanVersion                         (vulkanVersion_)
-               , targetVersion                         (targetVersion_)
-               , supports_VK_KHR_spirv_1_4     (allowSpirv14)
+       SpirVAsmBuildOptions (deUint32 vulkanVersion_, SpirvVersion targetVersion_, bool allowSpirv14 = false, bool allowMaintenance4 = false)
+               : vulkanVersion                                 (vulkanVersion_)
+               , targetVersion                                 (targetVersion_)
+               , supports_VK_KHR_spirv_1_4             (allowSpirv14)
+               , supports_VK_KHR_maintenance4  (allowMaintenance4)
        {}
 
        SpirVAsmBuildOptions (void)
-               : vulkanVersion                         (VK_MAKE_VERSION(1, 0, 0))
-               , targetVersion                         (SPIRV_VERSION_1_0)
-               , supports_VK_KHR_spirv_1_4     (false)
+               : vulkanVersion                                 (VK_MAKE_VERSION(1, 0, 0))
+               , targetVersion                                 (SPIRV_VERSION_1_0)
+               , supports_VK_KHR_spirv_1_4             (false)
+               , supports_VK_KHR_maintenance4  (false)
        {}
 
        SpirvValidatorOptions getSpirvValidatorOptions() const
        {
                SpirvValidatorOptions result(vulkanVersion);
                result.supports_VK_KHR_spirv_1_4 = supports_VK_KHR_spirv_1_4;
+               if (supports_VK_KHR_maintenance4)
+                       result.flags = result.flags | SpirvValidatorOptions::FLAG_SPIRV_VALIDATOR_ALLOW_LOCALSIZEID;
                return result;
        }
 };
index a8451af..f85d2f7 100644 (file)
@@ -46,7 +46,8 @@ struct SpirvValidatorOptions
 
        enum Flags
        {
-               FLAG_SPIRV_VALIDATOR_WORKGROUP_SCALAR_BLOCK_LAYOUT              = (1u<<0)
+               FLAG_SPIRV_VALIDATOR_WORKGROUP_SCALAR_BLOCK_LAYOUT              = (1u<<0),
+               FLAG_SPIRV_VALIDATOR_ALLOW_LOCALSIZEID                                  = (1u<<1)
        };
 
        SpirvValidatorOptions(deUint32 the_vulkan_version = VK_MAKE_VERSION(1, 0, 0), BlockLayoutRules the_layout = kDefaultBlockLayout, bool allowSpirv14 = false, deUint32 the_flags = 0)
index fb102e1..bfa0f64 100644 (file)
@@ -449,12 +449,13 @@ void SpvAsmComputeShaderCase::checkSupport(Context& context) const
 
 void SpvAsmComputeShaderCase::initPrograms (SourceCollections& programCollection) const
 {
-       const auto&     extensions              = m_shaderSpec.extensions;
-       const bool      allowSpirv14    = (std::find(extensions.begin(), extensions.end(), "VK_KHR_spirv_1_4") != extensions.end());
+       const auto&     extensions                      = m_shaderSpec.extensions;
+       const bool      allowSpirv14            = (std::find(extensions.begin(), extensions.end(), "VK_KHR_spirv_1_4") != extensions.end());
+       const bool      allowMaintenance4       = (std::find(extensions.begin(), extensions.end(), "VK_KHR_maintenance4") != extensions.end());
 
        programCollection.spirvAsmSources.add("compute")
                << m_shaderSpec.assembly.c_str()
-               << SpirVAsmBuildOptions(programCollection.usedVulkanVersion, m_shaderSpec.spirvVersion, allowSpirv14);
+               << SpirVAsmBuildOptions(programCollection.usedVulkanVersion, m_shaderSpec.spirvVersion, allowSpirv14, allowMaintenance4);
 }
 
 TestInstance* SpvAsmComputeShaderCase::createInstance (Context& ctx) const