Skip to content

[SimplifyCFG] Fix illegal-width bitmap from switch lookup table#8444

Open
damyanp wants to merge 1 commit into
microsoft:mainfrom
damyanp:8421
Open

[SimplifyCFG] Fix illegal-width bitmap from switch lookup table#8444
damyanp wants to merge 1 commit into
microsoft:mainfrom
damyanp:8421

Conversation

@damyanp
Copy link
Copy Markdown
Member

@damyanp damyanp commented May 12, 2026

SwitchLookupTable built bitmap APInts of width TableSize * ResultBitWidth, producing non-standard integer widths (i9, i17, i26, i33, i40, ...) that DXIL validation rejects - DXIL only allows i1/i8/i16/i32/i64.

Round the bitmap width up to a legal width, and cap the optimization at 32 bits to avoid silently promoting to i64 (which would set the Int64Ops shader flag and add a 64-bit-integer capability requirement the source shader did not have). Wider tables fall back to the array path, or - for i1 results - preserve the original switch.

Closes #8421

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

…osoft#8421)

SwitchLookupTable built bitmap APInts of width `TableSize * ResultBitWidth`,
producing non-standard integer widths (i9, i17, i26, i33, i40, ...) that
DXIL validation rejects - DXIL only allows i1/i8/i16/i32/i64.

Round the bitmap width up to a legal width, and cap the optimization at
32 bits to avoid silently promoting to i64 (which would set the Int64Ops
shader flag and add a 64-bit-integer capability requirement the source
shader did not have). Wider tables fall back to the array path, or - for
i1 results - preserve the original switch.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

Compilation failure in DXC 1.10.2605.2 about invalid width i26 Integers

1 participant