diff options
| author | Yong He <yonghe@outlook.com> | 2023-02-24 10:01:47 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-24 10:01:47 -0800 |
| commit | bd6306cdaa4a49344658bd026721b6532e103d09 (patch) | |
| tree | bb7f666d426e6cfc7777a3ccac0a1d628588eb39 /tests/pipeline | |
| parent | e8c08e7ecb1124f115a1d1042277776193122b57 (diff) | |
More control flow simplifications. (#2673)
* More control flow and Phi param simplifications.
* Fix.
* Fix gcc error.
* Fix.
* More IR cleanup.
* Fix bug in phi param dce + ifelse simplify.
* Propagate and DCE side-effect-free functions.
* Enhance CFG simplifcation to remove loops with no side effects.
* Fix.
* Fixes.
* Fix tests. Add [__AlwaysFoldIntoUseSite] for rayPayloadLocation.
* More cleanup.
* Fixes.
* Fix.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tests/pipeline')
5 files changed, 47 insertions, 169 deletions
diff --git a/tests/pipeline/rasterization/fragment-shader-interlock.slang.glsl b/tests/pipeline/rasterization/fragment-shader-interlock.slang.glsl index 84eba46f0..7f53576e9 100644 --- a/tests/pipeline/rasterization/fragment-shader-interlock.slang.glsl +++ b/tests/pipeline/rasterization/fragment-shader-interlock.slang.glsl @@ -1,10 +1,7 @@ -//TEST_IGNORE_FILE: - #version 450 #extension GL_ARB_fragment_shader_interlock : require layout(row_major) uniform; layout(row_major) buffer; - layout(rgba32f) layout(binding = 0) uniform image2D entryPointParams_texture_0; @@ -17,15 +14,12 @@ out vec4 _S2; void main() { - beginInvocationInterlockARB(); - - vec2 _S3 = _S1.xy; - - vec4 _S4 = (imageLoad((entryPointParams_texture_0), ivec2((uvec2(_S3))))); - imageStore((entryPointParams_texture_0), ivec2((uvec2(_S3))), _S4 + _S1); + beginInvocationInterlockARB(); + uvec2 _S3 = uvec2(_S1.xy); + vec4 _S4 = (imageLoad((entryPointParams_texture_0), ivec2((_S3)))); + imageStore((entryPointParams_texture_0), ivec2((_S3)), _S4 + _S1); endInvocationInterlockARB(); - _S2 = _S4; return; } diff --git a/tests/pipeline/rasterization/mesh/passing-outputs.slang.glsl b/tests/pipeline/rasterization/mesh/passing-outputs.slang.glsl index 31c2f0db2..1102a838e 100644 --- a/tests/pipeline/rasterization/mesh/passing-outputs.slang.glsl +++ b/tests/pipeline/rasterization/mesh/passing-outputs.slang.glsl @@ -160,16 +160,10 @@ void main() d_0(gl_LocalInvocationIndex); e_0(gl_LocalInvocationIndex); } - else - { - } if(gl_LocalInvocationIndex < 1U) { gl_PrimitiveTriangleIndicesEXT[gl_LocalInvocationIndex] = uvec3(0U, 1U, 2U); } - else - { - } return; } diff --git a/tests/pipeline/ray-tracing/acceleration-structure-in-compute.slang.glsl b/tests/pipeline/ray-tracing/acceleration-structure-in-compute.slang.glsl index f95321039..83797d2d5 100644 --- a/tests/pipeline/ray-tracing/acceleration-structure-in-compute.slang.glsl +++ b/tests/pipeline/ray-tracing/acceleration-structure-in-compute.slang.glsl @@ -1,6 +1,7 @@ #version 460 #extension GL_EXT_ray_tracing : require - +layout(row_major) uniform; +layout(row_major) buffer; int helper_0(accelerationStructureEXT a_0, int b_0) { return b_0; diff --git a/tests/pipeline/ray-tracing/trace-ray-inline.slang.glsl b/tests/pipeline/ray-tracing/trace-ray-inline.slang.glsl index 0364d2513..1c2bc8090 100644 --- a/tests/pipeline/ray-tracing/trace-ray-inline.slang.glsl +++ b/tests/pipeline/ray-tracing/trace-ray-inline.slang.glsl @@ -3,7 +3,6 @@ #extension GL_EXT_ray_query : require layout(row_major) uniform; layout(row_major) buffer; - struct SLANG_ParameterGroup_C_0 { vec3 origin_0; @@ -20,7 +19,6 @@ layout(std140) uniform _S1 { SLANG_ParameterGroup_C_0 _data; } C_0; - layout(binding = 0) uniform accelerationStructureEXT myAccelerationStructure_0; @@ -70,40 +68,32 @@ void myMiss_0(inout MyRayPayload_0 payload_4) layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void main() { + MyProceduralHitAttrs_0 committedProceduralAttrs_0; rayQueryEXT query_0; MyRayPayload_0 payload_5; payload_5.value_1 = -1; rayQueryInitializeEXT((query_0), (myAccelerationStructure_0), (C_0._data.rayFlags_0 | 512), (C_0._data.instanceMask_0), (C_0._data.origin_0), (C_0._data.tMin_0), (C_0._data.direction_0), (C_0._data.tMax_0)); - - MyProceduralHitAttrs_0 committedProceduralAttrs_0; - for(;;) { - bool _S2 = rayQueryProceedEXT(query_0); - if(!_S2) { break; } uint _S3 = (rayQueryGetIntersectionTypeEXT((query_0), false)); - switch(_S3) { case 1U: { MyProceduralHitAttrs_0 candidateProceduralAttrs_0; - candidateProceduralAttrs_0.value_0 = 0; float tHit_1 = 0.0; bool _S4 = myProceduralIntersection_0(tHit_1, candidateProceduralAttrs_0); - if(_S4) { bool _S5 = myProceduralAnyHit_0(payload_5); - if(_S5) { rayQueryGenerateIntersectionEXT(query_0, tHit_1); @@ -112,35 +102,22 @@ void main() { rayQueryTerminateEXT(query_0); } - else - { - } - committedProceduralAttrs_0 = _S6; - } else { - committedProceduralAttrs_0 = committedProceduralAttrs_0; - } - } else { - committedProceduralAttrs_0 = committedProceduralAttrs_0; - } - break; } case 0U: { - bool _S7 = myTriangleAnyHit_0(payload_5); - if(_S7) { rayQueryConfirmIntersectionEXT(query_0); @@ -148,12 +125,6 @@ void main() { rayQueryTerminateEXT(query_0); } - else - { - } - } - else - { } break; } @@ -162,13 +133,8 @@ void main() break; } } - - committedProceduralAttrs_0 = committedProceduralAttrs_0; - } - uint _S8 = (rayQueryGetIntersectionTypeEXT((query_0), true)); - switch(_S8) { case 1U: diff --git a/tests/pipeline/ray-tracing/trace-ray-inline.slang.hlsl b/tests/pipeline/ray-tracing/trace-ray-inline.slang.hlsl index 97d972328..b0c798b2d 100644 --- a/tests/pipeline/ray-tracing/trace-ray-inline.slang.hlsl +++ b/tests/pipeline/ray-tracing/trace-ray-inline.slang.hlsl @@ -1,11 +1,14 @@ -// trace-ray-inline.slang.hlsl -//TEST_IGNORE_FILE: +#pragma pack_matrix(column_major) +#ifdef SLANG_HLSL_ENABLE_NVAPI +#include "nvHLSLExtns.h" +#endif +#pragma warning(disable: 3557) struct SLANG_ParameterGroup_C_0 { - vector<float,3> origin_0; + float3 origin_0; float tMin_0; - vector<float,3> direction_0; + float3 direction_0; float tMax_0; uint rayFlags_0; uint instanceMask_0; @@ -16,7 +19,6 @@ cbuffer C_0 : register(b0) { SLANG_ParameterGroup_C_0 C_0; } - RaytracingAccelerationStructure myAccelerationStructure_0 : register(t0); struct MyProceduralHitAttrs_0 @@ -62,170 +64,92 @@ void myMiss_0(inout MyRayPayload_0 payload_4) return; } - -[shader("compute")] -[numthreads(1, 1, 1)] -void main(vector<uint,3> tid_0 : SV_DISPATCHTHREADID) +[shader("compute")][numthreads(1, 1, 1)] +void main(uint3 tid_0 : SV_DISPATCHTHREADID) { - MyRayPayload_0 payload_5; MyProceduralHitAttrs_0 committedProceduralAttrs_0; - MyProceduralHitAttrs_0 committedProceduralAttrs_1; - MyRayPayload_0 payload_6; - MyProceduralHitAttrs_0 committedProceduralAttrs_2; - MyRayPayload_0 payload_7; - MyProceduralHitAttrs_0 committedProceduralAttrs_3; RayQuery<int(512) > query_0; - MyRayPayload_0 _S1 = { int(-1) }; + MyRayPayload_0 payload_5; + payload_5.value_1 = int(-1); RayDesc ray_0 = { C_0.origin_0, C_0.tMin_0, C_0.direction_0, C_0.tMax_0 }; query_0.TraceRayInline(myAccelerationStructure_0, C_0.rayFlags_0, C_0.instanceMask_0, ray_0); - - MyProceduralHitAttrs_0 _S2; - - payload_5 = _S1; - committedProceduralAttrs_0 = _S2; for(;;) { - bool _S3 = query_0.Proceed(); - - if(!_S3) + bool _S1 = query_0.Proceed(); + if(!_S1) { break; } - uint _S4 = query_0.CandidateType(); - - switch(_S4) + uint _S2 = query_0.CandidateType(); + switch(_S2) { - case (uint) int(1): + case 1U: { - MyProceduralHitAttrs_0 candidateProceduralAttrs_0 = { int(0) }; - - float _S5; - - _S5 = 0.00000000000000000000; - - MyProceduralHitAttrs_0 _S6; - - _S6 = candidateProceduralAttrs_0; - - bool _S7 = myProceduralIntersection_0(_S5, _S6); - - float tHit_1 = _S5; - - MyProceduralHitAttrs_0 candidateProceduralAttrs_1 = _S6; - - if(_S7) + MyProceduralHitAttrs_0 candidateProceduralAttrs_0; + candidateProceduralAttrs_0.value_0 = int(0); + float tHit_1 = 0.0; + bool _S3 = myProceduralIntersection_0(tHit_1, candidateProceduralAttrs_0); + if(_S3) { - MyRayPayload_0 _S8; - - _S8 = payload_5; - - bool _S9 = myProceduralAnyHit_0(_S8); - - MyRayPayload_0 _S10 = _S8; - - if(_S9) + bool _S4 = myProceduralAnyHit_0(payload_5); + if(_S4) { query_0.CommitProceduralPrimitiveHit(tHit_1); - - if((bool) C_0.shouldStopAtFirstHit_0) + MyProceduralHitAttrs_0 _S5 = candidateProceduralAttrs_0; + if(C_0.shouldStopAtFirstHit_0 != 0U) { - query_0.Abort(); } - else - { - } - - committedProceduralAttrs_1 = candidateProceduralAttrs_1; + committedProceduralAttrs_0 = _S5; } else { - committedProceduralAttrs_1 = committedProceduralAttrs_0; + committedProceduralAttrs_0 = committedProceduralAttrs_0; } - - payload_6 = _S10; - committedProceduralAttrs_2 = committedProceduralAttrs_1; } else { - payload_6 = payload_5; - committedProceduralAttrs_2 = committedProceduralAttrs_0; + committedProceduralAttrs_0 = committedProceduralAttrs_0; } - - payload_7 = payload_6; - committedProceduralAttrs_3 = committedProceduralAttrs_2; break; } - case (uint) int(0): + case 0U: { - MyRayPayload_0 _S11; - _S11 = payload_5; - - bool _S12 = myTriangleAnyHit_0(_S11); - MyRayPayload_0 _S13 = _S11; - - if(_S12) + bool _S6 = myTriangleAnyHit_0(payload_5); + if(_S6) { query_0.CommitNonOpaqueTriangleHit(); - if((bool) C_0.shouldStopAtFirstHit_0) + if(C_0.shouldStopAtFirstHit_0 != 0U) { query_0.Abort(); } - else - { - } - } - else - { } - - payload_7 = _S13; - committedProceduralAttrs_3 = committedProceduralAttrs_0; break; } default: { - payload_7 = payload_5; - committedProceduralAttrs_3 = committedProceduralAttrs_0; break; } } - - payload_5 = payload_7; - committedProceduralAttrs_0 = committedProceduralAttrs_3; } - - uint _S14 = query_0.CommittedStatus(); - - switch(_S14) + uint _S7 = query_0.CommittedStatus(); + switch(_S7) { - case (uint) int(1): + case 1U: { - MyRayPayload_0 _S15; - - _S15 = payload_5; - - myTriangleClosestHit_0(_S15); + myTriangleClosestHit_0(payload_5); break; } - case (uint) int(2): + case 2U: { - - MyRayPayload_0 _S16; - _S16 = payload_5; - - myProceduralClosestHit_0(_S16, committedProceduralAttrs_0); + myProceduralClosestHit_0(payload_5, committedProceduralAttrs_0); break; } - case (uint) int(0): + case 0U: { - MyRayPayload_0 _S17; - - _S17 = payload_5; - - myMiss_0(_S17); + myMiss_0(payload_5); break; } default: @@ -233,6 +157,5 @@ void main(vector<uint,3> tid_0 : SV_DISPATCHTHREADID) break; } } - return; } |
