summaryrefslogtreecommitdiffstats
path: root/tests/compute
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2023-01-23 06:59:25 -0800
committerGitHub <noreply@github.com>2023-01-23 06:59:25 -0800
commit46a4d98baa1d43b33717b4377aefeeaf46b9c2ff (patch)
treec89f3a1c416330f859887d00f896b18bcc7488a5 /tests/compute
parent263ca18ea516cfce43fda703c0a411aaf1938e42 (diff)
Full address insts elimination for backward autodiff. (#2604)
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tests/compute')
-rw-r--r--tests/compute/half-texture.slang.glsl15
-rw-r--r--tests/compute/half-texture.slang.hlsl22
2 files changed, 21 insertions, 16 deletions
diff --git a/tests/compute/half-texture.slang.glsl b/tests/compute/half-texture.slang.glsl
index 88f585378..0eccccaaf 100644
--- a/tests/compute/half-texture.slang.glsl
+++ b/tests/compute/half-texture.slang.glsl
@@ -21,20 +21,23 @@ layout(std430, binding = 0) buffer _S1 {
int _data[];
} outputBuffer_0;
-layout(local_size_x = 4, local_size_y = 4, local_size_z = 1) in;void main()
+layout(local_size_x = 4, local_size_y = 4, local_size_z = 1) in;
+void main()
{
ivec2 pos_0 = ivec2(gl_GlobalInvocationID.xy);
const float _S2 = 1.00000000000000000000 / 3.00000000000000000000;
- ivec2 pos2_0 = ivec2(3 - pos_0.y, 3 - pos_0.x);
+ int _S3 = pos_0.y;
+ int _S4 = pos_0.x;
+ ivec2 pos2_0 = ivec2(3 - _S3, 3 - _S4);
float16_t h_0 = (float16_t(imageLoad((halfTexture_0), ivec2((uvec2(pos2_0)))).x));
f16vec2 h2_0 = (f16vec2(imageLoad((halfTexture2_0), ivec2((uvec2(pos2_0)))).xy));
f16vec4 h4_0 = (f16vec4(imageLoad((halfTexture4_0), ivec2((uvec2(pos2_0))))));
- imageStore((halfTexture_0), ivec2((uvec2(pos_0))), f16vec4(h2_0.x + h2_0.y, float16_t(0), float16_t(0), float16_t(0)));
- imageStore((halfTexture2_0), ivec2((uvec2(pos_0))), f16vec4(h4_0.xy, float16_t(0), float16_t(0)));
- imageStore((halfTexture4_0), ivec2((uvec2(pos_0))), f16vec4(h2_0, h_0, h_0));
+ imageStore((halfTexture_0), ivec2((uvec2(pos_0))), f16vec4(h2_0.x + h2_0.y, float16_t(0), float16_t(0), float16_t(0)));
+ imageStore((halfTexture2_0), ivec2((uvec2(pos_0))), f16vec4(h4_0.xy, float16_t(0), float16_t(0)));
+ imageStore((halfTexture4_0), ivec2((uvec2(pos_0))), f16vec4(h2_0, h_0, h_0));
- int index_0 = pos_0.x + pos_0.y * 4;
+ int index_0 = _S4 + _S3 * 4;
((outputBuffer_0)._data[(uint(index_0))]) = index_0;
return;
diff --git a/tests/compute/half-texture.slang.hlsl b/tests/compute/half-texture.slang.hlsl
index c606703a4..2d04ee17f 100644
--- a/tests/compute/half-texture.slang.hlsl
+++ b/tests/compute/half-texture.slang.hlsl
@@ -8,19 +8,21 @@ RWStructuredBuffer<int > outputBuffer_0 : register(u0);
[shader("compute")][numthreads(4, 4, 1)]
void computeMain(uint3 dispatchThreadID_0 : SV_DISPATCHTHREADID)
{
- int2 pos_0 = (int2) dispatchThreadID_0.xy;
+ int2 pos_0 = int2(dispatchThreadID_0.xy);
float _S1 = 1.00000000000000000000 / 3.00000000000000000000;
- int2 pos2_0 = int2(int(3) - pos_0.y, int(3) - pos_0.x);
+ int _S2 = pos_0.y;
+ int _S3 = pos_0.x;
+ int2 pos2_0 = int2(int(3) - _S2, int(3) - _S3);
- half h_0 = halfTexture_0[(uint2) pos2_0];
- vector<half,2> h2_0 = halfTexture2_0[(uint2) pos2_0];
- vector<half,4> h4_0 = halfTexture4_0[(uint2) pos2_0];
+ half h_0 = halfTexture_0[uint2(pos2_0)];
+ vector<half, 2> h2_0 = halfTexture2_0[uint2(pos2_0)];
+ vector<half, 4> h4_0 = halfTexture4_0[uint2(pos2_0)];
- halfTexture_0[(uint2) pos_0] = h2_0.x + h2_0.y;
- halfTexture2_0[(uint2) pos_0] = h4_0.xy;
- halfTexture4_0[(uint2) pos_0] = vector<half,4>(h2_0, h_0, h_0);
+ halfTexture_0[uint2(pos_0)] = h2_0.x + h2_0.y;
+ halfTexture2_0[uint2(pos_0)] = h4_0.xy;
+ halfTexture4_0[uint2(pos_0)] = vector<half, 4>(h2_0, h_0, h_0);
- int index_0 = pos_0.x + pos_0.y * int(4);
- outputBuffer_0[(uint) index_0] = index_0;
+ int index_0 = _S3 + _S2 * int(4);
+ outputBuffer_0[uint(index_0)] = index_0;
return;
}