Fix 64bit type promotions in subgroup tests
authorPiotr Byszewski <piotr.byszewski@mobica.com>
Fri, 27 Sep 2019 14:00:31 +0000 (16:00 +0200)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Thu, 3 Oct 2019 15:32:17 +0000 (11:32 -0400)
VK-GL-CTS issue: 1948
Components: Vulkan

Affects:
dEQP-VK.subgroups.*.ext_shader_subgroup_ballot.*

Change-Id: I7b8a1a8979bb16f1f4f4fcfd8579c764aa3820f0
(cherry picked from commit 57e251b094d00ad5332e1500af9cbfb490dcbe90)

external/vulkancts/modules/vulkan/subgroups/vktSubgroupsBallotBroadcastTests.cpp
external/vulkancts/modules/vulkan/subgroups/vktSubgroupsBallotTests.cpp
external/vulkancts/modules/vulkan/subgroups/vktSubgroupsTestsUtils.cpp

index 226d8e2..bd52cec 100755 (executable)
@@ -192,7 +192,7 @@ std::string getHelperFunctionARB(CaseDefinition caseDef)
        bdy << "{\n";
        bdy << "    if (index > 63)\n";
        bdy << "        return false;\n";
-       bdy << "    uint64_t mask = uint64_t(1 << index);\n";
+       bdy << "    uint64_t mask = 1ul << index;\n";
        bdy << "    if (bool((value & mask)) == true)\n";
        bdy << "        return true;\n";
        bdy << "    return false;\n";
index b4193e5..822428d 100755 (executable)
@@ -721,7 +721,12 @@ void initFrameBufferPrograms(SourceCollections& programCollection, CaseDefinitio
 
 void initPrograms(SourceCollections& programCollection, CaseDefinition caseDef)
 {
-       const string extensionHeader =  (caseDef.extShaderSubGroupBallotTests ? "#extension GL_ARB_shader_ballot: enable\n#extension GL_KHR_shader_subgroup_basic: enable\n" : "#extension GL_KHR_shader_subgroup_ballot: enable\n");
+       const string extensionHeader =  (caseDef.extShaderSubGroupBallotTests ?
+               "#extension GL_ARB_shader_ballot: enable\n"
+               "#extension GL_ARB_gpu_shader_int64: enable\n"
+               "#extension GL_KHR_shader_subgroup_basic: enable\n"
+               :
+               "#extension GL_KHR_shader_subgroup_ballot: enable\n");
 
        if (VK_SHADER_STAGE_COMPUTE_BIT == caseDef.shaderStage)
        {
@@ -751,7 +756,7 @@ void initPrograms(SourceCollections& programCollection, CaseDefinition caseDef)
                        << "  tempResult |= sharedMemoryBallot(true) == " << (caseDef.extShaderSubGroupBallotTests ? "ballotARB" : "subgroupBallot") << "(true) ? 0x1 : 0;\n"
                        << "  bool bData = data[gl_SubgroupInvocationID] != 0;\n"
                        << "  tempResult |= sharedMemoryBallot(bData) == " << (caseDef.extShaderSubGroupBallotTests ? "ballotARB" : "subgroupBallot") << "(bData) ? 0x2 : 0;\n"
-                       << "  tempResult |= " << (caseDef.extShaderSubGroupBallotTests ? "uint(0) == ballotARB" : "uvec4(0) == subgroupBallot") << "(false) ? 0x4 : 0;\n"
+                       << "  tempResult |= " << (caseDef.extShaderSubGroupBallotTests ? "uint64_t(0) == ballotARB" : "uvec4(0) == subgroupBallot") << "(false) ? 0x4 : 0;\n"
                        << "  result[offset] = tempResult;\n"
                        << "}\n";
 
@@ -760,7 +765,7 @@ void initPrograms(SourceCollections& programCollection, CaseDefinition caseDef)
        }
        else
        {
-               const string cmpStr = (caseDef.extShaderSubGroupBallotTests ? "uint(0) == ballotARB" : "uvec4(0) == subgroupBallot");
+               const string cmpStr = (caseDef.extShaderSubGroupBallotTests ? "uint64_t(0) == ballotARB" : "uvec4(0) == subgroupBallot");
                const string testSrc =
                        "  uint tempResult = 0;\n"
                        "  tempResult |= !bool(" + cmpStr + "(true)) ? 0x1 : 0;\n"
index 1a40e13..0a9cfc1 100644 (file)
@@ -582,7 +582,7 @@ std::string vkt::subgroups::getSharedMemoryBallotHelper()
 std::string vkt::subgroups::getSharedMemoryBallotHelperARB()
 {
        return  "shared uvec4 superSecretComputeShaderHelper[gl_WorkGroupSize.x * gl_WorkGroupSize.y * gl_WorkGroupSize.z];\n"
-                       "uint sharedMemoryBallot(bool vote)\n"
+                       "uint64_t sharedMemoryBallot(bool vote)\n"
                        "{\n"
                        "  uint groupOffset = gl_SubgroupID;\n"
                        "  // One invocation in the group 0's the whole group's data\n"
@@ -604,7 +604,7 @@ std::string vkt::subgroups::getSharedMemoryBallotHelperARB()
                        "    }\n"
                        "  }\n"
                        "  subgroupMemoryBarrierShared();\n"
-                       "  return superSecretComputeShaderHelper[groupOffset].x;\n"
+                       "  return packUint2x32(superSecretComputeShaderHelper[groupOffset].xy);\n"
                        "}\n";
 }