diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2020-03-27 18:35:06 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-03-27 22:35:06 +0000 |
| commit | 6f43b2698a99cc4f4bb4e905749fb87f24bf391b (patch) | |
| tree | 567927f4e36ee42481c200ca4caa8a7ea47e3150 /tests | |
| parent | e267ce24e37b9b7f98921f75abc150c1463b1d6d (diff) | |
WaveBroadcastAt/WaveShuffle (#1299)
* Support for WaveReadLaneAt with dynamic (but uniform across Wave) on Vk by enabling VK1.4.
Fixed wave-lane-at.slang test to test with laneId that is uniform across the Wave.
* Added WaveShuffle intrinsic.
Test for WaveShuffle intrinsic.
* Added some documentation on WaveShuffle
* Fix that version required for subgroupBroadcast to be non constexpr is actually 1.5
* Added WaveBroadcastLaneAt
Documented WaveShuffle/BroadcastLaneAt/ReadLaneAt
* Update docs around WaveBroadcast/Read/Shuffle.
Use '_waveShuffle` as name in CUDA prelude to better describe it's more flexible behavior.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/hlsl-intrinsic/wave-broadcast-lane-at-vk.slang | 28 | ||||
| -rw-r--r-- | tests/hlsl-intrinsic/wave-broadcast-lane-at-vk.slang.expected.txt | 4 | ||||
| -rw-r--r-- | tests/hlsl-intrinsic/wave-broadcast-lane-at.slang | 41 | ||||
| -rw-r--r-- | tests/hlsl-intrinsic/wave-broadcast-lane-at.slang.expected.txt | 4 | ||||
| -rw-r--r-- | tests/hlsl-intrinsic/wave-read-lane-at-vk.slang (renamed from tests/hlsl-intrinsic/wave-lane-at-vk.slang) | 3 | ||||
| -rw-r--r-- | tests/hlsl-intrinsic/wave-read-lane-at-vk.slang.expected.txt (renamed from tests/hlsl-intrinsic/wave-lane-at-vk.slang.expected.txt) | 0 | ||||
| -rw-r--r-- | tests/hlsl-intrinsic/wave-read-lane-at.slang (renamed from tests/hlsl-intrinsic/wave-lane-at.slang) | 0 | ||||
| -rw-r--r-- | tests/hlsl-intrinsic/wave-read-lane-at.slang.expected.txt (renamed from tests/hlsl-intrinsic/wave-lane-at.slang.expected.txt) | 0 | ||||
| -rw-r--r-- | tests/hlsl-intrinsic/wave-shuffle-vk.slang | 1 |
9 files changed, 78 insertions, 3 deletions
diff --git a/tests/hlsl-intrinsic/wave-broadcast-lane-at-vk.slang b/tests/hlsl-intrinsic/wave-broadcast-lane-at-vk.slang new file mode 100644 index 000000000..3c746476a --- /dev/null +++ b/tests/hlsl-intrinsic/wave-broadcast-lane-at-vk.slang @@ -0,0 +1,28 @@ +//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12 -use-dxil -profile cs_6_0 +//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer +RWStructuredBuffer<int> outputBuffer; + +[numthreads(4, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + int idx = int(dispatchThreadID.x); + + int value = 0; + + // Scalar + + value += WaveBroadcastLaneAt(idx, 1); + + // vector + + { + float2 v = float2(idx + 1, idx + 2); + float2 readValue = WaveBroadcastLaneAt(v, 4 & 3); + + value += int(readValue[0] + readValue[1]); + } + + outputBuffer[idx] = value; +}
\ No newline at end of file diff --git a/tests/hlsl-intrinsic/wave-broadcast-lane-at-vk.slang.expected.txt b/tests/hlsl-intrinsic/wave-broadcast-lane-at-vk.slang.expected.txt new file mode 100644 index 000000000..e785149d2 --- /dev/null +++ b/tests/hlsl-intrinsic/wave-broadcast-lane-at-vk.slang.expected.txt @@ -0,0 +1,4 @@ +4 +4 +4 +4 diff --git a/tests/hlsl-intrinsic/wave-broadcast-lane-at.slang b/tests/hlsl-intrinsic/wave-broadcast-lane-at.slang new file mode 100644 index 000000000..b6f5d3847 --- /dev/null +++ b/tests/hlsl-intrinsic/wave-broadcast-lane-at.slang @@ -0,0 +1,41 @@ +//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-cpu -compute +//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute +//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12 -use-dxil -profile cs_6_0 +// Disabled on VK because glsl can't do WaveReadLaneAt on matrix. +//DISABLE_TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute +//TEST(compute):COMPARE_COMPUTE_EX:-cuda -compute + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer +RWStructuredBuffer<int> outputBuffer; + +[numthreads(4, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + int idx = int(dispatchThreadID.x); + + int value = 0; + + // Scalar + + value += WaveBroadcastLaneAt(idx, 1); + + // vector + + { + float2 v = float2(idx + 1, idx + 2); + float2 readValue = WaveBroadcastLaneAt(v, 2); + + value += int(readValue[0] + readValue[1]); + } + + // matrix + { + matrix<int, 2, 2> v = matrix<int, 2, 2>(idx, idx - 1, idx * 3, idx - 2); + + matrix<int, 2, 2> readValue = WaveBroadcastLaneAt(v, 3); + + value += int(readValue[0][0] + readValue[0][1] + readValue[1][0] + readValue[1][1]); + } + + outputBuffer[idx] = value; +}
\ No newline at end of file diff --git a/tests/hlsl-intrinsic/wave-broadcast-lane-at.slang.expected.txt b/tests/hlsl-intrinsic/wave-broadcast-lane-at.slang.expected.txt new file mode 100644 index 000000000..5ce1f8639 --- /dev/null +++ b/tests/hlsl-intrinsic/wave-broadcast-lane-at.slang.expected.txt @@ -0,0 +1,4 @@ +17 +17 +17 +17 diff --git a/tests/hlsl-intrinsic/wave-lane-at-vk.slang b/tests/hlsl-intrinsic/wave-read-lane-at-vk.slang index 0d52f781e..3bd6b36b8 100644 --- a/tests/hlsl-intrinsic/wave-lane-at-vk.slang +++ b/tests/hlsl-intrinsic/wave-read-lane-at-vk.slang @@ -2,8 +2,7 @@ // We have this 'simple' test, because we can't do matrix (or imat) operations on GLSL/Vk target //TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12 -use-dxil -profile cs_6_0 -// TODO(JS): Disabled for now, as requires upgraded glslang -//DISABLE_TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute +//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute //TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer RWStructuredBuffer<int> outputBuffer; diff --git a/tests/hlsl-intrinsic/wave-lane-at-vk.slang.expected.txt b/tests/hlsl-intrinsic/wave-read-lane-at-vk.slang.expected.txt index 4e98888c6..4e98888c6 100644 --- a/tests/hlsl-intrinsic/wave-lane-at-vk.slang.expected.txt +++ b/tests/hlsl-intrinsic/wave-read-lane-at-vk.slang.expected.txt diff --git a/tests/hlsl-intrinsic/wave-lane-at.slang b/tests/hlsl-intrinsic/wave-read-lane-at.slang index c3caaa4e8..c3caaa4e8 100644 --- a/tests/hlsl-intrinsic/wave-lane-at.slang +++ b/tests/hlsl-intrinsic/wave-read-lane-at.slang diff --git a/tests/hlsl-intrinsic/wave-lane-at.slang.expected.txt b/tests/hlsl-intrinsic/wave-read-lane-at.slang.expected.txt index c6167dbae..c6167dbae 100644 --- a/tests/hlsl-intrinsic/wave-lane-at.slang.expected.txt +++ b/tests/hlsl-intrinsic/wave-read-lane-at.slang.expected.txt diff --git a/tests/hlsl-intrinsic/wave-shuffle-vk.slang b/tests/hlsl-intrinsic/wave-shuffle-vk.slang index 01fb59155..75aa392ea 100644 --- a/tests/hlsl-intrinsic/wave-shuffle-vk.slang +++ b/tests/hlsl-intrinsic/wave-shuffle-vk.slang @@ -2,7 +2,6 @@ //DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-cpu -compute //DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute //DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12 -use-dxil -profile cs_6_0 - //TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute //TEST(compute):COMPARE_COMPUTE_EX:-cuda -compute |
