summaryrefslogtreecommitdiff
path: root/tests/ir/loop-unroll-0.slang
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2023-02-13 10:38:14 -0800
committerGitHub <noreply@github.com>2023-02-13 10:38:14 -0800
commit4dbc74a953ae1b34ce64a4eaef3aa7feb73663b9 (patch)
tree82b099c1074a0361b0db6a72e96f71d3b8e3b574 /tests/ir/loop-unroll-0.slang
parent57af2c1c2fccb221fa54fd92415f424b1d7e5beb (diff)
Add Loop Unrolling Pass. (#2644)
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tests/ir/loop-unroll-0.slang')
-rw-r--r--tests/ir/loop-unroll-0.slang19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/ir/loop-unroll-0.slang b/tests/ir/loop-unroll-0.slang
new file mode 100644
index 000000000..d97acac0e
--- /dev/null
+++ b/tests/ir/loop-unroll-0.slang
@@ -0,0 +1,19 @@
+//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj
+//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj
+
+//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer
+RWStructuredBuffer<uint> outputBuffer;
+
+[numthreads(1, 1, 1)]
+void computeMain(uint3 dispatchThreadID: SV_DispatchThreadID)
+{
+ int i = 0;
+ [ForceUnroll]
+ while (i < 5 && dispatchThreadID.x == 0)
+ {
+ if (i >= 3)
+ break;
+ outputBuffer[i] = i;
+ i++;
+ }
+}