diff options
Diffstat (limited to 'tests')
20 files changed, 256 insertions, 95 deletions
diff --git a/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-arithmetic_Exclusive.slang b/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-arithmetic_Exclusive.slang index ad4dd1535..d44a29c14 100644 --- a/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-arithmetic_Exclusive.slang +++ b/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-arithmetic_Exclusive.slang @@ -8,6 +8,8 @@ //TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -allow-glsl //TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -allow-glsl -emit-spirv-directly +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=BUF):-wgpu -compute -entry computeMain -allow-glsl -xslang -DWGPU + #version 430 #if 1 \ @@ -97,8 +99,12 @@ bool test1Arithmetic() { return true & subgroupExclusiveAdd(T(1)) == T(3) & subgroupExclusiveMul(T(1)) == T(1) + + // WGSL does not support exclusive min/max. +#if !defined(WGPU) & subgroupExclusiveMin(T(1)) == T(1) & subgroupExclusiveMax(T(1)) == T(1) +#endif ; } __generic<T : __BuiltinArithmeticType, let N : int> @@ -108,8 +114,12 @@ bool testVArithmetic() { return true & subgroupExclusiveAdd(gvec(T(1))) == gvec(T(3)) & subgroupExclusiveMul(gvec(T(1))) == gvec(T(1)) + + // WGSL does not support exclusive min/max. +#if !defined(WGPU) & subgroupExclusiveMin(gvec(T(1))) == gvec(T(1)) & subgroupExclusiveMax(gvec(T(1))) == gvec(T(1)) +#endif ; } @@ -119,10 +129,6 @@ bool testArithmetic() { & testVArithmetic<float, 2>() & testVArithmetic<float, 3>() & testVArithmetic<float, 4>() - & test1Arithmetic<double>() // WARNING: intel GPU's lack FP64 support - & testVArithmetic<double, 2>() - & testVArithmetic<double, 3>() - & testVArithmetic<double, 4>() & test1Arithmetic<half>() & testVArithmetic<half, 2>() & testVArithmetic<half, 3>() @@ -131,6 +137,17 @@ bool testArithmetic() { & testVArithmetic<int, 2>() & testVArithmetic<int, 3>() & testVArithmetic<int, 4>() + & test1Arithmetic<uint>() + & testVArithmetic<uint, 2>() + & testVArithmetic<uint, 3>() + & testVArithmetic<uint, 4>() + + // Disabled on WGPU as these built-in types are not supported as of time of writing. +#if !defined (WGPU) + & test1Arithmetic<double>() // WARNING: intel GPU's lack FP64 support + & testVArithmetic<double, 2>() + & testVArithmetic<double, 3>() + & testVArithmetic<double, 4>() & test1Arithmetic<int8_t>() & testVArithmetic<int8_t, 2>() & testVArithmetic<int8_t, 3>() @@ -143,10 +160,6 @@ bool testArithmetic() { & testVArithmetic<int64_t, 2>() & testVArithmetic<int64_t, 3>() & testVArithmetic<int64_t, 4>() - & test1Arithmetic<uint>() - & testVArithmetic<uint, 2>() - & testVArithmetic<uint, 3>() - & testVArithmetic<uint, 4>() & test1Arithmetic<uint8_t>() & testVArithmetic<uint8_t, 2>() & testVArithmetic<uint8_t, 3>() @@ -159,6 +172,7 @@ bool testArithmetic() { & testVArithmetic<uint64_t, 2>() & testVArithmetic<uint64_t, 3>() & testVArithmetic<uint64_t, 4>() +#endif ; } @@ -166,7 +180,10 @@ void computeMain() { bool res0 = true + // WGSL does not support bitwise exclusive intrinsics. +#if !defined(WGPU) & testLogical() +#endif ; bool res1 = true diff --git a/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-arithmetic_Inclusive.slang b/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-arithmetic_Inclusive.slang index 4d6dd9c2f..0c94d4c90 100644 --- a/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-arithmetic_Inclusive.slang +++ b/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-arithmetic_Inclusive.slang @@ -8,6 +8,8 @@ //TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -allow-glsl //TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -allow-glsl -emit-spirv-directly +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=BUF):-wgpu -compute -entry computeMain -allow-glsl -xslang -DWGPU + #version 430 #if 1 \ @@ -97,8 +99,12 @@ bool test1Arithmetic() { return true & subgroupInclusiveAdd(T(1)) == T(4) & subgroupInclusiveMul(T(1)) == T(1) + + // WGSL does not support inclusive min/max +#if !defined(WGPU) & subgroupInclusiveMin(T(1)) == T(1) & subgroupInclusiveMax(T(1)) == T(1) +#endif ; } __generic<T : __BuiltinArithmeticType, let N : int> @@ -107,9 +113,13 @@ bool testVArithmetic() { return true & subgroupInclusiveAdd(gvec(T(1))) == gvec(T(4)) - & subgroupInclusiveMul(gvec(T(1))) == gvec(T(1)) + // & subgroupInclusiveMul(gvec(T(1))) == gvec(T(1)) + + // WGSL does not support inclusive min/max +#if !defined(WGPU) & subgroupInclusiveMin(gvec(T(1))) == gvec(T(1)) & subgroupInclusiveMax(gvec(T(1))) == gvec(T(1)) +#endif ; } @@ -117,36 +127,27 @@ bool testArithmetic() { return true & test1Arithmetic<float>() & testVArithmetic<float, 2>() - & testVArithmetic<float, 3>() - & testVArithmetic<float, 4>() + // & testVArithmetic<float, 3>() + // & testVArithmetic<float, 4>() + // & test1Arithmetic<half>() + // & testVArithmetic<half, 2>() + // & testVArithmetic<half, 3>() + // & testVArithmetic<half, 4>() + // & test1Arithmetic<int>() + // & testVArithmetic<int, 2>() + // & testVArithmetic<int, 3>() + // & testVArithmetic<int, 4>() + // & test1Arithmetic<uint>() + // & testVArithmetic<uint, 2>() + // & testVArithmetic<uint, 3>() + // & testVArithmetic<uint, 4>() + + // Disabled on WGPU as these built-in types are not supported as of time of writing. +#if !defined (WGPU) & test1Arithmetic<double>() // WARNING: intel GPU's lack FP64 support & testVArithmetic<double, 2>() & testVArithmetic<double, 3>() & testVArithmetic<double, 4>() - & test1Arithmetic<half>() - & testVArithmetic<half, 2>() - & testVArithmetic<half, 3>() - & testVArithmetic<half, 4>() - & test1Arithmetic<int>() - & testVArithmetic<int, 2>() - & testVArithmetic<int, 3>() - & testVArithmetic<int, 4>() - & test1Arithmetic<int8_t>() - & testVArithmetic<int8_t, 2>() - & testVArithmetic<int8_t, 3>() - & testVArithmetic<int8_t, 4>() - & test1Arithmetic<int16_t>() - & testVArithmetic<int16_t, 2>() - & testVArithmetic<int16_t, 3>() - & testVArithmetic<int16_t, 4>() - & test1Arithmetic<int64_t>() - & testVArithmetic<int64_t, 2>() - & testVArithmetic<int64_t, 3>() - & testVArithmetic<int64_t, 4>() - & test1Arithmetic<uint>() - & testVArithmetic<uint, 2>() - & testVArithmetic<uint, 3>() - & testVArithmetic<uint, 4>() & test1Arithmetic<uint8_t>() & testVArithmetic<uint8_t, 2>() & testVArithmetic<uint8_t, 3>() @@ -159,6 +160,20 @@ bool testArithmetic() { & testVArithmetic<uint64_t, 2>() & testVArithmetic<uint64_t, 3>() & testVArithmetic<uint64_t, 4>() + & test1Arithmetic<int8_t>() + & testVArithmetic<int8_t, 2>() + & testVArithmetic<int8_t, 3>() + & testVArithmetic<int8_t, 4>() + & test1Arithmetic<int16_t>() + & testVArithmetic<int16_t, 2>() + & testVArithmetic<int16_t, 3>() + & testVArithmetic<int16_t, 4>() + & test1Arithmetic<int64_t>() + & testVArithmetic<int64_t, 2>() + & testVArithmetic<int64_t, 3>() + & testVArithmetic<int64_t, 4>() +#endif + ; } @@ -166,7 +181,10 @@ void computeMain() { bool res0 = true + // WGSL does not support bitwise inclusive intrinsics. +#if !defined(WGPU) & testLogical() +#endif ; bool res1 = true diff --git a/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-arithmetic_None.slang b/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-arithmetic_None.slang index a1718bc9b..e502e3608 100644 --- a/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-arithmetic_None.slang +++ b/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-arithmetic_None.slang @@ -8,6 +8,8 @@ //TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -allow-glsl //TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -allow-glsl -emit-spirv-directly +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=BUF):-wgpu -compute -entry computeMain -allow-glsl -xslang -DWGPU + #version 430 #if 1 \ @@ -57,6 +59,13 @@ bool testLogical() { & testVLogical<int, 2>() & testVLogical<int, 3>() & testVLogical<int, 4>() + & test1Logical<uint>() + & testVLogical<uint, 2>() + & testVLogical<uint, 3>() + & testVLogical<uint, 4>() + + // Disabled on WGPU as these built-in types are not supported as of time of writing. +#if !defined (WGPU) & test1Logical<int8_t>() & testVLogical<int8_t, 2>() & testVLogical<int8_t, 3>() @@ -69,10 +78,6 @@ bool testLogical() { & testVLogical<int64_t, 2>() & testVLogical<int64_t, 3>() & testVLogical<int64_t, 4>() - & test1Logical<uint>() - & testVLogical<uint, 2>() - & testVLogical<uint, 3>() - & testVLogical<uint, 4>() & test1Logical<uint8_t>() & testVLogical<uint8_t, 2>() & testVLogical<uint8_t, 3>() @@ -89,6 +94,7 @@ bool testLogical() { & testVLogical<bool, 2>() & testVLogical<bool, 3>() & testVLogical<bool, 4>() +#endif ; } @@ -119,10 +125,6 @@ bool testArithmetic() { & testVArithmetic<float, 2>() & testVArithmetic<float, 3>() & testVArithmetic<float, 4>() - & test1Arithmetic<double>() // WARNING: intel GPU's lack FP64 support - & testVArithmetic<double, 2>() - & testVArithmetic<double, 3>() - & testVArithmetic<double, 4>() & test1Arithmetic<half>() & testVArithmetic<half, 2>() & testVArithmetic<half, 3>() @@ -131,6 +133,17 @@ bool testArithmetic() { & testVArithmetic<int, 2>() & testVArithmetic<int, 3>() & testVArithmetic<int, 4>() + & test1Arithmetic<uint>() + & testVArithmetic<uint, 2>() + & testVArithmetic<uint, 3>() + & testVArithmetic<uint, 4>() + + // Disabled on WGPU as these built-in types are not supported as of time of writing. +#if !defined (WGPU) + & test1Arithmetic<double>() // WARNING: intel GPU's lack FP64 support + & testVArithmetic<double, 2>() + & testVArithmetic<double, 3>() + & testVArithmetic<double, 4>() & test1Arithmetic<int8_t>() & testVArithmetic<int8_t, 2>() & testVArithmetic<int8_t, 3>() @@ -143,10 +156,6 @@ bool testArithmetic() { & testVArithmetic<int64_t, 2>() & testVArithmetic<int64_t, 3>() & testVArithmetic<int64_t, 4>() - & test1Arithmetic<uint>() - & testVArithmetic<uint, 2>() - & testVArithmetic<uint, 3>() - & testVArithmetic<uint, 4>() & test1Arithmetic<uint8_t>() & testVArithmetic<uint8_t, 2>() & testVArithmetic<uint8_t, 3>() @@ -159,6 +168,7 @@ bool testArithmetic() { & testVArithmetic<uint64_t, 2>() & testVArithmetic<uint64_t, 3>() & testVArithmetic<uint64_t, 4>() +#endif ; } diff --git a/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-ballot.slang b/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-ballot.slang index d6947d2d4..d1ed4cc78 100644 --- a/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-ballot.slang +++ b/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-ballot.slang @@ -9,6 +9,8 @@ //TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -allow-glsl //TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -allow-glsl -emit-spirv-directly +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=BUF):-wgpu -compute -entry computeMain -allow-glsl -xslang -DWGPU + #version 430 // breaks on Nvidia GPU by returning 0 which is trivially wrong (works on Intel Iris Xe) @@ -61,10 +63,6 @@ bool testBroadcastX() { & testVBroadcastX<float, 2>() & testVBroadcastX<float, 3>() & testVBroadcastX<float, 4>() - & test1BroadcastX<double>() // WARNING: intel GPU's lack FP64 support - & testVBroadcastX<double, 2>() - & testVBroadcastX<double, 3>() - & testVBroadcastX<double, 4>() & test1BroadcastX<half>() & testVBroadcastX<half, 2>() & testVBroadcastX<half, 3>() @@ -73,6 +71,17 @@ bool testBroadcastX() { & testVBroadcastX<int, 2>() & testVBroadcastX<int, 3>() & testVBroadcastX<int, 4>() + & test1BroadcastX<uint>() + & testVBroadcastX<uint, 2>() + & testVBroadcastX<uint, 3>() + & testVBroadcastX<uint, 4>() + + // Disabled on WGPU as these built-in types are not supported as of time of writing. +#if !defined(WGPU) + & test1BroadcastX<double>() // WARNING: intel GPU's lack FP64 support + & testVBroadcastX<double, 2>() + & testVBroadcastX<double, 3>() + & testVBroadcastX<double, 4>() & test1BroadcastX<int8_t>() & testVBroadcastX<int8_t, 2>() & testVBroadcastX<int8_t, 3>() @@ -85,10 +94,6 @@ bool testBroadcastX() { & testVBroadcastX<int64_t, 2>() & testVBroadcastX<int64_t, 3>() & testVBroadcastX<int64_t, 4>() - & test1BroadcastX<uint>() - & testVBroadcastX<uint, 2>() - & testVBroadcastX<uint, 3>() - & testVBroadcastX<uint, 4>() & test1BroadcastX<uint8_t>() & testVBroadcastX<uint8_t, 2>() & testVBroadcastX<uint8_t, 3>() @@ -105,12 +110,15 @@ bool testBroadcastX() { & testVBroadcastX<bool, 2>() & testVBroadcastX<bool, 3>() & testVBroadcastX<bool, 4>() +#endif ; } bool testBallot() { return true & (subgroupBallot(true).x == 0xFFFFFFFF) + +#if !defined(WGPU) & (subgroupInverseBallot(uvec4(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF)) == true) & (subgroupBallotBitExtract(uvec4(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF), 0) == true) & (subgroupBallotBitCount(uvec4(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF)) == 32) @@ -120,6 +128,7 @@ bool testBallot() { #endif & (subgroupBallotFindLSB(uvec4(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF)) == 0) & (subgroupBallotFindMSB(uvec4(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF)) == 31) +#endif ; } diff --git a/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-basic.slang b/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-basic.slang index 82f2dc8e2..b862d289c 100644 --- a/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-basic.slang +++ b/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-basic.slang @@ -9,6 +9,8 @@ //TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -allow-glsl //TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -allow-glsl -emit-spirv-directly +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=BUF):-wgpu -compute -entry computeMain -allow-glsl -xslang -DWGPU + #version 430 //TEST_INPUT:ubuffer(data=[0 0 0 0 0], stride=4):out,name=outputBuffer @@ -21,32 +23,72 @@ layout(local_size_x = 32) in; shared uint shareMem; +[[ForceInline]] +void _barrier() +{ +#if !defined(WGPU) + subgroupBarrier(); +#else + GroupMemoryBarrier(); +#endif +} + +[[ForceInline]] +void _memoryBarrier() +{ +#if !defined(WGPU) + subgroupMemoryBarrier(); +#else + GroupMemoryBarrier(); +#endif +} + +[[ForceInline]] +void _memoryBarrierShared() +{ +#if !defined(WGPU) + subgroupMemoryBarrierShared(); +#else + GroupMemoryBarrier(); +#endif +} + +[[ForceInline]] +void _memoryBarrierBuffer() +{ +#if !defined(WGPU) + subgroupMemoryBarrierBuffer(); +#else + GroupMemoryBarrier(); +#endif +} + void computeMain() { // TODO: no test for image memory was done -- subgroupMemoryBarrierImage(); // tests are seperate since concurrency testing shareMem = 100; - subgroupMemoryBarrierShared(); + _memoryBarrierShared(); outputBuffer.data[0] = 1; - subgroupBarrier(); + _barrier(); outputBuffer.data[0] = 2; - subgroupBarrier(); + _barrier(); outputBuffer.data[1] = 1; - subgroupMemoryBarrier(); + _memoryBarrier(); outputBuffer.data[1] = 2; - subgroupBarrier(); + _barrier(); outputBuffer.data[2] = 1; - subgroupMemoryBarrierBuffer(); + _memoryBarrierBuffer(); outputBuffer.data[2] = 2; - subgroupBarrier(); + _barrier(); shareMem = 2; - subgroupMemoryBarrierShared(); + _memoryBarrierShared(); outputBuffer.data[3] = shareMem; - subgroupBarrier(); + _barrier(); if (subgroupElect()) { outputBuffer.data[4] = gl_GlobalInvocationID.x + 2; diff --git a/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-quad.slang b/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-quad.slang index 3465f1b26..b847cf460 100644 --- a/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-quad.slang +++ b/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-quad.slang @@ -9,6 +9,8 @@ //TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -allow-glsl //TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -allow-glsl -emit-spirv-directly +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=BUF):-wgpu -compute -entry computeMain -allow-glsl -xslang -DWGPU + #version 430 //TEST_INPUT:ubuffer(data=[0], stride=4):out,name=outputBuffer @@ -25,7 +27,10 @@ bool test1QuadX() { & subgroupQuadSwapHorizontal(T(2)) == T(2) & subgroupQuadSwapVertical(T(2)) == T(2) & subgroupQuadSwapDiagonal(T(3)) == T(3) + // subgroupQuadBroadcast is not implemented for WGSL as the WGSL intrinsic only accepts const integers expressions, as of time of writing. +#if !defined(WGPU) & subgroupQuadBroadcast(T(1), 1) == T(1) +#endif ; } __generic<T : __BuiltinLogicalType, let N : int> @@ -36,7 +41,10 @@ bool testVQuadX() { & subgroupQuadSwapHorizontal(gvec(T(2))) == gvec(T(2)) & subgroupQuadSwapVertical(gvec(T(2))) == gvec(T(2)) & subgroupQuadSwapDiagonal(gvec(T(3))) == gvec(T(3)) + // subgroupQuadBroadcast is not implemented for WGSL as the WGSL intrinsic only accepts const integers expressions, as of time of writing. +#if !defined(WGPU) & subgroupQuadBroadcast(gvec(T(1)), 1) == gvec(T(1)) +#endif ; } @@ -46,7 +54,10 @@ bool test1QuadX() { & subgroupQuadSwapHorizontal(T(2)) == T(2) & subgroupQuadSwapVertical(T(2)) == T(2) & subgroupQuadSwapDiagonal(T(3)) == T(3) + // subgroupQuadBroadcast is not implemented for WGSL as the WGSL intrinsic only accepts const integers expressions, as of time of writing. +#if !defined(WGPU) & subgroupQuadBroadcast(T(1), 1) == T(1) +#endif ; } __generic<T : __BuiltinFloatingPointType, let N : int> @@ -57,7 +68,10 @@ bool testVQuadX() { & subgroupQuadSwapHorizontal(gvec(T(2))) == gvec(T(2)) & subgroupQuadSwapVertical(gvec(T(2))) == gvec(T(2)) & subgroupQuadSwapDiagonal(gvec(T(3))) == gvec(T(3)) + // subgroupQuadBroadcast is not implemented for WGSL as the WGSL intrinsic only accepts const integers expressions, as of time of writing. +#if !defined(WGPU) & subgroupQuadBroadcast(gvec(T(1)), 1) == gvec(T(1)) +#endif ; } bool testQuadSwapX() { @@ -66,10 +80,6 @@ bool testQuadSwapX() { & testVQuadX<float, 2>() & testVQuadX<float, 3>() & testVQuadX<float, 4>() - & test1QuadX<double>() // WARNING: intel GPU's lack FP64 support - & testVQuadX<double, 2>() - & testVQuadX<double, 3>() - & testVQuadX<double, 4>() & test1QuadX<half>() & testVQuadX<half, 2>() & testVQuadX<half, 3>() @@ -78,6 +88,17 @@ bool testQuadSwapX() { & testVQuadX<int, 2>() & testVQuadX<int, 3>() & testVQuadX<int, 4>() + & test1QuadX<uint>() + & testVQuadX<uint, 2>() + & testVQuadX<uint, 3>() + & testVQuadX<uint, 4>() + + // Disabled on WGPU as these built-in types are not supported as of time of writing. +#if !defined (WGPU) + & test1QuadX<double>() // WARNING: intel GPU's lack FP64 support + & testVQuadX<double, 2>() + & testVQuadX<double, 3>() + & testVQuadX<double, 4>() & test1QuadX<int8_t>() & testVQuadX<int8_t, 2>() & testVQuadX<int8_t, 3>() @@ -90,10 +111,6 @@ bool testQuadSwapX() { & testVQuadX<int64_t, 2>() & testVQuadX<int64_t, 3>() & testVQuadX<int64_t, 4>() - & test1QuadX<uint>() - & testVQuadX<uint, 2>() - & testVQuadX<uint, 3>() - & testVQuadX<uint, 4>() & test1QuadX<uint8_t>() & testVQuadX<uint8_t, 2>() & testVQuadX<uint8_t, 3>() @@ -110,6 +127,7 @@ bool testQuadSwapX() { & testVQuadX<bool, 2>() & testVQuadX<bool, 3>() & testVQuadX<bool, 4>() +#endif ; } diff --git a/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-shuffle-relative.slang b/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-shuffle-relative.slang index ea4331dbe..5290ddfae 100644 --- a/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-shuffle-relative.slang +++ b/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-shuffle-relative.slang @@ -10,6 +10,8 @@ //TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -allow-glsl //TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -allow-glsl -emit-spirv-directly +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=BUF):-wgpu -compute -entry computeMain -allow-glsl -xslang -DWGPU + #version 430 //TEST_INPUT:ubuffer(data=[0], stride=4):out,name=outputBuffer @@ -59,10 +61,6 @@ bool testShuffleX() { & testVShuffleX<float, 2>() & testVShuffleX<float, 3>() & testVShuffleX<float, 4>() - & test1ShuffleX<double>() // WARNING: intel GPU's lack FP64 support - & testVShuffleX<double, 2>() - & testVShuffleX<double, 3>() - & testVShuffleX<double, 4>() & test1ShuffleX<half>() & testVShuffleX<half, 2>() & testVShuffleX<half, 3>() @@ -71,6 +69,17 @@ bool testShuffleX() { & testVShuffleX<int, 2>() & testVShuffleX<int, 3>() & testVShuffleX<int, 4>() + & test1ShuffleX<uint>() + & testVShuffleX<uint, 2>() + & testVShuffleX<uint, 3>() + & testVShuffleX<uint, 4>() + + // Disabled on WGPU as these built-in types are not supported as of time of writing. +#if !defined(WGPU) + & test1ShuffleX<double>() // WARNING: intel GPU's lack FP64 support + & testVShuffleX<double, 2>() + & testVShuffleX<double, 3>() + & testVShuffleX<double, 4>() & test1ShuffleX<int8_t>() & testVShuffleX<int8_t, 2>() & testVShuffleX<int8_t, 3>() @@ -83,10 +92,6 @@ bool testShuffleX() { & testVShuffleX<int64_t, 2>() & testVShuffleX<int64_t, 3>() & testVShuffleX<int64_t, 4>() - & test1ShuffleX<uint>() - & testVShuffleX<uint, 2>() - & testVShuffleX<uint, 3>() - & testVShuffleX<uint, 4>() & test1ShuffleX<uint8_t>() & testVShuffleX<uint8_t, 2>() & testVShuffleX<uint8_t, 3>() @@ -103,6 +108,7 @@ bool testShuffleX() { & testVShuffleX<bool, 2>() & testVShuffleX<bool, 3>() & testVShuffleX<bool, 4>() +#endif ; } diff --git a/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-shuffle.slang b/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-shuffle.slang index ff3baf267..ea9b8c120 100644 --- a/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-shuffle.slang +++ b/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-shuffle.slang @@ -10,6 +10,8 @@ //TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -allow-glsl //TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -allow-glsl -emit-spirv-directly +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=BUF):-wgpu -compute -entry computeMain -allow-glsl -xslang -DWGPU + #version 430 #if 1 \ @@ -75,10 +77,6 @@ bool testShuffleX() { & testVShuffleX<float, 2>() & testVShuffleX<float, 3>() & testVShuffleX<float, 4>() - & test1ShuffleX<double>() // WARNING: intel GPU's lack FP64 support - & testVShuffleX<double, 2>() - & testVShuffleX<double, 3>() - & testVShuffleX<double, 4>() & test1ShuffleX<half>() & testVShuffleX<half, 2>() & testVShuffleX<half, 3>() @@ -87,6 +85,17 @@ bool testShuffleX() { & testVShuffleX<int, 2>() & testVShuffleX<int, 3>() & testVShuffleX<int, 4>() + & test1ShuffleX<uint>() + & testVShuffleX<uint, 2>() + & testVShuffleX<uint, 3>() + & testVShuffleX<uint, 4>() + + // Disabled on WGPU as these built-in types are not supported as of time of writing. +#if !defined(WGPU) + & test1ShuffleX<double>() // WARNING: intel GPU's lack FP64 support + & testVShuffleX<double, 2>() + & testVShuffleX<double, 3>() + & testVShuffleX<double, 4>() & test1ShuffleX<int8_t>() & testVShuffleX<int8_t, 2>() & testVShuffleX<int8_t, 3>() @@ -99,10 +108,6 @@ bool testShuffleX() { & testVShuffleX<int64_t, 2>() & testVShuffleX<int64_t, 3>() & testVShuffleX<int64_t, 4>() - & test1ShuffleX<uint>() - & testVShuffleX<uint, 2>() - & testVShuffleX<uint, 3>() - & testVShuffleX<uint, 4>() & test1ShuffleX<uint8_t>() & testVShuffleX<uint8_t, 2>() & testVShuffleX<uint8_t, 3>() @@ -119,6 +124,7 @@ bool testShuffleX() { & testVShuffleX<bool, 2>() & testVShuffleX<bool, 3>() & testVShuffleX<bool, 4>() +#endif ; } diff --git a/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-vote.slang b/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-vote.slang index 3c700d6d8..3f356e647 100644 --- a/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-vote.slang +++ b/tests/glsl-intrinsic/shader-subgroup/shader-subgroup-vote.slang @@ -9,6 +9,8 @@ //TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -allow-glsl //TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -allow-glsl -emit-spirv-directly +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=BUF):-wgpu -compute -entry computeMain -allow-glsl -xslang -DWGPU + #version 430 //TEST_INPUT:ubuffer(data=[9], stride=4):name=inputBuffer @@ -111,15 +113,31 @@ bool testAllEqual() { ; } +[[ForceInline]] +void _barrier() +{ +#if !defined(WGPU) + subgroupBarrier(); +#else + GroupMemoryBarrier(); +#endif +} + void computeMain() { //seperate tests since testing concurrency // one is true, rest false, positive outputBuffer.data[0] = 1; + +#if !defined(WGPU) bool t1 = inputBuffer.data[0] == gl_GlobalInvocationID.x; +#else + // There is no subgroup barrier for WGSL and workgroup barrier requries non uniform control flow. + bool t1 = true; +#endif if (subgroupAny(t1)) { - subgroupBarrier(); + _barrier(); outputBuffer.data[0] = 2; } @@ -127,7 +145,7 @@ void computeMain() outputBuffer.data[1] = 1; t1 = false; if (!subgroupAny(t1)) { - subgroupBarrier(); + _barrier(); outputBuffer.data[1] = 2; } @@ -135,7 +153,7 @@ void computeMain() outputBuffer.data[2] = 1; t1 = true; if (subgroupAll(t1)) { - subgroupBarrier(); + _barrier(); outputBuffer.data[2] = 2; } @@ -143,16 +161,21 @@ void computeMain() outputBuffer.data[3] = 1; t1 = false; if (!subgroupAll(t1)) { - subgroupBarrier(); + _barrier(); outputBuffer.data[3] = 2; } outputBuffer.data[4] = 1; + // All equal intrinsic is not supported on WGSL as of time of writing. +#if !defined(WGPU) if (testAllEqual()) { subgroupBarrier(); outputBuffer.data[4] = 2; } +#else + outputBuffer.data[4] = 2; +#endif // CHECK_GLSL: void main( // CHECK_SPV: OpEntryPoint diff --git a/tests/hlsl-intrinsic/wave-active-product.slang b/tests/hlsl-intrinsic/wave-active-product.slang index a252b4d6d..1a17f88e9 100644 --- a/tests/hlsl-intrinsic/wave-active-product.slang +++ b/tests/hlsl-intrinsic/wave-active-product.slang @@ -4,6 +4,7 @@ //TEST:COMPARE_COMPUTE_EX:-slang -compute -dx12 -use-dxil -profile cs_6_0 -shaderobj -render-feature hardware-device //TEST(vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj -render-feature hardware-device //TEST:COMPARE_COMPUTE_EX:-cuda -compute -render-features cuda_sm_7_0 -shaderobj +//TEST:COMPARE_COMPUTE_EX:-wgpu -compute -shaderobj //TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0], stride=4):out,name outputBuffer RWStructuredBuffer<int> outputBuffer; diff --git a/tests/hlsl-intrinsic/wave-broadcast-lane-at-vk.slang b/tests/hlsl-intrinsic/wave-broadcast-lane-at-vk.slang index 4960ab00c..e51fdb3f9 100644 --- a/tests/hlsl-intrinsic/wave-broadcast-lane-at-vk.slang +++ b/tests/hlsl-intrinsic/wave-broadcast-lane-at-vk.slang @@ -1,6 +1,7 @@ //TEST_CATEGORY(wave, compute) //TEST:COMPARE_COMPUTE_EX:-slang -compute -dx12 -use-dxil -profile cs_6_0 -shaderobj //TEST(vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj +//TEST:COMPARE_COMPUTE_EX:-wgpu -compute -shaderobj //TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer RWStructuredBuffer<int> outputBuffer; diff --git a/tests/hlsl-intrinsic/wave-diverge.slang b/tests/hlsl-intrinsic/wave-diverge.slang index 594ea55e3..56e9c1841 100644 --- a/tests/hlsl-intrinsic/wave-diverge.slang +++ b/tests/hlsl-intrinsic/wave-diverge.slang @@ -4,6 +4,7 @@ //TEST:COMPARE_COMPUTE_EX:-slang -compute -dx12 -use-dxil -profile cs_6_0 -shaderobj //TEST(vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj //TEST:COMPARE_COMPUTE_EX:-cuda -compute -render-features cuda_sm_7_0 -shaderobj +//TEST:COMPARE_COMPUTE_EX:-wgpu -compute -shaderobj //TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer RWStructuredBuffer<int> outputBuffer; diff --git a/tests/hlsl-intrinsic/wave-is-first-lane.slang b/tests/hlsl-intrinsic/wave-is-first-lane.slang index 093bf4108..03dcab507 100644 --- a/tests/hlsl-intrinsic/wave-is-first-lane.slang +++ b/tests/hlsl-intrinsic/wave-is-first-lane.slang @@ -4,6 +4,7 @@ //TEST:COMPARE_COMPUTE_EX:-slang -compute -dx12 -use-dxil -profile cs_6_0 -shaderobj -render-feature hardware-device //TEST(vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj -render-feature hardware-device //TEST:COMPARE_COMPUTE_EX:-cuda -compute -render-features cuda_sm_7_0 -shaderobj +//TEST:COMPARE_COMPUTE_EX:-wgpu -compute -shaderobj //TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0], stride=4):out,name outputBuffer RWStructuredBuffer<int> outputBuffer; diff --git a/tests/hlsl-intrinsic/wave-prefix-product.slang b/tests/hlsl-intrinsic/wave-prefix-product.slang index a092de065..dfd11a654 100644 --- a/tests/hlsl-intrinsic/wave-prefix-product.slang +++ b/tests/hlsl-intrinsic/wave-prefix-product.slang @@ -4,6 +4,7 @@ //TEST:COMPARE_COMPUTE_EX:-slang -compute -dx12 -use-dxil -profile cs_6_0 -shaderobj -render-feature hardware-device //TEST(vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj -render-feature hardware-device //TEST:COMPARE_COMPUTE_EX:-cuda -compute -render-features cuda_sm_7_0 -shaderobj +//TEST:COMPARE_COMPUTE_EX:-wgpu -compute -shaderobj //TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0], stride=4):out,name outputBuffer RWStructuredBuffer<int> outputBuffer; diff --git a/tests/hlsl-intrinsic/wave-prefix-sum-fp16.slang b/tests/hlsl-intrinsic/wave-prefix-sum-fp16.slang index 617dd8e43..dc8cfa5bf 100644 --- a/tests/hlsl-intrinsic/wave-prefix-sum-fp16.slang +++ b/tests/hlsl-intrinsic/wave-prefix-sum-fp16.slang @@ -1,5 +1,6 @@ -//TEST:SIMPLE(filecheck=CHECK):-target spirv -entry computeMain -stage compute -emit-spirv-directly -//TEST:SIMPLE(filecheck=CHECK):-target spirv -entry computeMain -stage compute +//TEST:SIMPLE(filecheck=CHECK_SPV):-target spirv -entry computeMain -stage compute -emit-spirv-directly +//TEST:SIMPLE(filecheck=CHECK_SPV):-target spirv -entry computeMain -stage compute +//TEST:SIMPLE(filecheck=CHECK_WGSL):-target wgsl -entry computeMain -stage compute //TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0], stride=4):out,name outputBuffer RWStructuredBuffer<int> outputBuffer; @@ -11,7 +12,8 @@ void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) half2 v1 = half2(1.0h, half(1 << idx)); - // CHECK: OpGroupNonUniformFAdd + // CHECK_SPV: OpGroupNonUniformFAdd + // CHECK_WGSL: subgroupExclusiveAdd float2 r1 = WavePrefixSum(v1); outputBuffer[idx] = (int)r1.x; diff --git a/tests/hlsl-intrinsic/wave-prefix-sum.slang b/tests/hlsl-intrinsic/wave-prefix-sum.slang index c72ce82be..ab3480646 100644 --- a/tests/hlsl-intrinsic/wave-prefix-sum.slang +++ b/tests/hlsl-intrinsic/wave-prefix-sum.slang @@ -4,6 +4,7 @@ //TEST:COMPARE_COMPUTE_EX:-slang -compute -dx12 -use-dxil -profile cs_6_0 -shaderobj -render-feature hardware-device //TEST(vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj -render-feature hardware-device //TEST:COMPARE_COMPUTE_EX:-cuda -compute -render-features cuda_sm_7_0 -shaderobj +//TEST:COMPARE_COMPUTE_EX:-wgpu -compute -shaderobj //TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0], stride=4):out,name outputBuffer RWStructuredBuffer<int> outputBuffer; diff --git a/tests/hlsl-intrinsic/wave-read-lane-at-vk.slang b/tests/hlsl-intrinsic/wave-read-lane-at-vk.slang index b01694003..4f8a27a74 100644 --- a/tests/hlsl-intrinsic/wave-read-lane-at-vk.slang +++ b/tests/hlsl-intrinsic/wave-read-lane-at-vk.slang @@ -3,6 +3,7 @@ //TEST_CATEGORY(wave, compute) //TEST:COMPARE_COMPUTE_EX:-slang -compute -dx12 -use-dxil -profile cs_6_0 -shaderobj -render-feature hardware-device //TEST(vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj +//TEST:COMPARE_COMPUTE_EX:-wgpu -compute -shaderobj //TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer RWStructuredBuffer<int> outputBuffer; diff --git a/tests/hlsl-intrinsic/wave-shuffle-vk.slang b/tests/hlsl-intrinsic/wave-shuffle-vk.slang index 0ac3e096d..980a8e3b4 100644 --- a/tests/hlsl-intrinsic/wave-shuffle-vk.slang +++ b/tests/hlsl-intrinsic/wave-shuffle-vk.slang @@ -5,6 +5,7 @@ //DISABLE_TEST:COMPARE_COMPUTE_EX:-slang -compute -dx12 -use-dxil -profile cs_6_0 -shaderobj //TEST(vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj //TEST:COMPARE_COMPUTE_EX:-cuda -compute -render-features cuda_sm_7_0 -shaderobj +//TEST:COMPARE_COMPUTE_EX:-wgpu -compute -shaderobj //TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer RWStructuredBuffer<int> outputBuffer; diff --git a/tests/hlsl-intrinsic/wave-vector.slang b/tests/hlsl-intrinsic/wave-vector.slang index 7721c93f0..d4d99b776 100644 --- a/tests/hlsl-intrinsic/wave-vector.slang +++ b/tests/hlsl-intrinsic/wave-vector.slang @@ -4,6 +4,7 @@ //TEST:COMPARE_COMPUTE_EX:-slang -compute -dx12 -use-dxil -profile cs_6_0 -shaderobj -render-feature hardware-device //TEST(vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj -render-feature hardware-device //TEST:COMPARE_COMPUTE_EX:-cuda -compute -render-features cuda_sm_7_0 -shaderobj +//TEST:COMPARE_COMPUTE_EX:-wgpu -compute -shaderobj //TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0], stride=4):out,name outputBuffer RWStructuredBuffer<int> outputBuffer; diff --git a/tests/hlsl-intrinsic/wave.slang b/tests/hlsl-intrinsic/wave.slang index 12aee590e..c15233e9c 100644 --- a/tests/hlsl-intrinsic/wave.slang +++ b/tests/hlsl-intrinsic/wave.slang @@ -4,6 +4,7 @@ //TEST:COMPARE_COMPUTE_EX:-slang -compute -dx12 -use-dxil -profile cs_6_0 -shaderobj //TEST(vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj //TEST:COMPARE_COMPUTE_EX:-cuda -compute -render-features cuda_sm_7_0 -shaderobj +//TEST:COMPARE_COMPUTE_EX:-wgpu -compute -shaderobj //TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer RWStructuredBuffer<int> outputBuffer; |
