diff options
| author | Yong He <yonghe@outlook.com> | 2023-02-13 10:38:14 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-13 10:38:14 -0800 |
| commit | 4dbc74a953ae1b34ce64a4eaef3aa7feb73663b9 (patch) | |
| tree | 82b099c1074a0361b0db6a72e96f71d3b8e3b574 /tests/ir/loop-unroll-1.slang | |
| parent | 57af2c1c2fccb221fa54fd92415f424b1d7e5beb (diff) | |
Add Loop Unrolling Pass. (#2644)
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tests/ir/loop-unroll-1.slang')
| -rw-r--r-- | tests/ir/loop-unroll-1.slang | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/ir/loop-unroll-1.slang b/tests/ir/loop-unroll-1.slang new file mode 100644 index 000000000..562cd3713 --- /dev/null +++ b/tests/ir/loop-unroll-1.slang @@ -0,0 +1,25 @@ +//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; + int sum = 0; + [ForceUnroll] + while (i < 2) + { + int j = 1; + [ForceUnroll(2)] + while (j < 3) + { + sum += (i+j); + j++; + } + i++; + } + outputBuffer[0] = sum; +} |
