Encountered this issue when running the the LongVector derivative tests in ExecHLSLTests, so marking it as SM6.9 despite it reproducing with SM66
DXC's optimizer sinks ddx/ddy calls into conditional branches when the result is only used inside that branch. This breaks quad semantics when only one lane executes the conditional branch - derivatives require all 4 lanes to participate.
Impact: Derivatives return 0 instead of correct values.
Affected: ddx, ddy, ddx_fine, ddy_fine, ddx_coarse, ddy_coarse in compute shaders (SM 6.6+).
Repros for both vector and scalar cases.
Also impacts other wave ops.
Steps to Reproduce
SM66 Scalar repro: https://godbolt.org/z/PMK9EoTnK
SM69 Vector repro: https://godbolt.org/z/xv4e5hjrx
Actual Behavior
ddx sunk into conditional branch only executed by lane 3, not all 4 lanes.
Environment
- DXC version dxcompiler.dll: 1.10 - 1.8.0.15125 (main, aa9b462); dxil.dll: 1.10(1.8.0.15125)
- Host Operating System Microsoft Windows [Version 10.0.19045.5011]
Encountered this issue when running the the LongVector derivative tests in ExecHLSLTests, so marking it as SM6.9 despite it reproducing with SM66
DXC's optimizer sinks
ddx/ddycalls into conditional branches when the result is only used inside that branch. This breaks quad semantics when only one lane executes the conditional branch - derivatives require all 4 lanes to participate.Impact: Derivatives return 0 instead of correct values.
Affected:
ddx,ddy,ddx_fine,ddy_fine,ddx_coarse,ddy_coarsein compute shaders (SM 6.6+).Repros for both vector and scalar cases.
Also impacts other wave ops.
Steps to Reproduce
SM66 Scalar repro: https://godbolt.org/z/PMK9EoTnK
SM69 Vector repro: https://godbolt.org/z/xv4e5hjrx
Actual Behavior
ddx sunk into conditional branch only executed by lane 3, not all 4 lanes.
Environment