From d120fec7e81bbd5e8cf2c551b573feaf6678b43d Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Mon, 27 Mar 2023 22:52:48 -0400 Subject: 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 --------- Co-authored-by: Yong He Co-authored-by: Ellie Hermaszewska --- tests/bugs/stk-chk.slang | 55 +++++++++++++++++++++++++++++++++++ tests/bugs/stk-chk.slang.expected.txt | 4 +++ 2 files changed, 59 insertions(+) create mode 100644 tests/bugs/stk-chk.slang create mode 100644 tests/bugs/stk-chk.slang.expected.txt (limited to 'tests/bugs') 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 outputBuffer; + +//TEST_INPUT:ubuffer(data=[9 1000 27 34], stride=4):name inputBuffer +StructuredBuffer 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 -- cgit v1.2.3