tooling: prove bounded DXIL heap-index expressions in mesh86_cache #3890
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!3890
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3888"
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?
@Leyukaka on GitHub · 2026-12-02 20:39 UTC · original
Leyukaka:takeover/3608→main· +120 −11 · 2 files · 2 commits · openTakes over #3610 (original commits by @Asimmimx kept unchanged). Supersedes #3610. Refs #3547, #3543. Target
main.Problem
tools/startup/mesh86_cache.py(_heap_index_range) only accepts a constant slot oradd (UMin(%x, C)), FIRSTwhen it proves a slot 86--heap-bufferwindow. DXC emits other bounded forms, and publication refuses them:UMin(zero base) and the commutedUMin(C, x);x & maskandbase + (x & mask), which DXC lowers toand+orwhen the bits are disjoint;select i1 %cond, i32 a, i32 b;clampasUMin(UMax(..))orUMax(UMin(..));zext i1 %cond to i32added to a base.#3610 fixes this but conflicts with
mainsince #3640, and two robustness points from its review were still open.Change
96ece7eccdc1b0c5b, rebased; author, date and message unchanged9df97999e96ece7eccreplaces the two-pattern matcher with an inclusive u32 interval evaluator (_u32_range) over constants,UMin/UMax, overflow-checkedadd,and,or,select i1andzext i1. Unbounded values, a wrappingadd, a bareUMax, aselectwith an unbounded arm, cyclic definitions and ranges outside[first, first + count)are still refused.Rebase. The commit is line-by-line identical to #3610 except for its 14 new test cases, which take the 5-tuple shape
mainnow uses ("f32"for a success,Nonefor a refusal).main's read-type check from #3640, the stage-visibility andconstants-onlyproof for wide legacy heap roots, and the Texture1D profile are unchanged. The overflow (wrap_add) and out-of-window (outside,selected_outside,masked_outside) controls are kept.9df97999eaddresses the two points from mumba17's review of #3610:mesh86_cache.py:178), so a chain that reuses an operand is evaluated in linear time. A definition that is still being evaluated reads as unbounded, so a cycle is refused as before; the cache can only lose precision, never accept an unbounded index._RANGE_DEPTH_MAX,mesh86_cache.py:161,176) raisesValueError, whichmain()already reports as a refusal, instead of aRecursionErrortraceback.Four cases pin this:
shared operand(accepted as0..8in a 9-slot window),shared operand outside(refused in an 8-slot window),shared operand overflow(a 40-line self-add chain, 2**40 evaluations without the cache, refused) anddeep chain(1,500 lines, refused withdeeper than 128 definitions).The diff against
mainis 2 files, +120 -11.Verification
Windows, MSVC,
devpreset, tested at the same content on base1e2b0d524; the branch was then rebased onto currentmain, which has not touched either file since. GPU tests run serially.Result: 9/9 passed.
runtime_mesh86_cache_cli_checkstartup_indirect_mesh_cache_heap_warp,startup_indirect_mesh_cache_heap_hardwarestartup_indirect_mesh_cache_heap_wide_warp,startup_indirect_mesh_cache_heap_wide_hardwarestartup_indirect_mesh_cache_texture_map_warp,startup_indirect_mesh_cache_texture_map_hardwarestartup_indirect_mesh_cache_constants_wide_warp,startup_indirect_mesh_cache_constants_wide_hardwareNotes
_heap_index_range(index, defs)keeps its signature and(low, high)return. Only the refusal text changes, to... neither a constant nor a bounded window expression.dxc -T ps_6_6compilation listed in #3610 was not repeated here; the cases are synthetic DXIL text dumps.@R0Y00 on GitHub · 2026-12-02 20:53 UTC · original · reviewed
Independently reviewed
9df97999. Memoization removes repeated evaluation within one interval proof, and cyclic/deep definitions stay on the refusal path. The unsigned endpoint rules preserve overflow and window checks. MSVC Debugctest --preset dev --no-tests=error -j 1 --output-on-failure -R '^(runtime_mesh86_cache_cli_check|startup_indirect_mesh_cache_(heap(_wide)?|texture_map|constants_wide)_(warp|hardware))$'passed 9/9 on Windows 11 build 26300, WARP 10.0.26100.9818 and RTX 4060 Laptop 32.0.16.1656. The CLI cases cover shared subexpressions, depth, cycles, overflow and a too-small window. The original PR's landing choice with @Asimmimx is pending.@R0Y00 on GitHub · 2026-12-03 06:32 UTC · original
I reviewed
9df97999eand ranpython -B tests/startup_mesh86_cache_cli_check.pyon that exact head. All six CLI tests passed, including the shared-operand window boundaries, wrapping addition, and the 1,500-definition depth refusal. The branch also merges cleanly withmainat09ff8edec, and the three required CI jobs passed. I’ll leave the takeover pending Asimmimx’s reply on #3610 so we keep one PR for this change.@R0Y00 on GitHub · 2026-12-03 08:38 UTC · original · approved these changes
Technical approval for
9df97999e. The exact-head startup_mesh86_cache_cli_check.py passed all six tests, including overflow refusal, the shared operand at a window boundary, and the oversized definition chain. The memo stores conservative unsigned intervals and rejects out-of-window ranges; required CI passed. The landing choice with the original #3610 is still pending Asimmimx's response.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.