Limit dimensionality of arrays-of-arrays in random SSBO tests
authorBoris Zanin <boris.zanin@mobica.com>
Wed, 13 Apr 2022 11:57:22 +0000 (13:57 +0200)
committerMatthew Netsch <quic_mnetsch@quicinc.com>
Thu, 5 May 2022 15:49:57 +0000 (15:49 +0000)
One of these tests used a 5 dimensional array-of-arrays, resulting
in thousands of instructions that caused issues on devices with low
ram. This change limits the total dimensionality to prevent this.

Components: Vulkan

VK-GL-CTS issue: 1829

Solves:
dEQP-VK.ssbo.layout.random.scalar.75

Affects:
dEQP-VK.ssbo.*.random.*

Change-Id: Ibee39ccb0bd1543dafce7c498f56def1e05b4815

external/vulkancts/modules/vulkan/ssbo/vktSSBOLayoutTests.cpp
external/vulkancts/mustpass/master/src/excluded-tests.txt
external/vulkancts/mustpass/master/vk-default.txt

index edbe433..7e877c2 100644 (file)
@@ -92,12 +92,13 @@ public:
 private:
        void                                    generateBlock                           (de::Random& rnd, deUint32 layoutFlags);
        void                                    generateBufferVar                       (de::Random& rnd, BufferBlock& block, bool isLastMember);
-       glu::VarType                    generateType                            (de::Random& rnd, int typeDepth, bool arrayOk, bool unusedArrayOk);
+       glu::VarType                    generateType                            (de::Random& rnd, int structDepth, int arrayDepth, bool arrayOk, bool unusedArrayOk);
 
        deUint32                                m_features;
        int                                             m_maxBlocks;
        int                                             m_maxInstances;
        int                                             m_maxArrayLength;
+       int                                             m_maxArrayDepth;
        int                                             m_maxStructDepth;
        int                                             m_maxBlockMembers;
        int                                             m_maxStructMembers;
