Speed up hierarchy traversal, part 1
authorJari Komppa <jari.komppa@siru.fi>
Tue, 18 Jun 2019 12:15:09 +0000 (15:15 +0300)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Wed, 3 Jul 2019 12:15:03 +0000 (08:15 -0400)
Some of the tests do premature heavy work during test hierarchy
traversal, meaning that they waste time regardless of whether the tests
are run or not. These changes move some of that heavy work to later
stage of the test run.

Affects:

dEQP-VK.ubo.*
dEQP-VK.ssbo.*

Components: Vulkan, Framework

VK-GL-CTS issue: 1830

Change-Id: I437e55ee2d57efc69edf62a213f7476a22b1a2f0

external/vulkancts/modules/vulkan/ssbo/vktSSBOLayoutCase.cpp
external/vulkancts/modules/vulkan/ssbo/vktSSBOLayoutCase.hpp
external/vulkancts/modules/vulkan/ubo/vktUniformBlockCase.cpp
external/vulkancts/modules/vulkan/ubo/vktUniformBlockCase.hpp
external/vulkancts/modules/vulkan/ubo/vktUniformBlockTests.cpp
external/vulkancts/modules/vulkan/vktBuildPrograms.cpp
external/vulkancts/modules/vulkan/vktTestCase.cpp
external/vulkancts/modules/vulkan/vktTestCase.hpp
external/vulkancts/modules/vulkan/vktTestPackage.cpp

index b060618..b0f9ecc 100644 (file)
@@ -2550,14 +2550,14 @@ TestInstance* SSBOLayoutCase::createInstance (Context& context) const
        return new SSBOLayoutCaseInstance(context, m_bufferMode, m_interface, m_refLayout, m_initialData, m_writeData, m_usePhysStorageBuffer);
 }
 
-void SSBOLayoutCase::init ()
-{
-       computeReferenceLayout  (m_refLayout, m_interface);
-       initRefDataStorage              (m_interface, m_refLayout, m_initialData);
-       initRefDataStorage              (m_interface, m_refLayout, m_writeData);
-       generateValues                  (m_refLayout, m_initialData.pointers, deStringHash(getName()) ^ 0xad2f7214);
-       generateValues                  (m_refLayout, m_writeData.pointers, deStringHash(getName()) ^ 0x25ca4e7);
-       copyNonWrittenData              (m_interface, m_refLayout, m_initialData.pointers, m_writeData.pointers);
+void SSBOLayoutCase::delayedInit (void)
+{
+       computeReferenceLayout(m_refLayout, m_interface);
+       initRefDataStorage(m_interface, m_refLayout, m_initialData);
+       initRefDataStorage(m_interface, m_refLayout, m_writeData);
+       generateValues(m_refLayout, m_initialData.pointers, deStringHash(getName()) ^ 0xad2f7214);
+       generateValues(m_refLayout, m_writeData.pointers, deStringHash(getName()) ^ 0x25ca4e7);
+       copyNonWrittenData(m_interface, m_refLayout, m_initialData.pointers, m_writeData.pointers);
 
        m_computeShaderSrc = generateComputeShader(m_interface, m_refLayout, m_initialData.pointers, m_writeData.pointers, m_matrixLoadFlag, m_usePhysStorageBuffer);
 }
index 31f7b51..20b28ba 100644 (file)
@@ -234,12 +234,11 @@ public:
                                                                SSBOLayoutCase                          (tcu::TestContext& testCtx, const char* name, const char* description, BufferMode bufferMode, MatrixLoadFlags matrixLoadFlag, bool usePhysStorageBuffer);
        virtual                                         ~SSBOLayoutCase                         (void);
 
+       virtual void                            delayedInit                                     (void);
        virtual void                            initPrograms                            (vk::SourceCollections& programCollection) const;
        virtual TestInstance*           createInstance                          (Context& context) const;
 
 protected:
-       void                                            init                                            (void);
-
        BufferMode                                      m_bufferMode;
        ShaderInterface                         m_interface;
        MatrixLoadFlags                         m_matrixLoadFlag;
index 1a01c19..7c3c117 100644 (file)
@@ -2226,7 +2226,7 @@ TestInstance* UniformBlockCase::createInstance (Context& context) const
        return new UniformBlockCaseInstance(context, m_bufferMode, m_uniformLayout, m_blockPointers);
 }
 
-void UniformBlockCase::init (void)
+void UniformBlockCase::delayedInit (void)
 {
        const int vec4Alignment = (int)sizeof(deUint32)*4;
 
index 89403e8..4685bdc 100644 (file)
@@ -323,13 +323,12 @@ public:
                                                                                                                         bool                           shuffleUniformMembers = false);
                                                                ~UniformBlockCase                       (void);
 
+       virtual void                            delayedInit                                     (void);
        virtual void                            initPrograms                            (vk::SourceCollections& programCollection) const;
        virtual TestInstance*           createInstance                          (Context& context) const;
        bool                                            usesBlockLayout                         (UniformFlags layoutFlag) const { return m_interface.usesBlockLayout(layoutFlag); }
 
 protected:
