Repository navigation
shader: extend mesh heap and scalar memory proofs (Part of #3703) - #3835
Conversation
lukaslw-lab
left a comment
There was a problem hiding this comment.
Reviewed 5feae82d (draft) by reading the diff; not built or run.
Verdict: approve. Each new RootBits step keeps ((root >> shift) & mask) + base exact, and the new scalar loads go through the existing bounded root and table paths. No MUST.
- SHOULD Run a before/after
m86census onf365f125for the real gain on the 544 + 77. Clearing provenance can expose the next wall, andv_readfirstlane_b32now forwards a root-derived source as-is under full EXEC (gfx1013_direct_mesh.inl:2455), so the census would also show any changed refusal. Follow-up is fine. - Checked, no finding:
- Operand order (
:235):v_lshrrev/v_lshlrevtake the shift fromsrc[0],v_bfe_u32its width fromsrc[2], and shift amounts use the low 5 bits. - Shifts, extracts and masks refuse a non-zero
base. OR counts as ADD only with no base and no shared mask bits. ADD requires a masked selector, andadd_slot_base(:229) keepsmask + basewithin the slot range. A scaled value accepts only a 32-byte-aligned ADD or OR. s_cselect/v_cndmaskand phi joins carry a proof only when both inputs have identical bits, so the selected value equals either one. Proofs come only from entry constants: loaded words are never added.- Root
s_load_dword*(:1736): the high half must match, and the folded constant offset then reaches the shared root path, which refuses spans over 64 KB and passes the span toroot_buffer_handle. A fixed-tables_load_dwordx4needs a 32-byte-aligned slot inside a declared range, with APPEND offsets resolved in order (:1762). - A heap fetch with an immediate offset adds
immediate >> 5slots to the selector and moves the symbolic word offsets back by the same bytes, so the descriptor words stay relative to the fetched record.
- Operand order (
Tests: native_mesh_heap_provenance_smem_ir (18 cases, 27 refusals) is in the pr filter.
7b1ec25 to
70d6687
Compare
There was a problem hiding this comment.
Re-review on 70d66873 (rebased on 5770f14e: vector_exec and uniform_alu_source from main).
Verdict: approve.
Census, same capture and method as before (6,685 distinct mesh programs), main 5770f14e vs this head:
| Programs | |
|---|---|
| Translate, main / with this PR | 1,047 / 1,047 |
| Lost / gained / first refusal moved | 0 / 0 / 0 |
Same as the earlier head. The range-diff against my reviewed head contains only main's renames. The heap-slot refusal is the first refusal of many programs here, but none of them moves.
Update: the first run was on a main that refused 257 programs early (my #3707, #3892; fixed by #3893). I reran main 5770f14e and this head, both with that fix: 0 moved, 0 lost, 0 gained. 544 programs stop first at the heap-slot refusal there, and none of them moves.
AI-assisted.
# Conflicts: # src/gfx1013_direct_mesh.inl
The full Texture1D descriptor path on main rebuilt only the mask from the root constant. Share selector lowering with typed buffer loads so the DXIL slot and the reported selector agree for shifted fields and immediate displacements.
|
Merged
Tests, Windows 11 26200 with RTX 5080 and WARP. The mesh filter was
All six mesh PRs (#3832, #3835, #3838, #3842, #3843 and #3846) were also merged together onto |
The shared graphics decoder can admit DLC and GLC for read-only scalar loads. Exercise a reserved bit in the address word so the refusal control checks unsupported addressing under either decoder policy.
|
#3833 allows DLC/GLC cache-policy bits on read-only scalar loads in the shared decoder, and mesh lowering uses that decoder. With both PRs merged, this PR's The control now uses a reserved SMEM address bit, which is refused with or without #3833, so it still checks that unsupported addressing fails closed. Tests on main
The RTX 5080 checks pass. |
R0Y00
left a comment
There was a problem hiding this comment.
Independently reviewed 705d91a. At joins the selector survives only when its reaching root and every selector field agree. The byte displacement is folded into the selector once, and the encoded offset and table range are checked before publishing. Built compile_dxil on MSVC Debug and ran ctest --preset dev --no-tests=error -j 1 --output-on-failure -R "^(native_mesh_heap_provenance_smem_ir|native_direct_mesh)$": 2/2 passed. Removing the immediate alignment test made unaligned-heap-immediate translate and failed the fixture. The restored head passed again. This is compiler IR/selector verification.
Extends mesh resource-heap root-constant provenance beyond #3719 (
"mesh heap slot lacks masked root constant provenance", 544 programs) and lowers verified root-SRV / fixed-tables_load_dword*scalar memory forms ("mesh scalar memory needs a verified guest root mapping: s_load_dwordx4", 77 programs) insrc/gfx1013_direct_mesh.inl.Part of #3703. Refs #3641, #3719.
(Opened as Draft per #3514 until an active review slot frees.)
Summary
src/gfx1013_direct_mesh.inl:RootBits(((root >> shift) & mask) + base) throughv_bfe_u32/s_bfe_u32,v_and_b32/s_and_b32(both operand orders),v_lshrrev_b32/s_lshr_b32,v_lshlrev_b32/s_lshl_b32,v_add_nc_u32/s_add_{u32,i32},v_or_b32/s_or_b32(disjoint bit add),s_mul_i32,v_readfirstlane_b32(at full EXEC),s_cselect_b32/v_cndmask_b32(identical proofs on both inputs), and CFGphijoins (matching proofs on both edges). Allows 4- and 8-dword typed heap fetches to fold aligned immediate byte offsets intoMeshHeapRead::base.s_load_dword*from verifiedSymbol::Type::root_addresspairs (with matching high half) at immediate or proven constant SGPR offsets, ands_load_dwordx4from declared root descriptor tables at aligned constant SGPR offsets validated against the table's descriptor ranges. Keeps GPU buffer words ineligible for CPU root-constant selectors and refuses unproven/unaligned/out-of-range offsets.tests/native_mesh_heap_provenance_smem_check.py+tests/cmake/native_mesh_heap_provenance_smem.cmake:native_mesh_heap_provenance_smem_ir(runs inprCTest preset): 18 accepted cases verified against selector reports and DXIL + 27 fail-closed refusal controls.Verification
Host: Windows 11 (
10.0.26200.9974), MSVC C++20/W4(zero warnings in edited lines). Baseorigin/mainf365f125.ctest --preset pr --no-tests=error -R "^native_mesh_heap_provenance_smem_ir$": 1/1 passed (18 positive + 27 refusals).dev) & Release (release): 3/3 passed in both configs (native_mesh_heap_provenance_smem_ir,native_direct_mesh,native_direct_container).tests/bidi_controls_check.py,tests/docs_links_check.py,git diff --check origin/main..HEAD: all clean.