@@ -114,6 +115,7 @@ RandomSSBOLayoutCase::RandomSSBOLayoutCase (tcu::TestContext& testCtx, const cha
        , m_maxBlocks                   ((features & FEATURE_DESCRIPTOR_INDEXING)       ? 1 : 4)
        , m_maxInstances                ((features & FEATURE_INSTANCE_ARRAYS)           ? 3 : 0)
        , m_maxArrayLength              ((features & FEATURE_ARRAYS)                            ? 8 : 1)
+       , m_maxArrayDepth               ((features& FEATURE_ARRAYS_OF_ARRAYS)           ? 2 : 0)
        , m_maxStructDepth              ((features & FEATURE_STRUCTS)                           ? 2 : 0)
        , m_maxBlockMembers             (5)
        , m_maxStructMembers    (4)
@@ -231,7 +233,7 @@ void RandomSSBOLayoutCase::generateBufferVar (de::Random& rnd, BufferBlock& bloc
        const float                     accessWeight            = 0.85f;
        const bool                      unusedOk                        = (m_features & FEATURE_UNUSED_VARS) != 0;
        const std::string       name                            = genName('a', 'z', m_bufferVarNdx);
-       const glu::VarType      type                            = generateType(rnd, 0, true, isLastMember && (m_features & FEATURE_UNSIZED_ARRAYS));
+       const glu::VarType      type                            = generateType(rnd, 0, 0, true, isLastMember && (m_features & FEATURE_UNSIZED_ARRAYS));
        const bool                      access                          = !unusedOk || (rnd.getFloat() < accessWeight);
        const bool                      read                            = access ? (rnd.getFloat() < readWeight) : false;
        const bool                      write                           = access ? (!read || (rnd.getFloat() < writeWeight)) : false;
@@ -242,7 +244,7 @@ void RandomSSBOLayoutCase::generateBufferVar (de::Random& rnd, BufferBlock& bloc
        m_bufferVarNdx += 1;
 }
 
-glu::VarType RandomSSBOLayoutCase::generateType (de::Random& rnd, int typeDepth, bool arrayOk, bool unsizedArrayOk)
+glu::VarType RandomSSBOLayoutCase::generateType (de::Random& rnd, int structDepth, int arrayDepth, bool arrayOk, bool unsizedArrayOk)
 {
        const float structWeight                = 0.1f;
        const float arrayWeight                 = 0.1f;
@@ -252,18 +254,19 @@ glu::VarType RandomSSBOLayoutCase::generateType (de::Random& rnd, int typeDepth,
 
        if (unsizedArrayOk && (rnd.getFloat() < unsizedArrayWeight))
        {
-               const bool                      childArrayOk    = (m_features & FEATURE_ARRAYS_OF_ARRAYS) != 0;
-               const glu::VarType      elementType             = generateType(rnd, typeDepth, childArrayOk, false);
+               const bool                      childArrayOk    = ((m_features & FEATURE_ARRAYS_OF_ARRAYS) != 0) &&
+                                                                                         (arrayDepth < m_maxArrayDepth);
+               const glu::VarType      elementType             = generateType(rnd, structDepth, arrayDepth + 1, childArrayOk, false);
                return glu::VarType(elementType, glu::VarType::UNSIZED_ARRAY);
        }
-       else if (typeDepth < m_maxStructDepth && rnd.getFloat() < structWeight)
+       else if (structDepth < m_maxStructDepth && rnd.getFloat() < structWeight)
        {
                vector<glu::VarType>    memberTypes;
                int                                             numMembers = rnd.getInt(1, m_maxStructMembers);
 
                // Generate members first so nested struct declarations are in correct order.
                for (int ndx = 0; ndx < numMembers; ndx++)
-                       memberTypes.push_back(generateType(rnd, typeDepth+1, true, false));
+                       memberTypes.push_back(generateType(rnd, structDepth + 1, arrayDepth, (arrayDepth < m_maxArrayDepth), false));
 
                glu::StructType& structType = m_interface.allocStruct((string("s") + genName('A', 'Z', m_structNdx)).c_str());
                m_structNdx += 1;
@@ -279,8 +282,9 @@ glu::VarType RandomSSBOLayoutCase::generateType (de::Random& rnd, int typeDepth,
        else if (m_maxArrayLength > 0 && arrayOk && rnd.getFloat() < arrayWeight)
        {
                const int                       arrayLength             = rnd.getInt(1, m_maxArrayLength);
-               const bool                      childArrayOk    = (m_features & FEATURE_ARRAYS_OF_ARRAYS) != 0;
-               const glu::VarType      elementType             = generateType(rnd, typeDepth, childArrayOk, false);
+               const bool                      childArrayOk    = ((m_features & FEATURE_ARRAYS_OF_ARRAYS) != 0) &&
+                                                                                         (arrayDepth < m_maxArrayDepth);
+               const glu::VarType      elementType             = generateType(rnd, structDepth, arrayDepth + 1, childArrayOk, false);
 
                return glu::VarType(elementType, arrayLength);
        }
index 9cd19ca..22e5374 100644 (file)
@@ -2,10 +2,7 @@
 dEQP-VK.glsl.texture_functions.texturegrad.sparse_samplercubeshadow_fragment
 dEQP-VK.glsl.texture_functions.texturegrad.sparse_samplercubeshadow_vertex
 
-# VK-GL-CTS 1829
-# Test shader length is excessive, excluding until such time as the test case can be re-visited.
-dEQP-VK.ssbo.layout.random.scalar.75
-
 # VK-GL-CTS 3005
 dEQP-VK.ray_tracing_pipeline.build.cpuht*1048576_1_1
-dEQP-VK.ray_tracing_pipeline.build.cpuht*65536_4_4
\ No newline at end of file
+dEQP-VK.ray_tracing_pipeline.build.cpuht*65536_4_4
+
index de7f56e..3dc837f 100644 (file)
@@ -506879,6 +506879,7 @@ dEQP-VK.ssbo.layout.random.scalar.71
 dEQP-VK.ssbo.layout.random.scalar.72
 dEQP-VK.ssbo.layout.random.scalar.73
 dEQP-VK.ssbo.layout.random.scalar.74
+dEQP-VK.ssbo.layout.random.scalar.75
 dEQP-VK.ssbo.layout.random.scalar.76
 dEQP-VK.ssbo.layout.random.scalar.77
 dEQP-VK.ssbo.layout.random.scalar.78