Added test to stress semaphore chains
authorJari Komppa <jari.komppa@siru.fi>
Thu, 30 Nov 2017 09:15:54 +0000 (11:15 +0200)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Tue, 19 Dec 2017 14:40:52 +0000 (09:40 -0500)
Added a test that creates a chain of 32k semaphores.

Affects:

dEQP-VK.synchronization.basic.semaphore.chain

Components: Vulkan

Vk-GL-CTS issue: 822

Change-Id: I69322e30d4087081b84bf55903e4ccaaf3fe5193

android/cts/master/vk-master.txt
external/vulkancts/modules/vulkan/synchronization/vktSynchronizationBasicSemaphoreTests.cpp
external/vulkancts/mustpass/1.0.3/vk-default.txt

index c5aec39..aa9eb97 100644 (file)
@@ -229898,6 +229898,7 @@ dEQP-VK.synchronization.basic.fence.multi
 dEQP-VK.synchronization.basic.fence.empty_submit
 dEQP-VK.synchronization.basic.semaphore.one_queue
 dEQP-VK.synchronization.basic.semaphore.multi_queue
+dEQP-VK.synchronization.basic.semaphore.chain
 dEQP-VK.synchronization.basic.event.host_set_reset
 dEQP-VK.synchronization.basic.event.device_set_reset
 dEQP-VK.synchronization.basic.event.host_set_device_wait
index a58b320..fd02e31 100644 (file)
@@ -97,6 +97,58 @@ tcu::TestStatus basicOneQueueCase (Context& context)
        return tcu::TestStatus::pass("Basic semaphore tests with one queue passed");
 }
 
+tcu::TestStatus basicChainCase (Context& context)
+{
+       VkResult                                        err                     = VK_SUCCESS;
+       const DeviceInterface&          vk                      = context.getDeviceInterface();
+       const VkDevice&                         device          = context.getDevice();
+       const VkQueue                           queue           = context.getUniversalQueue();
+       const int                                       chainLength = 32768;
+       VkPipelineStageFlags            flags           = VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT;
+       VkSemaphoreCreateInfo           sci                     = { VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO, DE_NULL, 0 };
+       VkFenceCreateInfo                       fci                     = { VK_STRUCTURE_TYPE_FENCE_CREATE_INFO, DE_NULL, 0 };
+       std::vector<VkSemaphore>        semaphores;
+       VkFence                                         fence;
+
+       for (int i = 0; err == VK_SUCCESS && i < chainLength; i++)
+       {
+               VkSemaphore                             semaphore;
+               err = vk.createSemaphore(device, &sci, DE_NULL, &semaphore);
+               if (err == VK_SUCCESS)
+               {
+                       semaphores.push_back(semaphore);
+
+                       VkSubmitInfo si = { VK_STRUCTURE_TYPE_SUBMIT_INFO,
+                               DE_NULL,
+                               semaphores.size() > 1 ? 1u : 0u,
+                               semaphores.size() > 1 ? &semaphores[semaphores.size() - 2] : DE_NULL,
+                               &flags,
+                               0,
+                               DE_NULL,
+                               1,
+                               &semaphores[semaphores.size() - 1] };
+                       err = vk.queueSubmit(queue, 1, &si, 0);
+               }
+       }
+
+       VK_CHECK(vk.createFence(device, &fci, DE_NULL, &fence));
+
+       VkSubmitInfo si = { VK_STRUCTURE_TYPE_SUBMIT_INFO, DE_NULL, 1, &semaphores.back(), &flags, 0, DE_NULL, 0, DE_NULL };
+       VK_CHECK(vk.queueSubmit(queue, 1, &si, fence));
+
+       vk.waitForFences(device, 1, &fence, VK_TRUE, UINT64_MAX);
+
+       vk.destroyFence(device, fence, DE_NULL);
+
+       for (unsigned int i = 0; i < semaphores.size(); i++)
+               vk.destroySemaphore(device, semaphores[i], DE_NULL);
+
+       if (err == VK_SUCCESS)
+               return tcu::TestStatus::pass("Basic semaphore chain test passed");
+
+       return tcu::TestStatus::fail("Basic semaphore chain test failed");
+}
+
 tcu::TestStatus basicMultiQueueCase (Context& context)
 {
        enum {NO_MATCH_FOUND = ~((deUint32)0)};
@@ -268,6 +320,7 @@ tcu::TestCaseGroup* createBasicSemaphoreTests (tcu::TestContext& testCtx)
        de::MovePtr<tcu::TestCaseGroup> basicTests(new tcu::TestCaseGroup(testCtx, "semaphore", "Basic semaphore tests"));
        addFunctionCase(basicTests.get(), "one_queue",   "Basic semaphore tests with one queue",   basicOneQueueCase);
        addFunctionCase(basicTests.get(), "multi_queue", "Basic semaphore tests with multi queue", basicMultiQueueCase);
+       addFunctionCase(basicTests.get(), "chain", "Semaphore chain test", basicChainCase);
 
        return basicTests.release();
 }
index 467efe6..d99eca0 100644 (file)
@@ -230178,6 +230178,7 @@ dEQP-VK.synchronization.basic.fence.multi
 dEQP-VK.synchronization.basic.fence.empty_submit
 dEQP-VK.synchronization.basic.semaphore.one_queue
 dEQP-VK.synchronization.basic.semaphore.multi_queue
+dEQP-VK.synchronization.basic.semaphore.chain
 dEQP-VK.synchronization.basic.event.host_set_reset
 dEQP-VK.synchronization.basic.event.device_set_reset
 dEQP-VK.synchronization.basic.event.host_set_device_wait