summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2023-03-27 22:52:48 -0400
committerGitHub <noreply@github.com>2023-03-27 19:52:48 -0700
commitd120fec7e81bbd5e8cf2c551b573feaf6678b43d (patch)
tree2171333e6dd1132e310c1dd125e2e84c4add780d /tests
parent579870b714e76cc92300cef1fdf091993bb55954 (diff)
Upgrade `slang-llvm` (#2741)
* #include an absolute path didn't work - because paths were taken to always be relative. * Fix SlangCompileTarget to keep ordering. * Add test. Remove V2 version of interface to access IDownstreamCompiler Update to slang-llvm which has _chkstk support. * Update slang.h Co-authored-by: Ellie Hermaszewska <github@sub.monoid.al> --------- Co-authored-by: Yong He <yonghe@outlook.com> Co-authored-by: Ellie Hermaszewska <github@sub.monoid.al>
Diffstat (limited to 'tests')
-rw-r--r--tests/bugs/stk-chk.slang55
-rw-r--r--tests/bugs/stk-chk.slang.expected.txt4
2 files changed, 59 insertions, 0 deletions
diff --git a/tests/bugs/stk-chk.slang b/tests/bugs/stk-chk.slang
new file mode 100644
index 000000000..8fabaeee5
--- /dev/null
+++ b/tests/bugs/stk-chk.slang
@@ -0,0 +1,55 @@
+//TEST(compute):COMPARE_COMPUTE:-cpu
+
+// Tests slang-llvm can deal with large items on stack.
+// On some targets this requires special handling (_chkstk on windows for example)
+
+struct LargeStruct
+{
+ int values[4096];
+};
+
+//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer
+RWStructuredBuffer<int> outputBuffer;
+
+//TEST_INPUT:ubuffer(data=[9 1000 27 34], stride=4):name inputBuffer
+StructuredBuffer<int> inputBuffer;
+
+LargeStruct _calcStruct(int a)
+{
+ LargeStruct s;
+
+ int t = a;
+
+ for (int i = 0; i < 4096; ++i)
+ {
+ s.values[i] = t;
+
+ // Munge
+ t = t ^ (i * t) + (i - a) * 17 + inputBuffer[t & 3];
+ }
+
+ return s;
+}
+
+int _calcValue(LargeStruct s)
+{
+ int v = 0;
+ for (int i = 0; i < 4096; ++i)
+ {
+ v ^= s.values[i];
+ }
+ return v + 1;
+}
+
+int _calc1(int a)
+{
+ return _calcValue(_calcStruct(_calcValue(_calcStruct(_calcValue(_calcStruct(a ^ 19))))));
+}
+
+[numthreads(4, 1, 1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ int index = int(dispatchThreadID.x);
+
+ outputBuffer[index] = _calc1(index) + 1;
+} \ No newline at end of file
diff --git a/tests/bugs/stk-chk.slang.expected.txt b/tests/bugs/stk-chk.slang.expected.txt
new file mode 100644
index 000000000..530a099a9
--- /dev/null
+++ b/tests/bugs/stk-chk.slang.expected.txt
@@ -0,0 +1,4 @@
+5B2F1F3C
+FB3647FB
+AC4B2652
+A954D2BD