d3d12: report whether table constant buffers are read at 16-byte offsets #561

Open
NickStallman wants to merge 1 commit from upstream-pr/561 into main
NickStallman commented 2026-11-29 23:31:40 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-11-29T23:31:40Z.


Refs #251 (announced on #533). Piece 1 of the stack; it stands alone and nothing uses it.

The host profile gains cbv-offset=exact|rounded|unknown, measured by reading a table CBV at offsets 0, 16, 32 and 48 through the D3D12 implementation in use, so the answer changes with the launcher's layer. TUXBOX_HOST_PROFILE=cbv-offset=... replaces it. Only reported; nothing chooses a path from it. It is measured only when logging is on. Native Windows isn't asked, because its runtime may remove the device over an unaligned view.

Tested

  • The host profile unit tests under Wine with no GPU; 2 mutations each fail one.

  • python tuxbox.py check --no-gpu passed on the whole stack (611a2fee); the full check below is this commit alone.

  • AMD iGPU (1002:13c0, RADV, GE-Proton11-14), on the stack this commit begins (611a2fee, which contains it): measures cbv-offset=exact; full check 201 pass, 0 fail.

  • RTX 5090 (10de:2b85, 620.70.10, GE-Proton11-14), same stack, raw views allowed by the test and the offsets not forced: the probe measures cbv-offset=rounded and the stack takes raw views; the raw-mode suites pass (52 of 52). The full check is 201 pass, 1 fail: translated-mesh hit its 45 s limit (36 of 152 fields in, all right) at load 15, and passes in 3 of 3 separate runs (load 11 to 15).

  • Full python tuxbox.py check of 7030aae2 (rebased onto e5d2e913; three checked casts and the reformat; 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.

Not run: start-up time, the game. From #552's numbers I expect an RTX 5090 to report rounded with stock settings and exact with the layer, and AMD exact.

  • Rebased onto 106120ca (859d9ab3). Upstream's doubles field now sits beside cbv-offset, which comes last in the profile line, and the test covers both. Under GE-Proton11-15: the host-profile unit tests under Wine, 8 of 8 pass. check --no-gpu passes 13 of 13. check --changed 106120ca: RTX 5090 (10de:2b85, 620.70.10) 16 passed, 0 failed. AMD iGPU (1002:13c0, RADV, Mesa 26.0.8): 15 passed, 1 failed. The failure is three Lanes selftests that fail the same way on main 106120ca on this card (#656):
lanes-selftest FAIL queue-page-mappings: copy ordered GPU mapping failed: 0x80004001
lanes-selftest FAIL queue-texture-boundary: map the texture tail failed: 0x80004001
lanes-selftest FAIL ray-tracing-rehydrate: map physical pages for the GPU failed: 0x80004001

Evidence: TuxBox check of 859d9ab37d, no uncommitted changes, no GPU checks: 13 passed, 0 failed, 0 not run
Evidence: TuxBox check of 859d9ab37d, no uncommitted changes, GPU 10de:2b85: 16 passed, 0 failed, 0 not run
Evidence: TuxBox check of 859d9ab37d, no uncommitted changes, GPU 1002:13c0: 15 passed, 1 failed, 0 not run

🤖 Generated with Claude Code

<!-- greyfinch-sync:brcly/TuxBox:issue:5556338031 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/561). Originally posted by [NickStallman](https://github.com/NickStallman) on 2026-11-29T23:31:40Z. --- Refs #251 (announced on #533). Piece 1 of the stack; it stands alone and nothing uses it. The host profile gains `cbv-offset=exact|rounded|unknown`, measured by reading a table CBV at offsets 0, 16, 32 and 48 through the D3D12 implementation in use, so the answer changes with the launcher's layer. `TUXBOX_HOST_PROFILE=cbv-offset=...` replaces it. Only reported; nothing chooses a path from it. It is measured only when logging is on. Native Windows isn't asked, because its runtime may remove the device over an unaligned view. ## Tested - The host profile unit tests under Wine with no GPU; 2 mutations each fail one. - `python tuxbox.py check --no-gpu` passed on the whole stack (611a2fee); the full check below is this commit alone. - AMD iGPU (`1002:13c0`, RADV, GE-Proton11-14), on the stack this commit begins (611a2fee, which contains it): measures `cbv-offset=exact`; full check 201 pass, 0 fail. - RTX 5090 (`10de:2b85`, 620.70.10, GE-Proton11-14), same stack, raw views allowed by the test and the offsets not forced: the probe measures `cbv-offset=rounded` and the stack takes raw views; the raw-mode suites pass (52 of 52). The full check is 201 pass, 1 fail: `translated-mesh` hit its 45 s limit (36 of 152 fields in, all right) at load 15, and passes in 3 of 3 separate runs (load 11 to 15). - Full `python tuxbox.py check` of 7030aae2 (rebased onto e5d2e913; three checked casts and the reformat; 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. **Not run:** start-up time, the game. From #552's numbers I expect an RTX 5090 to report `rounded` with stock settings and `exact` with the layer, and AMD `exact`. - Rebased onto `106120ca` (859d9ab3). Upstream's `doubles` field now sits beside `cbv-offset`, which comes last in the profile line, and the test covers both. Under GE-Proton11-15: the host-profile unit tests under Wine, 8 of 8 pass. `check --no-gpu` passes 13 of 13. `check --changed 106120ca`: RTX 5090 (`10de:2b85`, 620.70.10) 16 passed, 0 failed. AMD iGPU (`1002:13c0`, RADV, Mesa 26.0.8): 15 passed, 1 failed. The failure is three Lanes selftests that fail the same way on main `106120ca` on this card (#656): ```text lanes-selftest FAIL queue-page-mappings: copy ordered GPU mapping failed: 0x80004001 lanes-selftest FAIL queue-texture-boundary: map the texture tail failed: 0x80004001 lanes-selftest FAIL ray-tracing-rehydrate: map physical pages for the GPU failed: 0x80004001 ``` Evidence: TuxBox check of 859d9ab37d41, no uncommitted changes, no GPU checks: 13 passed, 0 failed, 0 not run Evidence: TuxBox check of 859d9ab37d41, no uncommitted changes, GPU 10de:2b85: 16 passed, 0 failed, 0 not run Evidence: TuxBox check of 859d9ab37d41, no uncommitted changes, GPU 1002:13c0: 15 passed, 1 failed, 0 not run 🤖 Generated with [Claude Code](https://claude.com/claude-code)
brcly commented 2026-11-30 04:12:08 +00:00 (Migrated from github.com)

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


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:7268559294 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/561#issuecomment-7268559294). Originally posted by [brcly](https://github.com/brcly) on 2026-11-30T04:12:08Z. --- 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:54:47 +00:00 (Migrated from github.com)

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


Thanks. Measuring what the driver does, rather than picking by vendor, is the right foundation for #251. I've just merged #552, and its numbers reproduce on an RTX 4070 Ti SUPER.

As you say, though, nothing uses this piece yet. It adds a probe at device creation (when logging is on) and one field in a log line. By itself that isn't something we'd merge, so I'm holding it until the piece that chooses a path from cbv-offset is ready. Then please open them together, or put this commit at the bottom of that PR, so we can judge the probe by what it decides. When you do, please include the startup cost of the probe on both cards, since it runs before the title gets its device.

<!-- greyfinch-sync:brcly/TuxBox:comment:7274854918 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/561#issuecomment-7274854918). Originally posted by [brcly](https://github.com/brcly) on 2026-11-30T09:54:47Z. --- Thanks. Measuring what the driver does, rather than picking by vendor, is the right foundation for #251. I've just merged #552, and its numbers reproduce on an RTX 4070 Ti SUPER. As you say, though, nothing uses this piece yet. It adds a probe at device creation (when logging is on) and one field in a log line. By itself that isn't something we'd merge, so I'm holding it until the piece that chooses a path from `cbv-offset` is ready. Then please open them together, or put this commit at the bottom of that PR, so we can judge the probe by what it decides. When you do, please include the startup cost of the probe on both cards, since it runs before the title gets its device.
brcly commented 2026-12-02 21:31:03 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by brcly on 2026-12-02T21:31:03Z.


Thanks, report-only with a full check on both vendors is what we want for piece 1. It now conflicts with main in runtime/d3d12/src/device/host_profile.rs, runtime/d3d12/src/tests/device/host_profile.rs and docs/USAGE.md (the host profile has gained fields since you branched). Could you rebase onto main? We'll merge once it's clean and CI is green.

<!-- greyfinch-sync:brcly/TuxBox:comment:7359390905 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/561#issuecomment-7359390905). Originally posted by [brcly](https://github.com/brcly) on 2026-12-02T21:31:03Z. --- Thanks, report-only with a full check on both vendors is what we want for piece 1. It now conflicts with main in `runtime/d3d12/src/device/host_profile.rs`, `runtime/d3d12/src/tests/device/host_profile.rs` and `docs/USAGE.md` (the host profile has gained fields since you branched). Could you rebase onto main? We'll merge once it's clean and CI is green.
NickStallman commented 2026-12-03 10:20:52 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-12-03T10:20:52Z.


Rebased onto 106120ca (859d9ab3). Upstream's doubles field and cbv-offset are both kept, with cbv-offset last in the profile line, and the test covers both. check --no-gpu passes 13 of 13 and the RTX 5090 check passes 16 of 16. On the AMD iGPU, the only failures are three Lanes selftests that fail the same way on main 106120ca on that card (#656). The details are in the description. I'll watch CI.

<!-- greyfinch-sync:brcly/TuxBox:comment:7375100411 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/561#issuecomment-7375100411). Originally posted by [NickStallman](https://github.com/NickStallman) on 2026-12-03T10:20:52Z. --- Rebased onto `106120ca` (859d9ab3). Upstream's `doubles` field and `cbv-offset` are both kept, with `cbv-offset` last in the profile line, and the test covers both. `check --no-gpu` passes 13 of 13 and the RTX 5090 check passes 16 of 16. On the AMD iGPU, the only failures are three Lanes selftests that fail the same way on main `106120ca` on that card (#656). The details are in the description. I'll watch CI.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/561:upstream-pr/561'
git switch 'upstream-pr/561'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/561'
git switch 'upstream-pr/561'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/561'
git switch 'upstream-pr/561'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/561'
git switch 'main'
git merge --squash 'upstream-pr/561'
git switch 'main'
git merge --ff-only 'upstream-pr/561'
git switch 'main'
git merge 'upstream-pr/561'
git push origin 'main'
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!561
No description provided.