-       void                                            init                                            (void);
-
        BufferMode                                      m_bufferMode;
        ShaderInterface                         m_interface;
        MatrixLoadFlags                         m_matrixLoadFlag;
index 0de184c..2d2d7a3 100644 (file)
@@ -77,8 +77,6 @@ public:
                        block.setArraySize(numInstances);
                        block.setInstanceName("block");
                }
-
-               init();
        }
 };
 
@@ -116,8 +114,6 @@ public:
                        block.setInstanceName("block");
                        block.setArraySize(numInstances);
                }
-
-               init();
        }
 };
 
@@ -143,8 +139,6 @@ public:
                        block.setInstanceName("block");
                        block.setArraySize(numInstances);
                }
-
-               init();
        }
 };
 
@@ -175,8 +169,6 @@ public:
                        block.setInstanceName("block");
                        block.setArraySize(numInstances);
                }
-
-               init();
        }
 };
 
@@ -207,8 +199,6 @@ public:
                        block.setInstanceName("block");
                        block.setArraySize(numInstances);
                }
-
-               init();
        }
 };
 
@@ -238,8 +228,6 @@ public:
                        blockA.setArraySize(numInstances);
                        blockB.setArraySize(numInstances);
                }
-
-               init();
        }
 };
 
@@ -279,8 +267,6 @@ public:
                        blockA.setArraySize(numInstances);
                        blockB.setArraySize(numInstances);
                }
-
-               init();
        }
 };
 
@@ -308,8 +294,6 @@ public:
                        block.setInstanceName("block");
                        block.setArraySize(m_numInstances);
                }
-
-               init();
        }
 
 private:
@@ -343,8 +327,6 @@ public:
                        blockB.setInstanceName("testBlock");
                        blockB.setArraySize(numInstances);
                }
-
-               init();
        }
 };
 
index 2138f39..db95b77 100644 (file)
@@ -423,7 +423,7 @@ BuildStats buildPrograms (tcu::TestContext&                 testCtx,
                                if (iterator.getState() == tcu::TestHierarchyIterator::STATE_ENTER_NODE &&
                                        tcu::isTestNodeTypeExecutable(iterator.getNode()->getNodeType()))
                                {
-                                       const TestCase* const           testCase                                        = dynamic_cast<TestCase*>(iterator.getNode());
+                                       TestCase* const                         testCase                                        = dynamic_cast<TestCase*>(iterator.getNode());
                                        const string                            casePath                                        = iterator.getNodePath();
                                        vk::ShaderBuildOptions          defaultGlslBuildOptions         (usedVulkanVersion, baselineSpirvVersion, 0u);
                                        vk::ShaderBuildOptions          defaultHlslBuildOptions         (usedVulkanVersion, baselineSpirvVersion, 0u);
@@ -432,6 +432,7 @@ BuildStats buildPrograms (tcu::TestContext&                 testCtx,
 
                                        try
                                        {
+                                               testCase->delayedInit();
                                                testCase->initPrograms(sourcePrograms);
                                        }
                                        catch (const tcu::NotSupportedError& )
index 8a1f5c1..b28c697 100644 (file)
@@ -579,4 +579,8 @@ void TestCase::checkSupport (Context&) const
 {
 }
 
+void TestCase::delayedInit (void)
+{
+}
+
 } // vkt
index c4d8783..de0f153 100644 (file)
@@ -119,6 +119,7 @@ public:
                                                        TestCase                (tcu::TestContext& testCtx, tcu::TestNodeType type, const std::string& name, const std::string& description);
        virtual                                 ~TestCase               (void) {}
 
+       virtual void                    delayedInit             (void); // non-const init called after checkSupport but before initPrograms
        virtual void                    initPrograms    (vk::SourceCollections& programCollection) const;
        virtual TestInstance*   createInstance  (Context& context) const = 0;
        virtual void                    checkSupport    (Context& context) const;
index f0184f4..499df26 100644 (file)
@@ -236,7 +236,7 @@ TestCaseExecutor::~TestCaseExecutor (void)
 
 void TestCaseExecutor::init (tcu::TestCase* testCase, const std::string& casePath)
 {
-       const TestCase*                         vktCase                                         = dynamic_cast<TestCase*>(testCase);
+       TestCase*                                       vktCase                                         = dynamic_cast<TestCase*>(testCase);
        tcu::TestLog&                           log                                                     = m_context.getTestContext().getLog();
        const deUint32                          usedVulkanVersion                       = m_context.getUsedApiVersion();
        const vk::SpirvVersion          baselineSpirvVersion            = vk::getBaselineSpirvVersion(usedVulkanVersion);
@@ -254,6 +254,8 @@ void TestCaseExecutor::init (tcu::TestCase* testCase, const std::string& casePat
 
        vktCase->checkSupport(m_context);
 
+       vktCase->delayedInit();
+
        m_progCollection.clear();
        vktCase->initPrograms(sourceProgs);