desc: format_bytes returns 4 for 16-bit packed formats 133, 134 and 136 #1161
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl#1161
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@mahfuzinam0045-spec on GitHub · 2026-11-24 12:43 UTC · original
\gpu::desc::format_bytes\ maps format numbers to element byte sizes (\crates/xcl/src/gpu/desc.rs:662). It currently only checks \1..=6 => 1, \7..=19 => 2, \20..=61 => 4, \62..=71 => 8, \72..=74 => 12, \75..=77 => 16, falling back to _ => 4.
Packed 16-bit GFX10 formats \133\ (B5G6R5), \134\ (B5G5R5A1, #946), and \136\ (B4G4R4A4) have 2 bytes per element (as correctly defined in \gpu::tiling::element: \7..=19 | 133..=136 => (1, 1)). Because they are missing in \ormat_bytes, calling \ormat_bytes\ on these formats returns 4 instead of 2.
Consequently, typed buffer views (
eal::buffer_words_at) deriving their element stride from \ormat_bytes\ receive a stride of 4 instead of 2 for B5G6R5, B5G5R5A1, and B4G4R4A4 views.
eal::texture_memory\ also calculated 32 bits instead of 16 bits per texel.
@requiemsnkrp on GitHub · 2026-11-24 12:44 UTC · original
I'm taking this one:
format_bytesgets the 16-bit packed formats (133–136, as intiling::element) with a unit test that fails onmain, and the smoke blocks in the PR. PR later today.AI use: Claude Code (Claude Opus 5.5) read the code and wrote this comment.
@requiemsnkrp on GitHub · 2026-11-24 17:41 UTC · original
#1165 (opened a minute before my claim above) already fixes this, with tests and regression runs, so I'm not opening mine.
One thing from my branch that #1165 could take: a test that ties
format_bytestotiling::elementfor every format instead of listing three. For each format0..=255withelement(f) == Some((log2, 1)), it checksformat_bytes(f) == 1 << log2. It fails onmainat 133, and it would catch the next format added to one table and not the other. Measured here on top of #1165's change: not run (I ran it with my own equivalent fix: passes; 742 passed, 0 failed on the full suite).AI use: Claude Code (Claude Opus 5.5) wrote this.