d3d12: log what indirect mesh records hold #568

Closed
NickStallman wants to merge 1 commit from upstream-pr/568 into main
NickStallman commented 2026-11-30 03:57:51 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-11-30T03:57:51Z.


Log-only, for anyone chasing mesh-draw losses (#232). Refs #533 (claimed there). It has run twice on a GPU, in cpu mode.

Records of indirect mesh draws go to the host unbounded (indirect.rs execute_indirect checks only that the buffer range fits), while the direct dispatch_mesh checks the 65,535-per-dimension and 2^22 limits. I don't know that the title ever writes one out of range.

What it does. With TUXBOX_TRACE_MESH_RECORDS, it logs histograms of X, Y, Z per pipeline, stride and MaxCommandCount, out-of-range and all-ones counts, the first raw records, and the kinds in batches not seen complete at a device loss. 1 copies records after each draw, before ahead of it, cpu reads title memory once the batch has run and records no GPU work. Off, nothing is recorded.

What it would show: Y or Z of 0, or an over-limit or all-ones count, would be a credible fault cause; a run through the loss with all three at zero, and little unread, would be evidence against it. 1 and before break the host render pass and add barriers around each traced draw, so a run that doesn't fault in those modes says nothing; repeat it with cpu.

Existing evidence, weakly against: an earlier trace of ours in eight runs had 89,452 ring entries, none out of range, and 137 GPU copies with Y = Z = 1. Those cover only the first 13,000 or so draws.

Result of two runs on an RTX 5090 10de:2b85, 620.70.10, GE-Proton11-14, cpu mode. In the second the GPU was lost about 11 minutes into the world (Xid 13) while the records were being read: 393,498 of 211 kinds, none unread and none clipped, Y and Z 1 in every one, X at most 923, nothing out of range, all ones or odd, including the batches in flight at the loss. The first (84a, no loss, 216,633 records) says the same. So the records aren't the cause of that loss, at least as the title's memory held them when read; cpu mode reads title memory after the batch, which a later write could have changed.

Tested

  • 12 unit tests, one on a device (llvmpipe); python tuxbox.py check --no-gpu passed (10 of 10). The submit hook and the reading thread haven't been run.

  • Not run: AMD in the game. At most 256 records per execution are copied; beyond that is counted as clipped.

  • Full python tuxbox.py check of 568d3a8c (rebased onto e5d2e913; no change in behaviour): RTX 5090 (10de:2b85, 620.70.10) 200 pass, 0 fail; AMD iGPU (1002:13c0, RADV) 199 pass, 0 fail. GE-Proton11-14.

Evidence: TuxBox check of 568d3a8c5c, no uncommitted changes, GPU 10de:2b85: 16 passed, 0 failed, 0 not run
Evidence: TuxBox check of 568d3a8c5c, no uncommitted changes, GPU 1002:13c0: 16 passed, 0 failed, 0 not run

🤖 Generated with Claude Code

<!-- greyfinch-sync:brcly/TuxBox:issue:5558707024 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/568). Originally posted by [NickStallman](https://github.com/NickStallman) on 2026-11-30T03:57:51Z. --- Log-only, for anyone chasing mesh-draw losses (#232). Refs #533 (claimed there). It has run twice on a GPU, in `cpu` mode. Records of indirect mesh draws go to the host unbounded (`indirect.rs` `execute_indirect` checks only that the buffer range fits), while the direct `dispatch_mesh` checks the 65,535-per-dimension and 2^22 limits. I don't know that the title ever writes one out of range. **What it does.** With `TUXBOX_TRACE_MESH_RECORDS`, it logs histograms of X, Y, Z per pipeline, stride and MaxCommandCount, out-of-range and all-ones counts, the first raw records, and the kinds in batches not seen complete at a device loss. `1` copies records after each draw, `before` ahead of it, `cpu` reads title memory once the batch has run and records no GPU work. Off, nothing is recorded. **What it would show:** Y or Z of 0, or an over-limit or all-ones count, would be a credible fault cause; a run through the loss with all three at zero, and little unread, would be evidence against it. `1` and `before` break the host render pass and add barriers around each traced draw, so a run that doesn't fault in those modes says nothing; repeat it with `cpu`. **Existing evidence, weakly against:** an earlier trace of ours in eight runs had 89,452 ring entries, none out of range, and 137 GPU copies with Y = Z = 1. Those cover only the first 13,000 or so draws. **Result of two runs on an RTX 5090 `10de:2b85`, 620.70.10, GE-Proton11-14, `cpu` mode.** In the second the GPU was lost about 11 minutes into the world (Xid 13) while the records were being read: 393,498 of 211 kinds, none unread and none clipped, Y and Z 1 in every one, X at most 923, nothing out of range, all ones or odd, including the batches in flight at the loss. The first (84a, no loss, 216,633 records) says the same. So the records aren't the cause of that loss, at least as the title's memory held them when read; `cpu` mode reads title memory after the batch, which a later write could have changed. ## Tested - 12 unit tests, one on a device (llvmpipe); `python tuxbox.py check --no-gpu` passed (10 of 10). The submit hook and the reading thread haven't been run. - **Not run:** AMD in the game. At most 256 records per execution are copied; beyond that is counted as clipped. - Full `python tuxbox.py check` of 568d3a8c (rebased onto e5d2e913; no change in behaviour): RTX 5090 (`10de:2b85`, 620.70.10) 200 pass, 0 fail; AMD iGPU (`1002:13c0`, RADV) 199 pass, 0 fail. GE-Proton11-14. Evidence: TuxBox check of 568d3a8c5ce3, no uncommitted changes, GPU 10de:2b85: 16 passed, 0 failed, 0 not run Evidence: TuxBox check of 568d3a8c5ce3, no uncommitted changes, GPU 1002:13c0: 16 passed, 0 failed, 0 not run 🤖 Generated with [Claude Code](https://claude.com/claude-code)
brcly commented 2026-11-30 04:12:03 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by brcly on 2026-11-30T04:12:03Z.


Heads-up: main just landed a large cleanup (up to e5d2e913), so this PR needs a rebase.

  • Formatting: the whole workspace is now formatted with rustfmt (see the new rustfmt.toml).
  • Lints: every crate denies unwrap(), lossy as casts and undocumented unsafe outside tests.
  • CI: it now also runs cargo fmt --check, rustdoc with warnings denied, and Miri on the providers' unit tests.

The least painful way is to format your branch first, so the rebase only shows real changes:

git fetch origin
git checkout origin/main -- rustfmt.toml
cargo fmt --all && git commit -am "rustfmt"
git rebase origin/main

Then run python tuxbox.py check --no-gpu, which now includes the format step.

If clippy flags something new:

  • A cast: use From for widening, TryFrom for narrowing, and a mask for bit fields.
  • An unwrap(): use ?, or expect with the reason it can't fail.
  • An unsafe block: it needs a // SAFETY: comment.

CONTRIBUTING's "Code checks" section lists the commands. Thanks!

<!-- greyfinch-sync:brcly/TuxBox:comment:7268558078 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/568#issuecomment-7268558078). Originally posted by [brcly](https://github.com/brcly) on 2026-11-30T04:12:03Z. --- Heads-up: main just landed a large cleanup (up to e5d2e913), so this PR needs a rebase. - **Formatting:** the whole workspace is now formatted with rustfmt (see the new `rustfmt.toml`). - **Lints:** every crate denies `unwrap()`, lossy `as` casts and undocumented `unsafe` outside tests. - **CI:** it now also runs `cargo fmt --check`, rustdoc with warnings denied, and Miri on the providers' unit tests. The least painful way is to format your branch first, so the rebase only shows real changes: ```sh git fetch origin git checkout origin/main -- rustfmt.toml cargo fmt --all && git commit -am "rustfmt" git rebase origin/main ``` Then run `python tuxbox.py check --no-gpu`, which now includes the format step. If clippy flags something new: - **A cast:** use `From` for widening, `TryFrom` for narrowing, and a mask for bit fields. - **An `unwrap()`:** use `?`, or `expect` with the reason it can't fail. - **An `unsafe` block:** it needs a `// SAFETY:` comment. CONTRIBUTING's "Code checks" section lists the commands. Thanks!
brcly commented 2026-11-30 09:33:36 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by brcly on 2026-11-30T09:33:36Z.


Thanks, this was useful work: it answered its question. In your runs the result was negative, which rules this theory out for #232.

That's also why I'm holding it rather than merging. On main it would be about 1,100 lines plus hooks in a hot path (the submit path), for a diagnostic that has already said what it can and that nobody needs right now. The branch keeps it available: anyone chasing #232 can merge it locally, and if a new loss points back at this, we'll merge it then.

Feel free to turn it into a draft so it stays findable. I'll leave it open.

<!-- greyfinch-sync:brcly/TuxBox:comment:7274373887 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/568#issuecomment-7274373887). Originally posted by [brcly](https://github.com/brcly) on 2026-11-30T09:33:36Z. --- Thanks, this was useful work: it answered its question. In your runs the result was negative, which rules this theory out for #232. That's also why I'm holding it rather than merging. On main it would be about 1,100 lines plus hooks in a hot path (the submit path), for a diagnostic that has already said what it can and that nobody needs right now. The branch keeps it available: anyone chasing #232 can merge it locally, and if a new loss points back at this, we'll merge it then. Feel free to turn it into a draft so it stays findable. I'll leave it open.
NickStallman commented 2026-12-01 14:50:22 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-12-01T14:50:22Z.


Closing: it answered its question with a negative result for #232, and the hot-path diagnostics aren't wanted on main. The branch stays available if it's needed again.

<!-- greyfinch-sync:brcly/TuxBox:comment:7314911436 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/568#issuecomment-7314911436). Originally posted by [NickStallman](https://github.com/NickStallman) on 2026-12-01T14:50:22Z. --- Closing: it answered its question with a negative result for #232, and the hot-path diagnostics aren't wanted on main. The branch stays available if it's needed again.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
brcly/TuxBox!568
No description provided.