Repository navigation
D3D12.X: charge the compute-blob budget once per cache entry - #826
mikebuckets171 wants to merge 1 commit into
Conversation
|
Verified on Windows 11 10.0.26300, NVIDIA GeForce RTX 5090 (driver 621.24), Rust 1.100.0 MSVC 14.44.35207, debug build, applied on That is one more passing test than AI-assisted (opencode): applied the patch to a built tree, ran the suite, restored the two files. |
|
Linux / AMD RDNA3 datapoint. Merged state: head Full suite, Not tested: retail titles (none here), Windows, RDNA4. Machine: RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting. |
|
Read of One sentence in the doc comment of AI use: Claude Code, Claude Sonnet 5.5, read the diff and checked it against |
keep_compute_blob checks compute_blob(key) and then inserts, two separate lock acquisitions: two xcl-pso workers can both pass the check for the same pipeline, both charge the COMPUTE_BLOBS_MAX total, and only one entry ends up in the map. The discarded charge is never taken back - forget_compute_blob subtracts only what the map holds - so the budget drifts upward with bytes the map never kept and later blobs of real programs are refused while memory is free. Insert through the entry API and charge a vacant key only, which keeps the total equal to what the map holds. insert_compute_blob is split out so the accounting is testable without a GPU; the new test is CPU-only.
5aa4c42 to
991b4da
Compare
|
@iggyvilla you are right and it is fixed: |
|
Premise re-checked against today's Since this was filed,
Host: macOS 27.2.1 (Apple silicon, M5 Pro), CrossOver 26, D3DMetal - the port-side tests behind this PR's |
What
keep_compute_blobcharges a driver blob's size to theCOMPUTE_BLOBS_MAXtotal and then inserts it.Two calls for the same key can pass the
compute_blob(key).is_some()guard above before either hasstored its result (the guard and the insert are not one step): both charge, only one entry ends up in
the map, and the discarded charge is never taken back —
forget_compute_blobsubtracts only what themap holds. The budget then drifts upward with bytes the map never kept, and later blobs of real
programs are refused while memory is free.
Insert through the entry API and charge a vacant key only.
insert_compute_blobis split out so theaccounting is testable without a GPU; the new test is CPU-only.
Size: +35 / −3, one file (
crates/xcl/src/hle/d3d12x/real.rs), one logical change.Note on ordering: #774 changes the call site around
keep_compute_blob(a refused driver blob going tothe big-compile queue). It does not touch the charge or the insert, so the two are independent, but
whichever lands first I will rebase onto.
Tested
x86_64-pc-windows-gnullvm(LLVM-MinGW 20261117 asthe linker):
mainate50836band this head — both green in 0.1–20 s incremental.to the module this patch is about:
compute_blob_tests→ 2 passed, 0 failed (the newtwo_results_for_one_key_charge_the_budget_once, which asserts that the second result for one keycharges nothing and that the first blob is the one kept, plus the existing key/forget test).
all in the GPU families this host is known for (the
v_*_f64programs and several graphics tests), thesame ones the other macOS reports in macOS (Apple Silicon, CrossOver + D3DMetal): the newer retail game reaches its first-run menus at 30 fps #258 name. None of them reach the code this patch changes; the
section that runs on the CPU passes.
xcl-smokepair from this bench (same title, same bottle, same sandbox, same DXC 1.9.2609, eachon a fresh data root), one on a commit of
main, one on this head:Read these as what they are: on this host they show that the head adds no device removals, no crashes and
no commit growth — not frame parity.
maincross-built for the Wine target does not reach a presentedframe at all (it stops ~1.8 s in with 0 presents and no PSO work;
mainhas no Mac host path yet), soboth sides of a
main-based Mac pair are 0 frames. The host where this title does run is @Ahmet-Dedeler'sMac port;
COMPUTE_BLOBSdoes not exist on that port's base, so there is no pair to take there for thispatch. The package is on a private drive, so its name is not put here.
asks for (quoted from their comments below, not run by this bench):
main@beaa245:cargo test --workspace -- --test-threads=4→ 738 passed, 0 failed, 41 ignored (one more passing test thanmainon thesame box).
x86_64-pc-windows-gnu, head onmain@a1672ef: 705 passed,11 failed, 41 ignored, the 11 being that host's known Wine-lane set, "nothing here fails because of
your change".
built again is vacant again and charged once, because
forget_compute_blobremoves and subtracts underone lock). It is corrected in
991b4da, which is why this head was re-pushed and its block re-run.Not tested
Windows
xcl-smokepair @Kalmarv offered in macOS (Apple Silicon, CrossOver + D3DMetal): the newer retail game reaches its first-run menus at 30 fps #258 (04:34) —mainand this head, same title and time, onan RTX 5070 Ti — is still to come.
compute work.
AI use