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/experimental | |
| 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/experimental')
| -rw-r--r-- | tests/experimental/liveness/liveness-2.slang | 27 | ||||
| -rw-r--r-- | tests/experimental/liveness/liveness-2.slang.expected | 59 | ||||
| -rw-r--r-- | tests/experimental/liveness/liveness-3.slang | 49 | ||||
| -rw-r--r-- | tests/experimental/liveness/liveness-3.slang.expected | 134 | ||||
| -rw-r--r-- | tests/experimental/liveness/liveness-4.slang | 35 | ||||
| -rw-r--r-- | tests/experimental/liveness/liveness-4.slang.expected | 56 | ||||
| -rw-r--r-- | tests/experimental/liveness/liveness-5.slang | 42 | ||||
| -rw-r--r-- | tests/experimental/liveness/liveness-5.slang.expected | 98 | ||||
| -rw-r--r-- | tests/experimental/liveness/liveness-6.slang | 47 | ||||
| -rw-r--r-- | tests/experimental/liveness/liveness-6.slang.expected | 107 | ||||
| -rw-r--r-- | tests/experimental/liveness/liveness-7.slang | 34 | ||||
| -rw-r--r-- | tests/experimental/liveness/liveness-7.slang.expected | 66 | ||||
| -rw-r--r-- | tests/experimental/liveness/liveness.slang | 80 | ||||
| -rw-r--r-- | tests/experimental/liveness/liveness.slang.expected | 168 |
14 files changed, 0 insertions, 1002 deletions
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; -} - -} |
