summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/hlsl-intrinsic/wave-get-lane-index.slang19
-rw-r--r--tests/hlsl-intrinsic/wave-get-lane-index.slang.expected.txt4
2 files changed, 23 insertions, 0 deletions
diff --git a/tests/hlsl-intrinsic/wave-get-lane-index.slang b/tests/hlsl-intrinsic/wave-get-lane-index.slang
new file mode 100644
index 000000000..50cf9822c
--- /dev/null
+++ b/tests/hlsl-intrinsic/wave-get-lane-index.slang
@@ -0,0 +1,19 @@
+//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
+//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 = dispatchThreadID.x;
+ int laneId = WaveGetLaneIndex();
+ // The laneCount will be dependent on target hardware. It seems a count of 1 is valid in spec.
+ // For now we'll just check it's not 0.
+ int laneCount = WaveGetLaneCount();
+ outputBuffer[idx] = ((laneCount > 0) ? 0x100 : 0) + laneId;
+} \ No newline at end of file
diff --git a/tests/hlsl-intrinsic/wave-get-lane-index.slang.expected.txt b/tests/hlsl-intrinsic/wave-get-lane-index.slang.expected.txt
new file mode 100644
index 000000000..f94894bb2
--- /dev/null
+++ b/tests/hlsl-intrinsic/wave-get-lane-index.slang.expected.txt
@@ -0,0 +1,4 @@
+100
+101
+102
+103