The dxil-resource-access pass does not account for the case when a phi node of a resource handle is generated through optimizations (eg GVN) or for dynamic indices into a unique global resource.
This results in a convergent operation being moved through control flow illegally as described below:
For subgroup_uniform_control_flow.test
https://hlsl.godbolt.org/z/jcToeTv8q
Looking at the IR between DXC and Clang it appears Clang has performed an illegal optimization. It hoisted and duplicated the final WaveActiveMax into two operations in both the if (label 11) and else (label 19) blocks of the top-level if statement. This is not a legal optimization for a convergent operation, and is the likely cause of the issue.
The
dxil-resource-accesspass does not account for the case when a phi node of a resource handle is generated through optimizations (eg GVN) or for dynamic indices into a unique global resource.This results in a convergent operation being moved through control flow illegally as described below:
For subgroup_uniform_control_flow.test
https://hlsl.godbolt.org/z/jcToeTv8q
Looking at the IR between DXC and Clang it appears Clang has performed an illegal optimization. It hoisted and duplicated the final WaveActiveMax into two operations in both the if (label 11) and else (label 19) blocks of the top-level if statement. This is not a legal optimization for a convergent operation, and is the likely cause of the issue.