From 13bee18ec011a8d3ed042f597b80f5324996ba1e Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Sat, 27 Jan 2024 10:57:28 -0800 Subject: [PATCH 1/2] Use subgroups helper in derivate tests For the tests that need subgroup ops, use the existing subgroups helper, rather than open-coding the same checks. --- .../vktShaderRenderDerivateTests.cpp | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/external/vulkancts/modules/vulkan/shaderrender/vktShaderRenderDerivateTests.cpp b/external/vulkancts/modules/vulkan/shaderrender/vktShaderRenderDerivateTests.cpp index 52fda64012..fb195c267f 100644 --- a/external/vulkancts/modules/vulkan/shaderrender/vktShaderRenderDerivateTests.cpp +++ b/external/vulkancts/modules/vulkan/shaderrender/vktShaderRenderDerivateTests.cpp @@ -31,6 +31,7 @@ #include "vktShaderRenderDerivateTests.hpp" #include "vktShaderRender.hpp" +#include "subgroups/vktSubgroupsTestsUtils.hpp" #include "vkImageUtil.hpp" #include "vkQueryUtil.hpp" @@ -807,22 +808,14 @@ void TriangleDerivateCase::checkSupport (Context& context) const ? "Derivatives in dynamic control flow" : "Manual derivatives with subgroup operations"; - if (!context.contextSupports(vk::ApiVersion(0, 1, 1, 0))) - throw tcu::NotSupportedError(errorPrefix + " require Vulkan 1.1"); - - const auto& subgroupProperties = context.getSubgroupProperties(); + if (!subgroups::areQuadOperationsSupportedForStages(context, VK_SHADER_STAGE_FRAGMENT_BIT)) + throw tcu::NotSupportedError(errorPrefix + " tests require VK_SUBGROUP_FEATURE_QUAD_BIT"); - if (subgroupProperties.subgroupSize < 4) + if (subgroups::getSubgroupSize(context) < 4) throw tcu::NotSupportedError(errorPrefix + " require subgroupSize >= 4"); - if ((subgroupProperties.supportedOperations & VK_SUBGROUP_FEATURE_BALLOT_BIT) == 0) + if (!subgroups::isSubgroupFeatureSupportedForDevice(context, VK_SUBGROUP_FEATURE_BALLOT_BIT)) throw tcu::NotSupportedError(errorPrefix + " tests require VK_SUBGROUP_FEATURE_BALLOT_BIT"); - - if ((subgroupProperties.supportedStages & VK_SHADER_STAGE_FRAGMENT_BIT) == 0) - throw tcu::NotSupportedError(errorPrefix + " tests require subgroup supported stage including VK_SHADER_STAGE_FRAGMENT_BIT"); - - if (subgroupFunc && (subgroupProperties.supportedOperations & VK_SUBGROUP_FEATURE_QUAD_BIT) == 0) - throw tcu::NotSupportedError(errorPrefix + " tests require VK_SUBGROUP_FEATURE_QUAD_BIT"); } } From 2b12ec7f258ce7f2ea7732cbfad4d714fc7c6804 Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Sat, 27 Jan 2024 10:59:00 -0800 Subject: [PATCH 2/2] Add missing subgroup support checks for linear derivate tests Some of these tests require subgroup ops support, but didn't bother checking whether they were supported. Add this missing checks. --- .../vulkan/shaderrender/vktShaderRenderDerivateTests.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/external/vulkancts/modules/vulkan/shaderrender/vktShaderRenderDerivateTests.cpp b/external/vulkancts/modules/vulkan/shaderrender/vktShaderRenderDerivateTests.cpp index fb195c267f..431f0da363 100644 --- a/external/vulkancts/modules/vulkan/shaderrender/vktShaderRenderDerivateTests.cpp +++ b/external/vulkancts/modules/vulkan/shaderrender/vktShaderRenderDerivateTests.cpp @@ -1214,6 +1214,13 @@ LinearDerivateCase::~LinearDerivateCase (void) TestInstance* LinearDerivateCase::createInstance (Context& context) const { DE_ASSERT(m_uniformSetup != DE_NULL); + if (m_fragmentTmpl.find("gl_SubgroupInvocationID") != std::string::npos) { + if (!subgroups::areQuadOperationsSupportedForStages(context, VK_SHADER_STAGE_FRAGMENT_BIT)) + throw tcu::NotSupportedError("test requires VK_SUBGROUP_FEATURE_QUAD_BIT"); + + if (subgroups::getSubgroupSize(context) < 4) + throw tcu::NotSupportedError("test requires subgroupSize >= 4"); + } return new LinearDerivateCaseInstance(context, *m_uniformSetup, m_definitions, m_values); }