diff options
| author | Yong He <yonghe@outlook.com> | 2023-08-14 16:23:19 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-08-14 16:23:19 -0700 |
| commit | 661d6198bbb9857d3fdc6df477e0742ed0b0765c (patch) | |
| tree | 974a57cfa2e43624e91502e9e652a0cc78105b3a /tests | |
| parent | 0403e0556b470f6b316153caea2dc6f5c314da5b (diff) | |
Support per field matrix layout (#3101)
* Support per field matrix layout
* Fix warnings.
* Fix.
* Fix tests.
* Fix spiv gen.
* Fix.
* More test fixes.
* Fix.
* Run only GPU tests on self-hosted servers.
* Remove -use-glsl-matrix-layout-modifier.
* Fix.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tests')
35 files changed, 130 insertions, 1186 deletions
diff --git a/tests/compute/comma-operator.slang.glsl b/tests/compute/comma-operator.slang.glsl index 3107f5773..af7120704 100644 --- a/tests/compute/comma-operator.slang.glsl +++ b/tests/compute/comma-operator.slang.glsl @@ -3,8 +3,7 @@ //TEST_IGNORE_FILE: -layout(std430, binding = 0) -buffer _S1 { +layout(std430, binding = 0) buffer _S1 { int _data[]; } outputBuffer_0; @@ -13,12 +12,10 @@ int test_0(int inVal_0) return inVal_0 * 2 + 1; } -layout(local_size_x = 4, local_size_y = 1, local_size_z = 1) in;void main() +layout(local_size_x = 4, local_size_y = 1, local_size_z = 1) in; +void main() { uint tid_0 = gl_GlobalInvocationID.x; - - int outVal_0 = test_0(outputBuffer_0._data[tid_0]); - - outputBuffer_0._data[tid_0] = outVal_0; + outputBuffer_0._data[tid_0] = test_0(outputBuffer_0._data[tid_0]); return; } diff --git a/tests/compute/unbounded-array-of-array-syntax.slang.glsl b/tests/compute/unbounded-array-of-array-syntax.slang.glsl index f30012cc3..73148ae10 100644 --- a/tests/compute/unbounded-array-of-array-syntax.slang.glsl +++ b/tests/compute/unbounded-array-of-array-syntax.slang.glsl @@ -32,7 +32,6 @@ void main() { innerIndex_1 = innerIndex_0; } - uint _S4 = uint(innerIndex_1); - ((outputBuffer_0)._data[(uint(index_0))]) = ((g_aoa_0[_S3])._data[(_S4)]); + outputBuffer_0._data[uint(index_0)] = g_aoa_0[_S3]._data[uint(innerIndex_1)]; return; } diff --git a/tests/cross-compile/array-of-buffers.slang.glsl b/tests/cross-compile/array-of-buffers.slang.glsl index 62990033e..a198a5277 100644 --- a/tests/cross-compile/array-of-buffers.slang.glsl +++ b/tests/cross-compile/array-of-buffers.slang.glsl @@ -11,6 +11,7 @@ layout(std140) uniform _S1 { uint index_0; } C_0; + struct S_0 { vec4 f_0; @@ -36,9 +37,7 @@ out vec4 _S6; void main() { - S_0 _S7 = ((sb1_0[C_0.index_0])._data[(C_0.index_0)]); - vec4 _S8 = cb_0[C_0.index_0].f_0 + _S7.f_0; - uint _S9 = ((bb_0[C_0.index_0])._data[(int(C_0.index_0 * 4U))/4]); - _S6 = _S8 + ((sb2_0[C_0.index_0])._data[(C_0.index_0)]) + vec4(float(_S9)); + uint _S7 = ((bb_0[C_0.index_0])._data[(int(C_0.index_0 * 4U))/4]); + _S6 = cb_0[C_0.index_0].f_0 + sb1_0[C_0.index_0]._data[C_0.index_0].f_0 + sb2_0[C_0.index_0]._data[C_0.index_0] + vec4(float(_S7)); return; } diff --git a/tests/cross-compile/array-of-buffers.slang.hlsl b/tests/cross-compile/array-of-buffers.slang.hlsl index e709d323a..ca4b76bbe 100644 --- a/tests/cross-compile/array-of-buffers.slang.hlsl +++ b/tests/cross-compile/array-of-buffers.slang.hlsl @@ -13,6 +13,7 @@ cbuffer C_0 : register(b0) { SLANG_ParameterGroup_C_0 C_0; } + struct S_0 { float4 f_0; @@ -25,10 +26,9 @@ StructuredBuffer<S_0 > sb1_0[int(4)] : register(t0); RWStructuredBuffer<float4 > sb2_0[int(5)] : register(u0); ByteAddressBuffer bb_0[int(6)] : register(t4); + float4 main() : SV_TARGET { - S_0 _S1 = sb1_0[C_0.index_0][C_0.index_0]; - float4 _S2 = cb_0[C_0.index_0].f_0 + _S1.f_0; - uint _S3 = bb_0[C_0.index_0].Load(int(C_0.index_0 * 4U)); - return _S2 + sb2_0[C_0.index_0][C_0.index_0] + (float4)float(_S3); + uint _S1 = bb_0[C_0.index_0].Load(int(C_0.index_0 * 4U)); + return cb_0[C_0.index_0].f_0 + sb1_0[C_0.index_0].Load(C_0.index_0).f_0 + sb2_0[C_0.index_0][C_0.index_0] + (float4)float(_S1); } diff --git a/tests/cross-compile/func-resource-param-array.slang.glsl b/tests/cross-compile/func-resource-param-array.slang.glsl index d5d1bd08c..9e396e55f 100644 --- a/tests/cross-compile/func-resource-param-array.slang.glsl +++ b/tests/cross-compile/func-resource-param-array.slang.glsl @@ -16,22 +16,22 @@ layout(std430, binding = 2) buffer _S3 { int f_0(uint _S4) { - return ((a_0)._data[(_S4)]); + return a_0._data[_S4]; } int f_1(uint _S5, uint _S6) { - return ((b_0[_S5])._data[(_S6)]); + return b_0[_S5]._data[_S6]; } int g_0(uint _S7, uint _S8) { - return ((b_0[_S7])._data[(_S8)]); + return b_0[_S7]._data[_S8]; } int g_1(uint _S9, uint _S10, uint _S11) { - return ((c_0[_S9][_S10])._data[(_S11)]); + return c_0[_S9][_S10]._data[_S11]; } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; @@ -39,10 +39,7 @@ void main() { uint ii_0 = gl_GlobalInvocationID.x; uint jj_0 = gl_GlobalInvocationID.y; - - int tmp_0 = f_0(ii_0) + f_0(jj_0) + f_1(ii_0, jj_0) + g_0(ii_0, jj_0) + g_1(ii_0, jj_0, gl_GlobalInvocationID.z); - - ((a_0)._data[(ii_0)]) = tmp_0; + a_0._data[ii_0] = f_0(ii_0) + f_0(jj_0) + f_1(ii_0, jj_0) + g_0(ii_0, jj_0) + g_1(ii_0, jj_0, gl_GlobalInvocationID.z); return; } diff --git a/tests/diagnostics/bad-operator-call.slang b/tests/diagnostics/bad-operator-call.slang index 1455d1cc3..2764d27ae 100644 --- a/tests/diagnostics/bad-operator-call.slang +++ b/tests/diagnostics/bad-operator-call.slang @@ -1,6 +1,6 @@ // bad-operator-call.slang -//DIAGNOSTIC_TEST(windows):SIMPLE: +//DIAGNOSTIC_TEST(windows):SIMPLE(filecheck=CHECK): // Test that bad calls to operators produce reasonable diagnostic messages. @@ -13,22 +13,22 @@ struct S {} void test() { int a; - S b; - - a += b; - - a = a + b; - + S b; + // CHECK:{{.*}}.slang(18): error {{.*}}: no overload for '+=' applicable to arguments of type (int, S) + a += b; + // CHECK:{{.*}}.slang(20): error {{.*}}: no overload for '+' applicable to arguments of type (int, S) + a = a + b; + // CHECK:{{.*}}.slang(22): error {{.*}}: no overload for '~' applicable to arguments of type (S) a = ~b; vector<int, 4> c; - vector<float, 3> d; - + vector<float, 3> d; + // CHECK:{{.*}}.slang(27): error {{.*}}: argument passed to parameter '0' must be l-value. a += c; - c = a + c; - - d += c; - + c = a + c; + // CHECK:{{.*}}.slang(31): error {{.*}}: no overload for '+=' applicable to arguments of type (vector<float,3>, vector<int,4>) + d += c; + // CHECK:{{.*}}.slang(33): error {{.*}}: no overload for '+' applicable to arguments of type (vector<int,4>, vector<float,3>) d = c + d; }
\ No newline at end of file diff --git a/tests/diagnostics/bad-operator-call.slang.expected b/tests/diagnostics/bad-operator-call.slang.expected deleted file mode 100644 index 3abca8f23..000000000 --- a/tests/diagnostics/bad-operator-call.slang.expected +++ /dev/null @@ -1,70 +0,0 @@ -result code = -1 -standard error = { -tests/diagnostics/bad-operator-call.slang(18): error 39999: no overload for '+=' applicable to arguments of type (int, S) - a += b; - ^~ -core.meta.slang(2655): note 39999: candidate: func +=<T, R:int, C:int>(out matrix<T,R,C>, T) -> matrix<T,R,C> -core.meta.slang(2647): note 39999: candidate: func +=<T, R:int, C:int>(out matrix<T,R,C>, matrix<T,R,C>) -> matrix<T,R,C> -core.meta.slang(2639): note 39999: candidate: func +=<T, N:int>(out vector<T,N>, T) -> vector<T,N> -core.meta.slang(2631): note 39999: candidate: func +=<T, N:int>(out vector<T,N>, vector<T,N>) -> vector<T,N> -core.meta.slang(2623): note 39999: candidate: func +=<T>(out T, T) -> T -tests/diagnostics/bad-operator-call.slang(20): error 39999: no overload for '+' applicable to arguments of type (int, S) - a = a + b; - ^ -core.meta.slang(2481): note 39999: candidate: func +(uintptr_t, uintptr_t) -> uintptr_t -core.meta.slang(2473): note 39999: candidate: func +(uint64_t, uint64_t) -> uint64_t -core.meta.slang(2465): note 39999: candidate: func +(uint, uint) -> uint -core.meta.slang(2457): note 39999: candidate: func +(uint16_t, uint16_t) -> uint16_t -core.meta.slang(2449): note 39999: candidate: func +(uint8_t, uint8_t) -> uint8_t -core.meta.slang(2441): note 39999: candidate: func +(double, double) -> double -core.meta.slang(2433): note 39999: candidate: func +(float, float) -> float -core.meta.slang(2425): note 39999: candidate: func +(half, half) -> half -core.meta.slang(2417): note 39999: candidate: func +(intptr_t, intptr_t) -> intptr_t -core.meta.slang(2409): note 39999: candidate: func +(int64_t, int64_t) -> int64_t -tests/diagnostics/bad-operator-call.slang(20): note 39999: 3 more overload candidates - a = a + b; - ^ -tests/diagnostics/bad-operator-call.slang(22): error 39999: no overload for '~' applicable to arguments of type (S) - a = ~b; - ^ -core.meta.slang(2350): note 39999: candidate: __prefix func ~(uintptr_t) -> uintptr_t -core.meta.slang(2346): note 39999: candidate: __prefix func ~(uint64_t) -> uint64_t -core.meta.slang(2342): note 39999: candidate: __prefix func ~(uint) -> uint -core.meta.slang(2338): note 39999: candidate: __prefix func ~(uint16_t) -> uint16_t -core.meta.slang(2334): note 39999: candidate: __prefix func ~(uint8_t) -> uint8_t -core.meta.slang(2330): note 39999: candidate: __prefix func ~(intptr_t) -> intptr_t -core.meta.slang(2326): note 39999: candidate: __prefix func ~(int64_t) -> int64_t -core.meta.slang(2322): note 39999: candidate: __prefix func ~(int) -> int -core.meta.slang(2318): note 39999: candidate: __prefix func ~(int16_t) -> int16_t -core.meta.slang(2314): note 39999: candidate: __prefix func ~(int8_t) -> int8_t -tests/diagnostics/bad-operator-call.slang(27): error 30047: argument passed to parameter '0' must be l-value. - a += c; - ^ -tests/diagnostics/bad-operator-call.slang(27): note 30063: argument was implicitly cast from 'int' to 'vector<int,4>', and Slang does not support using an implicit cast as an l-value with this type -tests/diagnostics/bad-operator-call.slang(31): error 39999: no overload for '+=' applicable to arguments of type (vector<float,3>, vector<int,4>) - d += c; - ^~ -core.meta.slang(2655): note 39999: candidate: func +=<T, R:int, C:int>(out matrix<T,R,C>, T) -> matrix<T,R,C> -core.meta.slang(2647): note 39999: candidate: func +=<T, R:int, C:int>(out matrix<T,R,C>, matrix<T,R,C>) -> matrix<T,R,C> -core.meta.slang(2639): note 39999: candidate: func +=<T, N:int>(out vector<T,N>, T) -> vector<T,N> -core.meta.slang(2631): note 39999: candidate: func +=<T, N:int>(out vector<T,N>, vector<T,N>) -> vector<T,N> -core.meta.slang(2623): note 39999: candidate: func +=<T>(out T, T) -> T -tests/diagnostics/bad-operator-call.slang(33): error 39999: no overload for '+' applicable to arguments of type (vector<int,4>, vector<float,3>) - d = c + d; - ^ -core.meta.slang(2487): note 39999: candidate: func +<4>(uintptr_t4, uintptr_t) -> uintptr_t4 -core.meta.slang(2485): note 39999: candidate: func +<3>(uintptr_t, uintptr_t3) -> uintptr_t3 -core.meta.slang(2481): note 39999: candidate: func +(uintptr_t, uintptr_t) -> uintptr_t -core.meta.slang(2479): note 39999: candidate: func +<4>(uint64_t4, uint64_t) -> uint64_t4 -core.meta.slang(2477): note 39999: candidate: func +<3>(uint64_t, uint64_t3) -> uint64_t3 -core.meta.slang(2473): note 39999: candidate: func +(uint64_t, uint64_t) -> uint64_t -core.meta.slang(2471): note 39999: candidate: func +<4>(uint4, uint) -> uint4 -core.meta.slang(2469): note 39999: candidate: func +<3>(uint, uint3) -> uint3 -core.meta.slang(2465): note 39999: candidate: func +(uint, uint) -> uint -core.meta.slang(2463): note 39999: candidate: func +<4>(uint16_t4, uint16_t) -> uint16_t4 -tests/diagnostics/bad-operator-call.slang(33): note 39999: 29 more overload candidates - d = c + d; - ^ -} -standard output = { -} diff --git a/tests/experimental/liveness/liveness-2.slang b/tests/experimental/liveness/liveness-2.slang deleted file mode 100644 index 06382971f..000000000 --- a/tests/experimental/liveness/liveness-2.slang +++ /dev/null @@ -1,27 +0,0 @@ -//TEST:SIMPLE:-target glsl -entry computeMain -profile cs_6_3 -track-liveness -line-directive-mode none - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer -RWStructuredBuffer<int> outputBuffer; - -// Test loop handling. - -int calcThing(int offset) -{ - int idx[3]; - - for (int i = 0; i < 3; ++i) - { - idx[i] = offset + i; - } - - // Now read back - return idx[0] + idx[1] + idx[2]; -} - -[numthreads(4, 1, 1)] -void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) -{ - int index = int(dispatchThreadID.x); - - outputBuffer[index] = calcThing(index); -} diff --git a/tests/experimental/liveness/liveness-2.slang.expected b/tests/experimental/liveness/liveness-2.slang.expected deleted file mode 100644 index 3ae6d3875..000000000 --- a/tests/experimental/liveness/liveness-2.slang.expected +++ /dev/null @@ -1,59 +0,0 @@ -result code = 0 -standard error = { -} -standard output = { -#version 450 -#extension GL_EXT_spirv_intrinsics : require -layout(row_major) uniform; -layout(row_major) buffer; -layout(std430, binding = 0) buffer _S1 { - int _data[]; -} outputBuffer_0; -spirv_instruction(id = 256) -void livenessStart_0(spirv_by_reference int _0[3], spirv_literal int _1); - -spirv_instruction(id = 256) -void livenessStart_1(spirv_by_reference int _0, spirv_literal int _1); - -spirv_instruction(id = 257) -void livenessEnd_0(spirv_by_reference int _0, spirv_literal int _1); - -spirv_instruction(id = 257) -void livenessEnd_1(spirv_by_reference int _0[3], spirv_literal int _1); - -int calcThing_0(int offset_0) -{ - int idx_0[3]; - livenessStart_0(idx_0, 0); - int i_0; - livenessStart_1(i_0, 0); - i_0 = 0; - for(;;) - { - if(i_0 < 3) - { - } - else - { - livenessEnd_0(i_0, 0); - break; - } - idx_0[i_0] = offset_0 + i_0; - i_0 = i_0 + 1; - } - int _S2 = idx_0[0] + idx_0[1]; - int _S3 = idx_0[2]; - livenessEnd_1(idx_0, 0); - return _S2 + _S3; -} - -layout(local_size_x = 4, local_size_y = 1, local_size_z = 1) in; -void main() -{ - int index_0 = int(gl_GlobalInvocationID.x); - int _S4 = calcThing_0(index_0); - ((outputBuffer_0)._data[(uint(index_0))]) = _S4; - return; -} - -} diff --git a/tests/experimental/liveness/liveness-3.slang b/tests/experimental/liveness/liveness-3.slang deleted file mode 100644 index a0c5c8604..000000000 --- a/tests/experimental/liveness/liveness-3.slang +++ /dev/null @@ -1,49 +0,0 @@ -//TEST:SIMPLE:-target glsl -entry computeMain -profile cs_6_3 -track-liveness -line-directive-mode none - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer -RWStructuredBuffer<int> outputBuffer; - -// Test loop handling, with more complex structure - -int calcThing(int offset) -{ - int total = 0; - int another[2] = { 1, 2}; - - for (int k = 0; k < 20; ++k) - { - int idx[3] = {}; - - for (int i = 0; i < 17; ++i) - { - int modRange = i % 3; - - another[i & 1] += modRange; - - if (i % 3 != 0) - { - offset += 1; - } - - idx[modRange] += offset + i; - } - - if ((k + 7) % 5 == 4) - { - return total; - } - - // Now read back - total += idx[0] + idx[1] + idx[2]; - } - - return -total; -} - -[numthreads(4, 1, 1)] -void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) -{ - int index = int(dispatchThreadID.x); - - outputBuffer[index] = calcThing(index); -} diff --git a/tests/experimental/liveness/liveness-3.slang.expected b/tests/experimental/liveness/liveness-3.slang.expected deleted file mode 100644 index c2191e9b9..000000000 --- a/tests/experimental/liveness/liveness-3.slang.expected +++ /dev/null @@ -1,134 +0,0 @@ -result code = 0 -standard error = { -} -standard output = { -#version 450 -#extension GL_EXT_spirv_intrinsics : require -layout(row_major) uniform; -layout(row_major) buffer; -layout(std430, binding = 0) buffer _S1 { - int _data[]; -} outputBuffer_0; -spirv_instruction(id = 256) -void livenessStart_0(spirv_by_reference int _0[2], spirv_literal int _1); - -spirv_instruction(id = 256) -void livenessStart_1(spirv_by_reference int _0, spirv_literal int _1); - -spirv_instruction(id = 257) -void livenessEnd_0(spirv_by_reference int _0, spirv_literal int _1); - -spirv_instruction(id = 256) -void livenessStart_2(spirv_by_reference int _0[3], spirv_literal int _1); - -spirv_instruction(id = 257) -void livenessEnd_1(spirv_by_reference int _0[3], spirv_literal int _1); - -spirv_instruction(id = 257) -void livenessEnd_2(spirv_by_reference int _0[2], spirv_literal int _1); - -int calcThing_0(int offset_0) -{ - int another_0[2]; - livenessStart_0(another_0, 0); - another_0[0] = 1; - another_0[1] = 2; - int k_0; - livenessStart_1(k_0, 0); - k_0 = 0; - int _S2; - livenessStart_1(_S2, 0); - _S2 = offset_0; - int total_0; - livenessStart_1(total_0, 0); - total_0 = 0; - for(;;) - { - if(k_0 < 20) - { - } - else - { - livenessEnd_0(_S2, 0); - livenessEnd_0(k_0, 0); - break; - } - int idx_0[3]; - livenessStart_2(idx_0, 0); - idx_0[0] = 0; - idx_0[1] = 0; - idx_0[2] = 0; - bool _S3 = (k_0 + 7) % 5 == 4; - int k_1 = k_0 + 1; - int i_0; - livenessStart_1(i_0, 0); - i_0 = 0; - int _S4; - livenessStart_1(_S4, 0); - _S4 = _S2; - for(;;) - { - if(i_0 < 17) - { - } - else - { - livenessEnd_0(i_0, 0); - break; - } - int modRange_0 = i_0 % 3; - another_0[i_0 & 1] = another_0[i_0 & 1] + modRange_0; - if(modRange_0 != 0) - { - _S4 = _S4 + 1; - } - else - { - } - int _S5 = _S4; - livenessEnd_0(_S4, 0); - idx_0[modRange_0] = idx_0[modRange_0] + (_S5 + i_0); - i_0 = i_0 + 1; - livenessStart_1(_S4, 0); - } - livenessEnd_0(_S2, 0); - livenessEnd_0(k_0, 0); - if(_S3) - { - livenessEnd_0(_S4, 0); - livenessEnd_1(idx_0, 0); - livenessEnd_2(another_0, 0); - return total_0; - } - int _S6 = idx_0[0] + idx_0[1]; - int _S7 = idx_0[2]; - livenessEnd_1(idx_0, 0); - int _S8 = _S6 + _S7; - int _S9 = total_0; - livenessEnd_0(total_0, 0); - int total_1 = _S9 + _S8; - livenessStart_1(k_0, 0); - k_0 = k_1; - livenessStart_1(_S2, 0); - int _S10 = _S4; - livenessEnd_0(_S4, 0); - _S2 = _S10; - livenessStart_1(total_0, 0); - total_0 = total_1; - } - livenessEnd_2(another_0, 0); - int _S11 = total_0; - livenessEnd_0(total_0, 0); - return - _S11; -} - -layout(local_size_x = 4, local_size_y = 1, local_size_z = 1) in; -void main() -{ - int index_0 = int(gl_GlobalInvocationID.x); - int _S12 = calcThing_0(index_0); - ((outputBuffer_0)._data[(uint(index_0))]) = _S12; - return; -} - -} diff --git a/tests/experimental/liveness/liveness-4.slang b/tests/experimental/liveness/liveness-4.slang deleted file mode 100644 index a835f3a4e..000000000 --- a/tests/experimental/liveness/liveness-4.slang +++ /dev/null @@ -1,35 +0,0 @@ -//TEST:SIMPLE:-target glsl -entry computeMain -profile cs_6_3 -track-liveness -line-directive-mode none - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer -RWStructuredBuffer<int> outputBuffer; - -// Test loop handling, with more complex structure -// Here to test anothers liveness. - -int calcThing(int offset) -{ - int another[2] = { 1, 2}; - - for (int k = 0; k < 20; ++k) - { - for (int i = 0; i < 17; ++i) - { - another[i & 1] += k + i; - } - - if ((k + 7) % 5 == 4) - { - return 1; - } - } - - return -2; -} - -[numthreads(4, 1, 1)] -void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) -{ - int index = int(dispatchThreadID.x); - - outputBuffer[index] = calcThing(index); -} diff --git a/tests/experimental/liveness/liveness-4.slang.expected b/tests/experimental/liveness/liveness-4.slang.expected deleted file mode 100644 index ee7986319..000000000 --- a/tests/experimental/liveness/liveness-4.slang.expected +++ /dev/null @@ -1,56 +0,0 @@ -result code = 0 -standard error = { -} -standard output = { -#version 450 -#extension GL_EXT_spirv_intrinsics : require -layout(row_major) uniform; -layout(row_major) buffer; -layout(std430, binding = 0) buffer _S1 { - int _data[]; -} outputBuffer_0; -spirv_instruction(id = 256) -void livenessStart_0(spirv_by_reference int _0, spirv_literal int _1); - -spirv_instruction(id = 257) -void livenessEnd_0(spirv_by_reference int _0, spirv_literal int _1); - -int calcThing_0(int offset_0) -{ - int k_0; - livenessStart_0(k_0, 0); - k_0 = 0; - for(;;) - { - if(k_0 < 20) - { - } - else - { - livenessEnd_0(k_0, 0); - break; - } - bool _S2 = (k_0 + 7) % 5 == 4; - int _S3 = k_0; - livenessEnd_0(k_0, 0); - int k_1 = _S3 + 1; - if(_S2) - { - return 1; - } - livenessStart_0(k_0, 0); - k_0 = k_1; - } - return -2; -} - -layout(local_size_x = 4, local_size_y = 1, local_size_z = 1) in; -void main() -{ - int index_0 = int(gl_GlobalInvocationID.x); - int _S4 = calcThing_0(index_0); - ((outputBuffer_0)._data[(uint(index_0))]) = _S4; - return; -} - -} diff --git a/tests/experimental/liveness/liveness-5.slang b/tests/experimental/liveness/liveness-5.slang deleted file mode 100644 index 98fa6ff6f..000000000 --- a/tests/experimental/liveness/liveness-5.slang +++ /dev/null @@ -1,42 +0,0 @@ -//TEST:SIMPLE:-target glsl -entry computeMain -profile cs_6_3 -track-liveness -line-directive-mode none - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer -RWStructuredBuffer<int> outputBuffer; - -// Test loop handling, with more complex structure - -int calcThing(int offset) -{ - int total = 0; - int another[2] = { 1, 2}; - - for (int k = 0; k < 20; ++k) - { - for (int i = 0; i < 17; ++i) - { - another[i & 1] += k + i; - } - - total += another[k & 1]; - - if ((k + 7) % 5 == 4) - { - return 1; - } - } - - if (total > 4) - { - total = -total; - } - - return total; -} - -[numthreads(4, 1, 1)] -void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) -{ - int index = int(dispatchThreadID.x); - - outputBuffer[index] = calcThing(index); -} diff --git a/tests/experimental/liveness/liveness-5.slang.expected b/tests/experimental/liveness/liveness-5.slang.expected deleted file mode 100644 index 901b93bc6..000000000 --- a/tests/experimental/liveness/liveness-5.slang.expected +++ /dev/null @@ -1,98 +0,0 @@ -result code = 0 -standard error = { -} -standard output = { -#version 450 -#extension GL_EXT_spirv_intrinsics : require -layout(row_major) uniform; -layout(row_major) buffer; -layout(std430, binding = 0) buffer _S1 { - int _data[]; -} outputBuffer_0; -spirv_instruction(id = 256) -void livenessStart_0(spirv_by_reference int _0[2], spirv_literal int _1); - -spirv_instruction(id = 256) -void livenessStart_1(spirv_by_reference int _0, spirv_literal int _1); - -spirv_instruction(id = 257) -void livenessEnd_0(spirv_by_reference int _0, spirv_literal int _1); - -spirv_instruction(id = 257) -void livenessEnd_1(spirv_by_reference int _0[2], spirv_literal int _1); - -int calcThing_0(int offset_0) -{ - int another_0[2]; - livenessStart_0(another_0, 0); - another_0[0] = 1; - another_0[1] = 2; - int k_0; - livenessStart_1(k_0, 0); - k_0 = 0; - int total_0; - livenessStart_1(total_0, 0); - total_0 = 0; - for(;;) - { - if(k_0 < 20) - { - } - else - { - livenessEnd_0(k_0, 0); - break; - } - bool _S2 = (k_0 + 7) % 5 == 4; - int k_1 = k_0 + 1; - int i_0; - livenessStart_1(i_0, 0); - i_0 = 0; - for(;;) - { - if(i_0 < 17) - { - } - else - { - livenessEnd_0(i_0, 0); - break; - } - another_0[i_0 & 1] = another_0[i_0 & 1] + (k_0 + i_0); - i_0 = i_0 + 1; - } - livenessEnd_0(k_0, 0); - int _S3 = total_0; - livenessEnd_0(total_0, 0); - int total_1 = _S3 + another_0[k_0 & 1]; - if(_S2) - { - livenessEnd_1(another_0, 0); - return 1; - } - livenessStart_1(k_0, 0); - k_0 = k_1; - livenessStart_1(total_0, 0); - total_0 = total_1; - } - livenessEnd_1(another_0, 0); - if(total_0 > 4) - { - total_0 = - total_0; - } - else - { - } - return total_0; -} - -layout(local_size_x = 4, local_size_y = 1, local_size_z = 1) in; -void main() -{ - int index_0 = int(gl_GlobalInvocationID.x); - int _S4 = calcThing_0(index_0); - ((outputBuffer_0)._data[(uint(index_0))]) = _S4; - return; -} - -} diff --git a/tests/experimental/liveness/liveness-6.slang b/tests/experimental/liveness/liveness-6.slang deleted file mode 100644 index d124efd35..000000000 --- a/tests/experimental/liveness/liveness-6.slang +++ /dev/null @@ -1,47 +0,0 @@ -//TEST:SIMPLE:-target glsl -entry computeMain -profile cs_6_3 -track-liveness -line-directive-mode none - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer -RWStructuredBuffer<int> outputBuffer; - -// Test loop handling, with more complex structure -// More testing around liveness and loops. - -int calcThing(int offset) -{ - int total = 0; - int another[2] = { 1, 2}; - - for (int k = 0; k < 20; ++k) - { - int arr[2] = { 2, 3}; - - for (int i = 0; i < 17; ++i) - { - another[i & 1] += k + i; - arr[k & 1] += i; - } - - total += another[k & 1]; - total += arr[k & 1]; - - if ((k + 7) % 5 == 4) - { - return 1; - } - } - - if (total > 4) - { - total = -total; - } - - return total; -} - -[numthreads(4, 1, 1)] -void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) -{ - int index = int(dispatchThreadID.x); - - outputBuffer[index] = calcThing(index); -} diff --git a/tests/experimental/liveness/liveness-6.slang.expected b/tests/experimental/liveness/liveness-6.slang.expected deleted file mode 100644 index 1fe9408c8..000000000 --- a/tests/experimental/liveness/liveness-6.slang.expected +++ /dev/null @@ -1,107 +0,0 @@ -result code = 0 -standard error = { -} -standard output = { -#version 450 -#extension GL_EXT_spirv_intrinsics : require -layout(row_major) uniform; -layout(row_major) buffer; -layout(std430, binding = 0) buffer _S1 { - int _data[]; -} outputBuffer_0; -spirv_instruction(id = 256) -void livenessStart_0(spirv_by_reference int _0[2], spirv_literal int _1); - -spirv_instruction(id = 256) -void livenessStart_1(spirv_by_reference int _0, spirv_literal int _1); - -spirv_instruction(id = 257) -void livenessEnd_0(spirv_by_reference int _0, spirv_literal int _1); - -spirv_instruction(id = 257) -void livenessEnd_1(spirv_by_reference int _0[2], spirv_literal int _1); - -int calcThing_0(int offset_0) -{ - int another_0[2]; - livenessStart_0(another_0, 0); - another_0[0] = 1; - another_0[1] = 2; - int k_0; - livenessStart_1(k_0, 0); - k_0 = 0; - int total_0; - livenessStart_1(total_0, 0); - total_0 = 0; - for(;;) - { - if(k_0 < 20) - { - } - else - { - livenessEnd_0(k_0, 0); - break; - } - int arr_0[2]; - livenessStart_0(arr_0, 0); - arr_0[0] = 2; - arr_0[1] = 3; - int _S2 = k_0 & 1; - bool _S3 = (k_0 + 7) % 5 == 4; - int k_1 = k_0 + 1; - int i_0; - livenessStart_1(i_0, 0); - i_0 = 0; - for(;;) - { - if(i_0 < 17) - { - } - else - { - livenessEnd_0(i_0, 0); - break; - } - another_0[i_0 & 1] = another_0[i_0 & 1] + (k_0 + i_0); - arr_0[_S2] = arr_0[_S2] + i_0; - i_0 = i_0 + 1; - } - livenessEnd_0(k_0, 0); - int _S4 = total_0; - livenessEnd_0(total_0, 0); - int total_1 = _S4 + another_0[_S2]; - int _S5 = arr_0[_S2]; - livenessEnd_1(arr_0, 0); - int total_2 = total_1 + _S5; - if(_S3) - { - livenessEnd_1(another_0, 0); - return 1; - } - livenessStart_1(k_0, 0); - k_0 = k_1; - livenessStart_1(total_0, 0); - total_0 = total_2; - } - livenessEnd_1(another_0, 0); - if(total_0 > 4) - { - total_0 = - total_0; - } - else - { - } - return total_0; -} - -layout(local_size_x = 4, local_size_y = 1, local_size_z = 1) in; -void main() -{ - int index_0 = int(gl_GlobalInvocationID.x); - int _S6 = calcThing_0(index_0); - ((outputBuffer_0)._data[(uint(index_0))]) = _S6; - return; -} - -} diff --git a/tests/experimental/liveness/liveness-7.slang b/tests/experimental/liveness/liveness-7.slang deleted file mode 100644 index 1bf53b09d..000000000 --- a/tests/experimental/liveness/liveness-7.slang +++ /dev/null @@ -1,34 +0,0 @@ -//DISABLED_TEST:SIMPLE:-target glsl -entry computeMain -profile cs_6_3 -track-liveness -line-directive-mode none - -// This test is disabled because the loop will always be optimized out so no liveness info will be inserted. - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer -RWStructuredBuffer<int> outputBuffer; - -// Test loop handling, with more complex structure, and when code is unreachable -// More testing around liveness and loops. - -int calcThing(int offset) -{ - int arr[2] = { 2, 3}; - - for (int k = 0; k < 20; ++k) - { - if (((k + offset) & 1) != 0) - { - return arr[0]; - } - else - { - return arr[1]; - } - } -} - -[numthreads(4, 1, 1)] -void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) -{ - int index = int(dispatchThreadID.x); - - outputBuffer[index] = calcThing(index); -} diff --git a/tests/experimental/liveness/liveness-7.slang.expected b/tests/experimental/liveness/liveness-7.slang.expected deleted file mode 100644 index 52eafa5d1..000000000 --- a/tests/experimental/liveness/liveness-7.slang.expected +++ /dev/null @@ -1,66 +0,0 @@ -result code = 0 -standard error = { -} -standard output = { -#version 450 -#extension GL_EXT_spirv_intrinsics : require -layout(row_major) uniform; -layout(row_major) buffer; -spirv_instruction(id = 256) -void livenessStart_0(spirv_by_reference int _0, spirv_literal int _1); - -spirv_instruction(id = 257) -void livenessEnd_0(spirv_by_reference int _0, spirv_literal int _1); - -spirv_instruction(id = 256) -void livenessStart_1(spirv_by_reference int _0[2], spirv_literal int _1); - -spirv_instruction(id = 257) -void livenessEnd_1(spirv_by_reference int _0[2], spirv_literal int _1); - -int calcThing_0(int offset_0) -{ - const int _S1[2] = { 2, 3 }; - int k_0; - int _S2; - int arr_0[2]; - livenessStart_0(k_0, 0); - livenessEnd_0(k_0, 0); - k_0 = 0; - livenessStart_0(_S2, 0); - _S2 = offset_0; - livenessStart_1(arr_0, 0); - arr_0 = _S1; - for(;;) - { - int _S3 = _S2; - livenessEnd_0(_S2, 0); - if((0 + _S3 & 1) != 0) - { - int _S4[2] = arr_0; - livenessEnd_1(arr_0, 0); - return _S4[0]; - } - else - { - int _S5[2] = arr_0; - livenessEnd_1(arr_0, 0); - return _S5[1]; - } - } -} - -layout(std430, binding = 0) buffer _S6 { - int _data[]; -} outputBuffer_0; -layout(local_size_x = 4, local_size_y = 1, local_size_z = 1) in; -void main() -{ - int index_0 = int(gl_GlobalInvocationID.x); - uint _S7 = uint(index_0); - int _S8 = calcThing_0(index_0); - ((outputBuffer_0)._data[(_S7)]) = _S8; - return; -} - -} diff --git a/tests/experimental/liveness/liveness.slang b/tests/experimental/liveness/liveness.slang deleted file mode 100644 index a84cf268a..000000000 --- a/tests/experimental/liveness/liveness.slang +++ /dev/null @@ -1,80 +0,0 @@ -//TEST:SIMPLE:-target glsl -entry computeMain -profile cs_6_3 -track-liveness -line-directive-mode none - -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer -RWStructuredBuffer<int> outputBuffer; - -struct SomeStruct -{ - int a; - int x; - // Make it 'big' - int c[100]; -}; - -//TEST_INPUT:ubuffer(data=[1 4 27 17], stride=4):name anotherBuffer -RWStructuredBuffer<int> anotherBuffer; - -SomeStruct makeSomeStruct() -{ - SomeStruct s = {}; - return s; -} - -// A silly function that is in some sense 'slow' -int someSlowFunc(int a) -{ - uint v = a; - for (int i = 0; i < a * 20; ++i) - { - v = ((v >> 1) | (v << 31)) * i; - } - return int(v); -} - -int somethingElse(inout SomeStruct s) -{ - s.x ++; - return s.x; -} - -int doThing(SomeStruct s) -{ - return s.x * 2 + 1; -} - -[numthreads(4, 1, 1)] -void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) -{ - int index = int(dispatchThreadID.x); - - int res = index; - - for (int i = 0; i < index; ++i) - { - int v = someSlowFunc(index); // s mut not be considered live here. - - SomeStruct s; - SomeStruct t = makeSomeStruct(); - SomeStruct u = {}; - - if ((v & 0x100) != 0) - { - s.x = anotherBuffer[v & 3]; - t.x = anotherBuffer[v & 3]; - } - else - { - { - SomeStruct x = u; - x.x = anotherBuffer[v & 3] + 1; - u = x; - } - } - - s.c[index & 7]++; - - res += s.x + t.x + u.x + doThing(t) + somethingElse(t) + s.c[2]; - } - - outputBuffer[index] = res; -} diff --git a/tests/experimental/liveness/liveness.slang.expected b/tests/experimental/liveness/liveness.slang.expected deleted file mode 100644 index 8fa260ca5..000000000 --- a/tests/experimental/liveness/liveness.slang.expected +++ /dev/null @@ -1,168 +0,0 @@ -result code = 0 -standard error = { -} -standard output = { -#version 450 -#extension GL_EXT_spirv_intrinsics : require -layout(row_major) uniform; -layout(row_major) buffer; -layout(std430, binding = 1) buffer _S1 { - int _data[]; -} anotherBuffer_0; -layout(std430, binding = 0) buffer _S2 { - int _data[]; -} outputBuffer_0; -spirv_instruction(id = 256) -void livenessStart_0(spirv_by_reference uint _0, spirv_literal int _1); - -spirv_instruction(id = 256) -void livenessStart_1(spirv_by_reference int _0, spirv_literal int _1); - -spirv_instruction(id = 257) -void livenessEnd_0(spirv_by_reference int _0, spirv_literal int _1); - -spirv_instruction(id = 257) -void livenessEnd_1(spirv_by_reference uint _0, spirv_literal int _1); - -int someSlowFunc_0(int a_0) -{ - uint _S3 = uint(a_0); - int _S4 = a_0 * 20; - uint v_0; - livenessStart_0(v_0, 0); - v_0 = _S3; - int i_0; - livenessStart_1(i_0, 0); - i_0 = 0; - for(;;) - { - if(i_0 < _S4) - { - } - else - { - livenessEnd_0(i_0, 0); - break; - } - uint _S5 = v_0 >> 1; - uint _S6 = v_0; - livenessEnd_1(v_0, 0); - uint _S7 = uint(int(_S5 | _S6 << 31) * i_0); - int i_1 = i_0 + 1; - livenessStart_0(v_0, 0); - v_0 = _S7; - i_0 = i_1; - } - return int(v_0); -} - -struct SomeStruct_0 -{ - int a_1; - int x_0; - int c_0[100]; -}; - -SomeStruct_0 makeSomeStruct_0() -{ - const int _S8[100] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - SomeStruct_0 s_0 = { 0, 0, _S8 }; - return s_0; -} - -int doThing_0(SomeStruct_0 s_1) -{ - return s_1.x_0 * 2 + 1; -} - -int somethingElse_0(inout SomeStruct_0 s_2) -{ - int _S9 = s_2.x_0 + 1; - s_2.x_0 = _S9; - return _S9; -} - -spirv_instruction(id = 256) -void livenessStart_2(spirv_by_reference SomeStruct_0 _0, spirv_literal int _1); - -spirv_instruction(id = 257) -void livenessEnd_2(spirv_by_reference SomeStruct_0 _0, spirv_literal int _1); - -layout(local_size_x = 4, local_size_y = 1, local_size_z = 1) in; -void main() -{ - int index_0 = int(gl_GlobalInvocationID.x); - const int _S10[100] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - int _S11 = index_0 & 7; - uint _S12 = uint(index_0); - int i_2; - livenessStart_1(i_2, 0); - i_2 = 0; - int res_0; - livenessStart_1(res_0, 0); - res_0 = index_0; - for(;;) - { - if(i_2 < index_0) - { - } - else - { - livenessEnd_0(i_2, 0); - break; - } - int v_1 = someSlowFunc_0(index_0); - SomeStruct_0 s_3; - livenessStart_2(s_3, 0); - SomeStruct_0 t_0; - livenessStart_2(t_0, 0); - t_0 = makeSomeStruct_0(); - SomeStruct_0 u_0; - if((v_1 & 256) != 0) - { - uint _S13 = uint(v_1 & 3); - s_3.x_0 = ((anotherBuffer_0)._data[(_S13)]); - t_0.x_0 = ((anotherBuffer_0)._data[(_S13)]); - livenessStart_2(u_0, 0); - u_0.a_1 = 0; - u_0.x_0 = 0; - u_0.c_0 = _S10; - } - else - { - SomeStruct_0 x_1; - livenessStart_2(x_1, 0); - x_1.a_1 = 0; - x_1.x_0 = 0; - x_1.c_0 = _S10; - x_1.x_0 = ((anotherBuffer_0)._data[(uint(v_1 & 3))]) + 1; - SomeStruct_0 _S14 = x_1; - livenessEnd_2(x_1, 0); - livenessStart_2(u_0, 0); - u_0 = _S14; - } - s_3.c_0[_S11] = s_3.c_0[_S11] + 1; - int _S15 = s_3.x_0 + t_0.x_0; - SomeStruct_0 _S16 = u_0; - livenessEnd_2(u_0, 0); - int _S17 = _S15 + _S16.x_0 + doThing_0(t_0); - int _S18 = somethingElse_0(t_0); - livenessEnd_2(t_0, 0); - int _S19 = _S17 + _S18; - int _S20 = s_3.c_0[2]; - livenessEnd_2(s_3, 0); - int _S21 = _S19 + _S20; - int _S22 = res_0; - livenessEnd_0(res_0, 0); - int res_1 = _S22 + _S21; - i_2 = i_2 + 1; - livenessStart_1(res_0, 0); - res_0 = res_1; - } - int _S23 = res_0; - livenessEnd_0(res_0, 0); - ((outputBuffer_0)._data[(_S12)]) = _S23; - return; -} - -} diff --git a/tests/hlsl-intrinsic/debug-break.slang b/tests/hlsl-intrinsic/debug-break.slang index e46c42004..5c783f332 100644 --- a/tests/hlsl-intrinsic/debug-break.slang +++ b/tests/hlsl-intrinsic/debug-break.slang @@ -1,4 +1,4 @@ -//TEST:SIMPLE:-stage compute -entry computeMain -target glsl -line-directive-mode none +//TEST:SIMPLE(filecheck=CHECK):-stage compute -entry computeMain -target glsl -line-directive-mode none // We can't enable because output source includes path to prelude. //DISABLE_TEST:SIMPLE:-stage compute -entry computeMain -target cpp -line-directive-mode none //DISABLE_TEST:SIMPLE:-stage compute -entry computeMain -target cuda -line-directive-mode none @@ -10,6 +10,11 @@ //TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0 0 0 0 0], stride=4):out,name outputBuffer +// CHECK: spirv_instruction(id = 1, set = "NonSemantic.DebugBreak") +// CHECK: void debugBreak{{.*}}(); +// CHECK: void main +// CHECK: debugBreak{{.*}}(); + RWStructuredBuffer<int> outputBuffer; [numthreads(4, 1, 1)] diff --git a/tests/hlsl-intrinsic/debug-break.slang.expected b/tests/hlsl-intrinsic/debug-break.slang.expected deleted file mode 100644 index 503cdfd72..000000000 --- a/tests/hlsl-intrinsic/debug-break.slang.expected +++ /dev/null @@ -1,24 +0,0 @@ -result code = 0 -standard error = { -} -standard output = { -#version 450 -#extension GL_EXT_spirv_intrinsics : require -layout(row_major) uniform; -layout(row_major) buffer; -layout(std430, binding = 0) buffer _S1 { - int _data[]; -} outputBuffer_0; -spirv_instruction(id = 1, set = "NonSemantic.DebugBreak") -void debugBreak_0(); - -layout(local_size_x = 4, local_size_y = 1, local_size_z = 1) in; -void main() -{ - int idx_0 = int(gl_GlobalInvocationID.x); - debugBreak_0(); - ((outputBuffer_0)._data[(uint(idx_0))]) = idx_0; - return; -} - -} diff --git a/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-assign.slang.1.expected b/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-assign.slang.1.expected index 97b04be47..4338e70ac 100644 --- a/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-assign.slang.1.expected +++ b/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-assign.slang.1.expected @@ -36,8 +36,7 @@ void main() hitObjectNV hitObj_1; hitObjectRecordMissNV(hitObj_1, _S5, ray_0.Origin_0, ray_0.TMin_0, ray_0.Direction_0, ray_0.TMax_0); bool _S6 = (hitObjectIsMissNV((hitObj_1))); - uint _S7 = uint(int(_S6)); - ((outputBuffer_0)._data[(_S4)]) = _S7; + outputBuffer_0._data[_S4] = uint(int(_S6)); return; } diff --git a/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-make-hit.slang.1.expected b/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-make-hit.slang.1.expected index 0fd0214e4..199fdc86b 100644 --- a/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-make-hit.slang.1.expected +++ b/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-make-hit.slang.1.expected @@ -104,8 +104,7 @@ void main() hitObjectNV hitObj_1; hitObjectRecordHitNV(hitObj_1, scene_0, _S14, _S16, _S15, 0U, 0U, 4U, _S17.Origin_0, _S17.TMin_0, _S17.Direction_0, _S17.TMax_0, (0)); uint _S18 = calcValue_0(hitObj_1); - uint r_4 = r_3 + _S18; - ((outputBuffer_0)._data[(_S10)]) = r_4; + outputBuffer_0._data[_S10] = r_3 + _S18; return; } diff --git a/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-make-miss.slang.1.expected b/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-make-miss.slang.1.expected index c79c238e6..ed80f38d3 100644 --- a/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-make-miss.slang.1.expected +++ b/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-make-miss.slang.1.expected @@ -31,8 +31,7 @@ void main() hitObjectNV hitObj_0; hitObjectRecordMissNV(hitObj_0, _S2, ray_0.Origin_0, ray_0.TMin_0, ray_0.Direction_0, ray_0.TMax_0); bool _S3 = (hitObjectIsMissNV((hitObj_0))); - uint _S4 = uint(int(_S3)); - ((outputBuffer_0)._data[(_S2)]) = _S4; + outputBuffer_0._data[_S2] = uint(int(_S3)); return; } diff --git a/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-make-nop.slang.1.expected b/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-make-nop.slang.1.expected index 956dddad3..c8136645c 100644 --- a/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-make-nop.slang.1.expected +++ b/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-make-nop.slang.1.expected @@ -20,8 +20,7 @@ void main() hitObjectRecordEmptyNV((hitObj_0)); uint _S4 = uint(idx_0); bool _S5 = (hitObjectIsEmptyNV((hitObj_0))); - uint _S6 = uint(_S5); - ((outputBuffer_0)._data[(_S4)]) = _S6; + outputBuffer_0._data[_S4] = uint(_S5); return; } diff --git a/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-output.slang.1.expected b/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-output.slang.1.expected index f5e7908af..a6c28c86b 100644 --- a/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-output.slang.1.expected +++ b/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-output.slang.1.expected @@ -86,7 +86,7 @@ void main() hitObjectRecordMissNV(hitObj_1, idx_1, ray_2.Origin_0, ray_2.TMin_0, ray_2.Direction_0, ray_2.TMax_0); accumulate_0(r_0, hitObj_1); accumulate_0(r_0, hitObj_0); - ((outputBuffer_0)._data[(idx_1)]) = r_0; + outputBuffer_0._data[idx_1] = r_0; return; } diff --git a/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-reorder-thread.slang.1.expected b/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-reorder-thread.slang.1.expected index ae8efee2b..00213c62d 100644 --- a/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-reorder-thread.slang.1.expected +++ b/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-reorder-thread.slang.1.expected @@ -113,8 +113,7 @@ void main() otherValues_0.b_0 = _S12; HitObject_Invoke_0(scene_0, hitObj_0, otherValues_0); uint _S13 = calcValue_0(hitObj_0); - uint r_4 = r_3 + _S13; - ((outputBuffer_0)._data[(uint(idx_0))]) = r_4; + outputBuffer_0._data[uint(idx_0)] = r_3 + _S13; return; } diff --git a/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-trace-motion-ray.slang.1.expected b/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-trace-motion-ray.slang.1.expected index 89344c39a..535a7ccb7 100644 --- a/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-trace-motion-ray.slang.1.expected +++ b/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-trace-motion-ray.slang.1.expected @@ -83,7 +83,7 @@ void main() hitObjectTraceRayMotionNV(hitObj_0, scene_0, 20U, 255U, 0U, 4U, 0U, _S7.Origin_0, _S7.TMin_0, _S7.Direction_0, _S7.TMax_0, currentTime_0, (0)); uint _S8 = uint(idx_0); uint _S9 = calcValue_0(hitObj_0); - ((outputBuffer_0)._data[(_S8)]) = _S9; + outputBuffer_0._data[_S8] = _S9; return; } diff --git a/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-trace-ray.slang.1.expected b/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-trace-ray.slang.1.expected index 8fc6a1cf5..b1441df72 100644 --- a/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-trace-ray.slang.1.expected +++ b/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-trace-ray.slang.1.expected @@ -81,7 +81,7 @@ void main() hitObjectTraceRayNV(hitObj_0, scene_0, 20U, 255U, 0U, 4U, 0U, _S7.Origin_0, _S7.TMin_0, _S7.Direction_0, _S7.TMax_0, (0)); uint _S8 = uint(idx_0); uint _S9 = calcValue_0(hitObj_0); - ((outputBuffer_0)._data[(_S8)]) = _S9; + outputBuffer_0._data[_S8] = _S9; return; } diff --git a/tests/hlsl/glsl-matrix-layout.slang b/tests/hlsl/glsl-matrix-layout.slang new file mode 100644 index 000000000..6178cc813 --- /dev/null +++ b/tests/hlsl/glsl-matrix-layout.slang @@ -0,0 +1,67 @@ +// Test that storage type lowering correctly handles matrix layout modifiers. + +//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj -output-using-type -xslang -use-glsl-matrix-layout-modifier -xslang -fvk-use-gl-layout + +//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0 0 0 0 0 0 ], stride=4):out,name=outputBuffer +RWStructuredBuffer<float> outputBuffer; + +struct MyStruct +{ + // row_major here is flipped by the `-use-glsl-matrix-layout-modifier` compiler option so + // it actually means column_major here. + row_major float3x2 mat; + int otherVal[4]; + +} + +//TEST_INPUT: set gConst = cbuffer(data=[1.0 3.0 5.0 0.0 2.0 4.0 6.0 0.0 100 101 102 103]) +// gConst will be: +// -- -- +// | 1.0 2.0 | +// | 3.0 4.0 | +// | 5.0 6.0 | +// -- -- +ConstantBuffer<MyStruct> gConst; + +//TEST_INPUT: set gStructBuffer = ubuffer(data=[1.0 3.0 5.0 0.0 2.0 4.0 6.0 0.0 100 101 102 103 1.0 3.0 5.0 0.0 2.0 4.0 6.0 0.0 100 101 102 103]) +RWStructuredBuffer<MyStruct[2]> gStructBuffer; + +//TEST_INPUT: set gRawBuffer = ubuffer(data=[1.0 3.0 5.0 0.0 2.0 4.0 6.0 0.0 100 101 102 103]) +RWByteAddressBuffer gRawBuffer; + +[numthreads(1, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + { + float2 v = float2(2.0, 3.0); + float3 vm = mul(gConst.mat, v); + outputBuffer[0] = vm.x; // 8 + outputBuffer[1] = vm.y; // 18 + outputBuffer[2] = vm.z; // 28 + } + { + float2 v = float2(2.0, 3.0); + float3 vm = mul(gStructBuffer[0][0].mat, v); + outputBuffer[3] = vm.x; // 8 + outputBuffer[4] = vm.y; // 18 + outputBuffer[5] = vm.z; // 28 + } + { + float2 v = float2(2.0, 3.0); + float3 vm = mul(gRawBuffer.Load<MyStruct>(0).mat, v); + outputBuffer[6] = vm.x; // 8 + outputBuffer[7] = vm.y; // 18 + outputBuffer[8] = vm.z; // 28 + gRawBuffer.Store(0, gRawBuffer.Load<MyStruct>(0)); + vm = mul(gRawBuffer.Load<MyStruct>(0).mat, v); + outputBuffer[9] = vm.x; // 8 + outputBuffer[10] = vm.y; // 18 + outputBuffer[11] = vm.z; // 28 + } + + { + int original; + InterlockedAdd(gStructBuffer[0][0].otherVal[0], 1, original); + outputBuffer[12] = gStructBuffer[0][0].otherVal[0]; + } +} diff --git a/tests/hlsl/glsl-matrix-layout.slang.expected.txt b/tests/hlsl/glsl-matrix-layout.slang.expected.txt new file mode 100644 index 000000000..0c2522f4f --- /dev/null +++ b/tests/hlsl/glsl-matrix-layout.slang.expected.txt @@ -0,0 +1,14 @@ +type: float +8 +18 +28 +8 +18 +28 +8 +18 +28 +8 +18 +28 +101.0
\ No newline at end of file diff --git a/tests/spirv/spirv-debug-break.slang b/tests/spirv/spirv-debug-break.slang index 18e8c8597..e57024037 100644 --- a/tests/spirv/spirv-debug-break.slang +++ b/tests/spirv/spirv-debug-break.slang @@ -1,5 +1,5 @@ // spirv-instruction.slang -//TEST(compute, vulkan):SIMPLE:-target glsl -entry computeMain -stage compute +//TEST(compute, vulkan):SIMPLE(filecheck=CHECK):-target glsl -entry computeMain -stage compute [[vk::spirv_instruction(1, "NonSemantic.DebugBreak")]] void _spvDebugBreak(int v); @@ -7,6 +7,10 @@ void _spvDebugBreak(int v); [ForceInline] void _debugBreak() { _spvDebugBreak(1); } +// CHECK:spirv_instruction(id = 1, set = "NonSemantic.DebugBreak") +// CHECK:void _spvDebugBreak_0(int _0); +// CHECK:void main() +// CHECK:_spvDebugBreak_0(1); //TEST_INPUT:set resultBuffer = out ubuffer(data=[0 0 0 0], stride=4) RWStructuredBuffer<uint> resultBuffer; diff --git a/tests/spirv/spirv-debug-break.slang.expected b/tests/spirv/spirv-debug-break.slang.expected deleted file mode 100644 index 219aab7d2..000000000 --- a/tests/spirv/spirv-debug-break.slang.expected +++ /dev/null @@ -1,37 +0,0 @@ -result code = 0 -standard error = { -} -standard output = { -#version 450 -#extension GL_EXT_spirv_intrinsics : require -layout(row_major) uniform; -layout(row_major) buffer; - -#line 12 0 -layout(std430, binding = 0) buffer _S1 { - uint _data[]; -} resultBuffer_0; - -#line 5 -spirv_instruction(id = 1, set = "NonSemantic.DebugBreak") -void _spvDebugBreak_0(int _0); - - -#line 15 -layout(local_size_x = 4, local_size_y = 1, local_size_z = 1) in; -void main() -{ - -#line 17 - uint threadId_0 = gl_GlobalInvocationID.x; - - _spvDebugBreak_0(1); - - uint _S2 = threadId_0 + threadId_0; - -#line 21 - ((resultBuffer_0)._data[(threadId_0)]) = _S2; - return; -} - -} |
