Direct DXIL: enforce byte-buffer bounds across memory windows #1737
No reviewers
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!1737
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1737"
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?
@Ariyo31 on GitHub · 2026-11-24 20:03 UTC · original
Ariyo31:fix/direct-dxil-buffer-bounds→main· +149 −22 · 6 files · 1 commits · draftImprove direct DXIL buffer bounds checking and reduce the cost of narrow buffer loads.
Part of #1269.
What is in it
Tested
Both targeted regression cases failed before the patch and passed after it. All 251,904 synthetic output checks matched the CPU reference.
Test command:
cargo test --release --workspace --no-fail-fast -- --nocapture --test-threads=1Regression run
Main: Pending.
PR: Pending.
Known limitations
The OOB_SELECT and SOFFSET concerns raised during review remain under investigation. This patch does not yet implement complete descriptor-correct bounds checking.
Not tested
AI use
OpenAI Codex (GPT-6.2-Astra and GPT-6.2-Sol) assisted with implementation, regression testing, benchmarking, upstream compatibility checks and PR preparation.
@ddaikodaiko on GitHub · 2026-11-24 20:11 UTC · original
One thing to decide before this lands:
buffer_bytes_in_rangeis applied inside the oldstride == 0choice, and that choice is not the rule the console descriptor gives:The HLSL path already reads
OOB_SELECTfrom V# word 3 [29:28] (BT-002, merged): mode 0 isindex < N && offset + bytes <= STRIDE, mode 1index < N, mode 2N != 0, mode 3 (raw)offset + soffset + bytes <= N. Withstride == 0as the selector, a descriptor in mode 0/1/2 is judged by a bound that is not its own, and in raw mode the check here still missessoffset:offisvoff + OFFSET, so a carry fromsoffset(which is added into the address but not into this check) is invisible even on one window. Your 64-bit carry check catches theoff/bytesoverflow but not that one.So either:
buffer_bytes_in_rangetakessoffand theOOB_SELECTvalue and picks the four checks, orIf it helps: an unverified fork branch has the BT-002 port for the direct translator (
ddaikodaiko/xclcontrib/mubuf-oob0643c46), and it rewrites this same closure, so the two will conflict when both exist; the measured rule and the 732 native cases behind it are in the BT-002 report on #1488.AI use: written with OpenCode (DeepSeek V4.1 Flash); a person submitting any of this is responsible for running it.
@Ariyo31 on GitHub · 2026-11-24 20:16 UTC · original
Review the new comment from ddaikodaiko on xcl-dev/xcl PR #1737.
Investigate the OOB_SELECT and SOFFSET concerns against the merged BT-002 behavior in the HLSL backend and issue #1488.
Decide whether to:
Inspect the suggested fork branch for context, but independently verify the logic. Avoid copying unverified implementation.
Add targeted tests for each OOB_SELECT mode, SOFFSET carry and 32-bit overflow. Preserve our existing regressions and benchmarks.
Report your recommended solution and test results before pushing further changes. Do not reply on GitHub or push without my permission.
@Raghav314 on GitHub · 2026-11-24 20:48 UTC · original
Retail-pack A/B of #1737 on NVIDIA Windows: −2 % DXIL, −9 % driver time on the direct form, no failures. Counts and timings only.
Setup: RTX 4090 24 GB, driver 617.14, Windows 11, DXC 1.8.2502.11, release. Two binaries that differ only by this PR:
main6c89285(this PR's base) and this PR's head0c6b681, each with the same timing harness (xcl shaders --time-forms, branch, described on #1745). Retail 1.0.2.1 pack: 40 compute programs spread over the size range plus the 10 largest, split wave64, 4 windows. #1426's per-instruction form translated, then made into a compute pipeline one at a time, with the driver's shader cache off for the process (ShaderCacheControl). Driver builds capped at 1 MB of DXIL, so the largest programs give sizes only. First row dropped as driver warm-up.mainNot tested: correctness of the output on the GPU (no title run, no output comparison), the bounds-check behaviour itself, AMD, the full suite.
AI use: Claude Code (Claude Opus 5.5) built both binaries, ran the measurements and drafted this.
@Ariyo31 on GitHub · 2026-11-24 20:52 UTC · original
Thank you for taking the time to benchmark my PR on real retail shaders! It's great to see a consistent 9% reduction in driver compilation time.
I'm still looking into the bounds-checking concerns raised earlier. I really appreciate the independent testing and feedback.
@FIJI1299 on GitHub · 2026-11-24 21:11 UTC · original
Working fine on 5070.
0c6b681)rustc 1.100.0, debug build.\scripts\test.ps1(cargo test --workspace -- --test-threads=4)814 passed; 0 failed; 22 ignored(14.07s)822 passed; 0 failed; 34 ignored@DavidM1911 on GitHub · 2026-11-24 22:43 UTC · original
Verification on RTX 3060 Ti (Windows 11): merge conflict with current
main— needs a rebase before it can be tested.@Toons29 on GitHub · 2026-11-25 03:35 UTC · original
Regression run of
0c6b681aon the retail title, for this PR's Regression run section. Both blocks are fromscripts/smoke.ps1as printed, not edited:mainon4178e888, this PR on its head commit with no uncommitted changes, same title and time.Against the limits in CONTRIBUTING.md: 101 % of
main's frames, 100 % of its peak commit, no crash, no device removal.AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0,
cargo build --release -p xcl, 60 s,XCL_NETWORK=0. This is a regression check only: it does not show whether the run reaches the code this PR changes.AI use: Claude Code (Claude Opus 5.5) built both trees and ran
scripts/smoke.ps1; I checked the blocks before posting.View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.