diff options
| author | Ellie Hermaszewska <ellieh@nvidia.com> | 2024-07-05 21:09:13 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-05 21:09:13 +0800 |
| commit | 65194cf0a926267839ff56e47c1a1eb14e2b0977 (patch) | |
| tree | 40604c6bcb555c8e1e53d35e7d013f40c5964827 /tests | |
| parent | 388de5f68ebef556f9addcf36685109d2524ee4e (diff) | |
Add vector overloads for or and and (#4529)
* Add vector overloads for or and and
Closes #4441 and #4434
* Disable cuda checks which use unsupported bool vectors
* Add tests for 4531
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/bugs/gh-4434.slang | 36 | ||||
| -rw-r--r-- | tests/bugs/gh-4441.slang | 36 | ||||
| -rw-r--r-- | tests/bugs/gh-4531.slang | 20 | ||||
| -rw-r--r-- | tests/bugs/gh-4533.slang | 2 |
4 files changed, 93 insertions, 1 deletions
diff --git a/tests/bugs/gh-4434.slang b/tests/bugs/gh-4434.slang new file mode 100644 index 000000000..975226008 --- /dev/null +++ b/tests/bugs/gh-4434.slang @@ -0,0 +1,36 @@ +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-mtl +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cuda + +// CHECK: 1 +// CHECK-NEXT: 1 +// CHECK-NEXT: 1 +// CHECK-NEXT: 1 + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer<uint> outputBuffer; + +[numthreads(4, 1, 1)] +void computeMain(uint tid : SV_GroupIndex) +{ + bool a, b, c; + c = and(a, b); + + bool1 i, j, k; + bool2 l, m, n; + bool3 o, p, q; + bool4 r, s, t; + k = and(i, j); + n = and(m, l); + q = and(o, p); + t = and(r, s); + + k = !and(k, false); + n = !and(n, false); + q = !and(q, false); + t = !and(t, false); + + outputBuffer[tid] = all(k) && all(n) && all(q) && all(t); +} diff --git a/tests/bugs/gh-4441.slang b/tests/bugs/gh-4441.slang new file mode 100644 index 000000000..59d577c8d --- /dev/null +++ b/tests/bugs/gh-4441.slang @@ -0,0 +1,36 @@ +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-mtl +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cuda + +// CHECK: 1 +// CHECK-NEXT: 1 +// CHECK-NEXT: 1 +// CHECK-NEXT: 1 + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer<uint> outputBuffer; + +[numthreads(4, 1, 1)] +void computeMain(uint tid : SV_GroupIndex) +{ + bool a, b, c; + c = or(a, b); + + bool1 i, j, k; + bool2 l, m, n; + bool3 o, p, q; + bool4 r, s, t; + k = or(i, j); + n = or(m, l); + q = or(o, p); + t = or(r, s); + + k = or(k, true); + n = or(n, true); + q = or(q, true); + t = or(t, true); + + outputBuffer[tid] = all(k) && all(n) && all(q) && all(t); +} diff --git a/tests/bugs/gh-4531.slang b/tests/bugs/gh-4531.slang new file mode 100644 index 000000000..e84c4713f --- /dev/null +++ b/tests/bugs/gh-4531.slang @@ -0,0 +1,20 @@ +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-mtl +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cuda + +// CHECK: 1 +// CHECK-NEXT: 1 +// CHECK-NEXT: 1 +// CHECK-NEXT: 1 + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer<uint> outputBuffer; + +[numthreads(4, 1, 1)] +void computeMain(uint tid : SV_GroupIndex) +{ + vector<bool,4> k = true; + outputBuffer[tid] = all(k); +} diff --git a/tests/bugs/gh-4533.slang b/tests/bugs/gh-4533.slang index 3ee27996b..a483c89b9 100644 --- a/tests/bugs/gh-4533.slang +++ b/tests/bugs/gh-4533.slang @@ -16,5 +16,5 @@ RWStructuredBuffer<uint> outputBuffer; void computeMain(uint tid : SV_GroupIndex) { vector<float,1> k = float1(tid); - outputBuffer[tid] = all(k) && any(k) && bool(asint(k)) && bool(asuint(k)); + outputBuffer[tid] = all(k) && any(k) && bool(asint(k)) && bool(asuint(k)) && bool(sign(k)); } |
