CorrelatedValuePropagation generates illegal i10 integer width in DXIL
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 22/100
Research direction
The narrowing happens in the CorrelatedValuePropagation pass, so start with its implementation in the LLVM 3.7-based optimizer code under lib/Transforms, and compare it with the upstream fix referenced in the issue. The reproduction needs the modulo call from SobolSampling.hlsl (ModuloPreserveWidth with maxDim = 1024) compiled as a lib_6_3 ray generation shader with optimizations on. Done means that compile produces valid DXIL with no i10 types, and a regression test covers the narrowing case.
Written by the indexing model from the issue text.
Description
Description
DXC's CorrelatedValuePropagation optimization narrows integer types based on inferred value ranges, producing illegal DXIL types like i10.
We've been trying to add a workaround on our side but we really need this to be fixed properly. We are basically adding a dead branch returning 0xFFFFFFFF to prevent type narrowing - the compiler can't prove the branch is never taken, so the return type must remain i32.
This class of bug was fixed for LLVM's new DirectX backend in llvm PR#225233, but that fix doesn't apply to DXC's LLVM 3.7 fork.
Steps to Reproduce
Unity's SRP ray tracing shaders on Windows DX12:
- Shader:
DynamicGISkyOcclusion, entry pointMainRayGenShader - Public source: SobolSampling.hlsl
- Specifically, the
ModuloPreserveWidth(dim, maxDim)call wheremaxDim = 1024triggers the narrowing when compiled as a ray generation shader (lib_6_3 or higher) with optimizations enabled.
Actual Behavior
Shader compilation fails with DXIL validation error:
Int type 'i10' has an invalid width. at kernel MainRayGenShader (on dx12)
The optimizer's CorrelatedValuePropagation pass narrows dim % 1024 to 'i10' because the result range (0-1023) fits in 10 bits. DXIL only supports i1/i16/i32/i64, so validation rejects the i10.
Environment
- DXC version : 1.9.2609 (built from the main branch on September 21, 2026)
- Host Operating System : Windows, DX12
- Dominant language
- C++
- Stars
- 3.7k
- Forks
- 926
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 45
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/DirectXShaderCompiler
-
bug needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
microsoft/DirectXShaderCompiler#9173 ·
Maintainers usually reply within 2 days
-
bug needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
microsoft/DirectXShaderCompiler#9155 · 4 comments ·
Maintainers usually reply within 2 days
-
bug needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
microsoft/DirectXShaderCompiler#9135 ·
Maintainers usually reply within 2 days
-
DXC emits DW_LANG_C_plus_plus instead of DW_LANG_HLSL for HLSLPossibly taken @rj123-nv claimed this 18 days ago. Openbug needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
microsoft/DirectXShaderCompiler#9087 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
microsoft/DirectXShaderCompiler#9086 ·
Maintainers usually reply within 2 days
All issues in microsoft/DirectXShaderCompiler
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
table_translator 当一个 Prism 键映射到多个原码时,首个候选未按权重排序Possibly taken A pull request linked to this issue is open or already merged. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
feature:config kind:docs os:windows toolchain:cmake triaged
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
arch-based bug niri
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
noctalia-dev/noctalia#5552 ·
Maintainers usually reply within 1 day