summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2022-05-09 13:45:36 -0400
committerGitHub <noreply@github.com>2022-05-09 13:45:36 -0400
commit7a9bc08f3548fefeb54b907a5de301b90435f04a (patch)
treea41d5ac4017ef8d8fa703ca8ecb85d51e82831f5 /tests
parent117f5e554839efc13066517461eafaf8f2fd96c6 (diff)
Liveness pass fixes and improvements (#2225)
* #include an absolute path didn't work - because paths were taken to always be relative. * Fix for loops within dominator tree. Fix for functions that have no body. * Use a count array. Update some comments. * Special case handling of the root block, for searching for last access. * Enable liveness test with glsl output. Co-authored-by: Theresa Foley <10618364+tangent-vector@users.noreply.github.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/experimental/liveness/liveness.slang2
-rw-r--r--tests/experimental/liveness/liveness.slang.expected111
2 files changed, 62 insertions, 51 deletions
diff --git a/tests/experimental/liveness/liveness.slang b/tests/experimental/liveness/liveness.slang
index d7b7d6ab5..70a8c0a24 100644
--- a/tests/experimental/liveness/liveness.slang
+++ b/tests/experimental/liveness/liveness.slang
@@ -1,4 +1,4 @@
-//DISABLE_TEST:SIMPLE:-target hlsl -entry computeMain -profile cs_6_3 -track-liveness
+//TEST:SIMPLE:-target glsl -entry computeMain -profile cs_6_3 -track-liveness
//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer
RWStructuredBuffer<int> outputBuffer;
diff --git a/tests/experimental/liveness/liveness.slang.expected b/tests/experimental/liveness/liveness.slang.expected
index 21e162256..7cb39861c 100644
--- a/tests/experimental/liveness/liveness.slang.expected
+++ b/tests/experimental/liveness/liveness.slang.expected
@@ -2,27 +2,26 @@ result code = 0
standard error = {
}
standard output = {
-#ifdef SLANG_HLSL_ENABLE_NVAPI
-#include "nvHLSLExtns.h"
-#endif
+#version 450
+#extension GL_EXT_spirv_intrinsics : require
+layout(row_major) uniform;
+layout(row_major) buffer;
-#pragma pack_matrix(column_major)
-
-#line 24 "tests/experimental/liveness/liveness.slang"
+#line 24 0
int someSlowFunc_0(int a_0)
{
int i_0;
uint v_0;
#line 26
- uint _S1 = (uint) a_0;
- i_0 = int(0);
+ uint _S1 = uint(a_0);
+ i_0 = 0;
v_0 = _S1;
for(;;)
{
#line 27
- if(i_0 < a_0 * int(20))
+ if(i_0 < a_0 * 20)
{
}
else
@@ -31,17 +30,17 @@ int someSlowFunc_0(int a_0)
}
#line 29
- uint _S2 = (uint) ((int) ((bool) (v_0 >> int(1)) || (bool) (v_0 << int(31))) * i_0);
+ uint _S2 = uint(int(bool(v_0 >> 1) || bool(v_0 << 31)) * i_0);
#line 27
- int i_1 = i_0 + int(1);
+ int i_1 = i_0 + 1;
#line 27
i_0 = i_1;
v_0 = _S2;
}
- return (int) v_0;
+ return int(v_0);
}
@@ -50,58 +49,70 @@ struct SomeStruct_0
{
int a_1;
int x_0;
- int c_0[int(100)];
+ int c_0[100];
};
#line 17
SomeStruct_0 makeSomeStruct_0()
{
- int _S3[int(100)] = { int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0) };
+ const int _S3[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 };
#line 19
- SomeStruct_0 s_0 = { int(0), int(0), _S3 };
+ SomeStruct_0 s_0 = { 0, 0, _S3 };
return s_0;
}
#line 15
-RWStructuredBuffer<int > anotherBuffer_0 : register(u1);
-
+layout(std430, binding = 1) buffer _S4 {
+ int _data[];
+} anotherBuffer_0;
#line 40
int doThing_0(SomeStruct_0 s_1)
{
- return s_1.x_0 * int(2) + int(1);
+ return s_1.x_0 * 2 + 1;
}
#line 34
int somethingElse_0(inout SomeStruct_0 s_2)
{
- s_2.x_0 = s_2.x_0 + int(1);
+ s_2.x_0 = s_2.x_0 + 1;
return s_2.x_0;
}
#line 4
-RWStructuredBuffer<int > outputBuffer_0 : register(u0);
+layout(std430, binding = 0) buffer _S5 {
+ int _data[];
+} outputBuffer_0;
+
+#line 4
+spirv_instruction(id = 256)
+void livenessStart_0(spirv_by_reference SomeStruct_0 _0, int _1);
+
+
+#line 62
+spirv_instruction(id = 257)
+void livenessEnd_0(spirv_by_reference SomeStruct_0 _0, int _1);
#line 46
-[shader("compute")][numthreads(4, 1, 1)]
-void computeMain(uint3 dispatchThreadID_0 : SV_DISPATCHTHREADID)
+layout(local_size_x = 4, local_size_y = 1, local_size_z = 1) in;
+void main()
{
int i_2;
int res_0;
SomeStruct_0 u_0;
#line 48
- int index_0 = (int) dispatchThreadID_0.x;
+ int index_0 = int(gl_GlobalInvocationID.x);
- i_2 = int(0);
+ i_2 = 0;
res_0 = index_0;
for(;;)
{
@@ -121,26 +132,26 @@ void computeMain(uint3 dispatchThreadID_0 : SV_DISPATCHTHREADID)
SomeStruct_0 s_3;
#line 56
- SLANG_LIVE_START(s_3)
+ livenessStart_0(s_3, 0);
SomeStruct_0 t_0;
#line 57
- SLANG_LIVE_START(t_0)
+ livenessStart_0(t_0, 0);
#line 57
- SomeStruct_0 _S4 = makeSomeStruct_0();
+ SomeStruct_0 _S6 = makeSomeStruct_0();
#line 57
- t_0 = _S4;
- int _S5[int(100)] = { int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0), int(0) };
+ t_0 = _S6;
+ const int _S7[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 };
#line 58
- SomeStruct_0 u_1 = { int(0), int(0), _S5 };
+ SomeStruct_0 u_1 = { 0, 0, _S7 };
- if((bool) (v_1 & int(256)))
+ if(bool(v_1 & 256))
{
- s_3.x_0 = anotherBuffer_0[(uint) (v_1 & int(3))];
- t_0.x_0 = anotherBuffer_0[(uint) (v_1 & int(3))];
+ s_3.x_0 = ((anotherBuffer_0)._data[(uint(v_1 & 3))]);
+ t_0.x_0 = ((anotherBuffer_0)._data[(uint(v_1 & 3))]);
#line 60
u_0 = u_1;
@@ -152,51 +163,51 @@ void computeMain(uint3 dispatchThreadID_0 : SV_DISPATCHTHREADID)
SomeStruct_0 x_1;
#line 68
- SLANG_LIVE_START(x_1)
+ livenessStart_0(x_1, 0);
#line 68
x_1 = u_1;
- x_1.x_0 = anotherBuffer_0[(uint) (v_1 & int(3))] + int(1);
- SomeStruct_0 _S6 = x_1;
+ x_1.x_0 = ((anotherBuffer_0)._data[(uint(v_1 & 3))]) + 1;
+ SomeStruct_0 _S8 = x_1;
#line 70
- SLANG_LIVE_END(x_1)
+ livenessEnd_0(x_1, 0);
#line 60
- u_0 = _S6;
+ u_0 = _S8;
}
#line 74
- s_3.c_0[index_0 & int(7)] = s_3.c_0[index_0 & int(7)] + int(1);
+ s_3.c_0[index_0 & 7] = s_3.c_0[index_0 & 7] + 1;
- int _S7 = s_3.x_0 + t_0.x_0 + u_0.x_0;
+ int _S9 = s_3.x_0 + t_0.x_0 + u_0.x_0;
#line 76
- int _S8 = doThing_0(t_0);
+ int _S10 = doThing_0(t_0);
#line 76
- int _S9 = _S7 + _S8;
+ int _S11 = _S9 + _S10;
#line 76
- int _S10 = somethingElse_0(t_0);
+ int _S12 = somethingElse_0(t_0);
#line 76
- SLANG_LIVE_END(t_0)
+ livenessEnd_0(t_0, 0);
#line 76
- int _S11 = _S9 + _S10;
+ int _S13 = _S11 + _S12;
#line 76
- int _S12 = s_3.c_0[int(2)];
+ int _S14 = s_3.c_0[2];
#line 76
- SLANG_LIVE_END(s_3)
+ livenessEnd_0(s_3, 0);
#line 76
- int res_1 = res_0 + (_S11 + _S12);
+ int res_1 = res_0 + (_S13 + _S14);
#line 52
- int i_3 = i_2 + int(1);
+ int i_3 = i_2 + 1;
#line 52
i_2 = i_3;
@@ -204,7 +215,7 @@ void computeMain(uint3 dispatchThreadID_0 : SV_DISPATCHTHREADID)
}
#line 79
- outputBuffer_0[(uint) index_0] = res_0;
+ ((outputBuffer_0)._data[(uint(index_0))]) = res_0;
return;
}