Repository navigation
Conversation
DenRakEiw
left a comment
There was a problem hiding this comment.
Verified locally merged onto origin/main (940d32f, Windows 11 x64, NVIDIA GeForce RTX 5090 + WARP, Rust 1.98.1 MSVC, with dxil.dll validator):
cargo test -p victory-shader --lib emit::memory_tests::— 5 passed, 0 failed on both RTX 5090 hardware andVICTORY_D3D12_WARP=1(including the new code-table buffer load tests)cargo clippy -p victory-shader --all-targets— 0 warningscargo xtask policy— ok (183 files ok)
Clean lowering for buffer loads reading from a constant table embedded in the program's code, verified end-to-end on hardware and WARP. Looks good.
AI-assisted (Gemini 4 Neon).
|
Triage verdict — Keep the VMEM code-table path, cover unaligned subword reads ( Evidence
Checks and limits
Next step
This verification was AI-assisted. |
Offline measurement on a retail dumpResult: no count change against I merged head 0077404 onto No program changes its failure reason. The count shows that the change rejects nothing on this data. It does not show whether the output is right. No shader names or data are included, per the asset policy. AI-assisted (Claude Code). |
|
Automated triage for the maintainers. Merge candidate. On your replies: the boundary fix and the file-size correction match the diff; thanks for the follow-up. Generated by Claude Code |
A buffer load through a descriptor built around s_getpc_b64 was refused
("a descriptor built around a table in the code"), though scalar and
global loads of the same tables already read them. Read the dwords from
the code too, at base + offsets + index * stride, and give 0 where the
descriptor's range check (OOB_SELECT 1-3) puts the access out of range,
per dword for multi-dword loads. Stores, atomics, typed loads, swizzled
descriptors and OOB_SELECT 0 stay refused.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… next dword A halfword load at the last byte of a dword took the shifted aligned dword alone, so its high byte came out 0. It now ORs in the next dword's low byte. The fixture adds a signed halfword at byte 3, which fails without the change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
0077404 to
b6d6be6
Compare
|
Rebased onto A halfword at byte 3 of a dword now reads both bytes it spans: its high byte comes from the next dword. It ORs in The fixture adds Also dropped the comment's attribution of the
AI-assisted (Claude Code). |
With current main, lower.rs went past the 512 KiB file limit `cargo xtask policy` enforces. The code-table load moves unchanged into its own module. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Correction to the comment above: AI-assisted (Claude Code). |
…the program's code # Conflicts: # crates/victory-shader/src/emit/lower.rs # crates/victory-shader/src/emit/memory_tests.rs
…the program's code # Conflicts: # crates/victory-shader/src/emit/lower.rs # crates/victory-shader/src/emit/memory_tests.rs
fuzeofficlal
left a comment
There was a problem hiding this comment.
Reviewed 36d0a303dd670928f9c82e09136a92bbc32fbd36 (merged cleanly onto 63bcca43) and verified on Windows 11 with an RTX 5090, WARP, dxil.dll, and VICTORY_D3D12_DEBUG=1.
Moving the VMEM code-table load helper into emit/lower/code_table.rs keeps emit/lower.rs growth small (521,884 B, 2,404 B under the 512 KiB cap), cleanly separates descriptor base (base + extra) from instruction offsets (off + index * stride), and handles unaligned split 16-bit halfword shifts ((next << 1) << (31 - sh)) without shifting by 32.
Non-blocking follow-up notes:
- In
OOB_SELECT = 3,lower.rs:9438-9463folds*offset,OFFEN, andSOFFSETwith 32-bitBin::Addbeforecode_table_buffer_load, so a wrapping combination like VGPR offset0xffff_fffc+SOFFSET = 4arrives as0and bypasses the unsignedIULEcheck; preserving carry or checking components separately would close that wraparound edge case. - Adding tests for
OOB_SELECT = 2(empty and non-emptyNUM_RECORDS), dynamic descriptor base, and an explicit error when aCODEleaf appears inside aPhi/Selectwould broaden coverage further.
Verification
xtask policy(192 files ok),cargo clippy(default &--all-features) clean,code_table.rsrustfmt-clean.- RTX 5090 + WARP +
dxil.dll+VICTORY_D3D12_DEBUG=1:code_table_buffer_loads_lowerandcode_table_buffer_loads_read_zeros_out_of_range(2/2 passed),emit::census_tests(1/1 passed), and the remainingemit::memory_tests(6/6 passed, skipping the pre-existingmain#2571crash inheap_direct_texture_reads_mark_their_heap_index).
Claimed in #1633 (claim).
Problem
A
buffer_load_*through a V# whose base is built arounds_getpc_b64(a constant table after the program's code) is refused:a descriptor built around a table in the code is not supported. #815 lists 20 upscaler compute programs failing on it. Scalar loads (s_buffer_load_dword*) andglobal_load_*of the same kind of table already read it throughcode_dword; only the VMEM buffer form falls through tohandle().Change
In
Lower::buffer, a load whose source is aSource::Builtdescriptor withaddress.param == CODEreads its dwords withcode_dword, at base +offset+offenVGPR +soffset+ (idxen? index × stride : 0), and extracts bytes/halfwords asflat()does. Out of range, it reads 0, per the V#'sOOB_SELECT(dword 3 bits 28-29):index >= num_recordsnum_records == 0offset + soffset + size > num_records, each dword of a multi-dword load checked on its own;index * stridemoves the address but is not checkedThese are the rules measured on RDNA2 (gfx1036) and RDNA1 (gfx1011) hardware by the Leonida project (its
docs/buffer_bounds.md, 732 cases; they match Mesa's GFX11 column ofac_descriptors.c, withsoffsetcounted), which this tree already cites for other measurements.code_dwordalone clamps to the table, which is not what the hardware returns.Still refused, each with its own reason: stores, atomics and typed loads of a code table; swizzled V#s or
ADD_TID_ENABLE;OOB_SELECT0 (whether the instruction offset counts in its stride check is unmeasured).Tested
Intel UHD Graphics (driver 31.0.101.4146), RTX 4050 Laptop (595.97) and WARP, Windows 11.
emit::memory_tests::code_table_buffer_loads_lower: the hand-assembled program decodes to the expected text, lowers and validates; anOOB_SELECT0 V# is refused. Onmain940d32f this test fails with the refusal above.emit::memory_tests::code_table_buffer_loads_read_zeros_out_of_range: 32 lanes read a 64-dword table afters_endpgm, compared per lane with a CPU model:buffer_load_dword offen(lanes 29+ read 0),buffer_load_ubyte offen offset:1(lanes 30+, so the size counts),buffer_load_dwordx2withsoffset4 (lane 27 gets one dword and a 0), andbuffer_load_dword idxen offset:4with stride 8 and 21 records (lanes 21+). Passes on all three adapters (the RTX 4050 through a local, uncommitted switch of the test host to the high-performance adapter). With the zeroing turned off it fails.cargo test -p victory-shader --libon the Intel UHD: 240 passed, 9 failed;maingives 238 passed and the same 9 failures (all covered by other open PRs; see Test report: Intel UHD (Raptor Lake Xe-LP), 70564ae: victory-shader 201 passed, 8 failed (3 missing-feature skips, 5 different results) #1829).cargo clippy -p victory-shader --all-targets -- -D warnings, with and without--all-features: clean.rustfmt --check: no diffs in the new hunks.cargo xtask policy: ok.Not run: the title or the #815 programs themselves, and AMD hardware. The console part (gfx1013) is unmeasured; the rules hold on gfx1011 and gfx1036.
AI-assisted (Claude Code).
🤖 Generated with Claude Code