summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJay Kwak <82421531+jkwak-work@users.noreply.github.com>2024-04-01 22:02:25 -0700
committerGitHub <noreply@github.com>2024-04-01 22:02:25 -0700
commit251f55c5ec4cb2b7432e71d6ba8adc96700d35c2 (patch)
tree6360ae937545943a97f3a380cbcb3c2d8fb950bd /tests
parentdaf63cc983fd5f8f2b24872a9125e0394ed2180e (diff)
Support SM6.6 keyword "WaveSize" (#3871)
Resolves an issue #3385 Shader Model 6.6 added a new keyowrd, "WaveSize". See the following link for more details: https://microsoft.github.io/DirectX-Specs/d3d/HLSL_SM_6_6_WaveSize.html Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/diagnostics/wavesize-invalid-size.slang18
-rw-r--r--tests/hlsl/wave-size.slang13
2 files changed, 31 insertions, 0 deletions
diff --git a/tests/diagnostics/wavesize-invalid-size.slang b/tests/diagnostics/wavesize-invalid-size.slang
new file mode 100644
index 000000000..840434137
--- /dev/null
+++ b/tests/diagnostics/wavesize-invalid-size.slang
@@ -0,0 +1,18 @@
+//TEST:SIMPLE(filecheck=CHECK): -target hlsl -stage compute -entry computeMain
+
+//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;
+
+// Print an error when the numLanes is an invalid value for WaveSize.
+// The value has to be a power of 2 between 4 and 128, inclusive.
+// In other words, the set: [4, 8, 16, 32, 64, 128].
+
+// "5" is an invalid value for WaveSize
+// CHECK: error 31103:
+[WaveSize(5)]
+[numthreads(4, 1, 1)]
+void computeMain(int3 dispatchThreadID : SV_DispatchThreadID)
+{
+ int tid = dispatchThreadID.x;
+ outputBuffer[tid] = tid;
+}
diff --git a/tests/hlsl/wave-size.slang b/tests/hlsl/wave-size.slang
new file mode 100644
index 000000000..3fc6363c4
--- /dev/null
+++ b/tests/hlsl/wave-size.slang
@@ -0,0 +1,13 @@
+//TEST:SIMPLE(filecheck=CHECK): -target hlsl -stage compute -entry computeMain
+
+//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;
+
+// CHECK: [WaveSize(4)]
+[WaveSize(4)]
+[numthreads(4, 1, 1)]
+void computeMain(int3 dispatchThreadID : SV_DispatchThreadID)
+{
+ int tid = dispatchThreadID.x;
+ outputBuffer[tid] = tid;
+}