Skip to content

docs/fspx: device slot 57's description, measured over 10,000 calls (RT-5) - #8273

Open
ruvenesh wants to merge 1 commit into
ItsNotRexed:mainfrom
ruvenesh:gee/fspx-slot57-layout
Open

ruvenesh wants to merge 1 commit into
ItsNotRexed:mainfrom
ruvenesh:gee/fspx-slot57-layout

Conversation

@ruvenesh

Copy link
Copy Markdown

Claimed in #8047 (comment) (device slot 57, exotiquee's finding); the measurement is posted at #8047 (comment).

Depends on: nothing (docs only; applies to main).

What and why

docs/fspx.md documents slot 67's description (compute) but not slot 57, which the retail executable calls about 10,000 times at boot with nothing serving it. This adds a "Slot 57 (graphics)" paragraph and table: the description is a root-signature pointer plus six (pointer, size) pairs, and the programs in pairs 2 and 4 pass the bare kind-6 rule already in this file. It also says what a handler would still need (translated library graphics programs, the state blob decoded), so the next person does not have to repeat the measurement.

Counts and sizes only: no bytes, addresses, hashes or offsets from the executable.

Tested

Measured on Linux, Wine 11.22, NVIDIA RTX 3060 (driver 580.178.04), LEONIDA_D3D12=vulkan, own 1.0.2.1 copy, main@f6a00fc4d + the boot stack of #7154 + #7180, LEONIDA_SKIP_INT3=1, with a temporary probe in the device proxy over 10,000 slot-57 calls (the probe is not part of this PR). The per-pair size counts in the table add up to 10,000 for pairs 0, 1 and 5.

  • tests/test_docs_*.py and test_ci_registration.py: all pass except test_docs_cli_flags and test_docs_links, which fail the same way on current origin/main (files this PR does not touch).
  • scripts/check_no_game_data.py: exit 0.
  • Not tested: nothing in the runtime changes.

AI-assisted: yes (Claude Code).

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed (n/a: no translator change).

🤖 Generated with Claude Code

…RT-5)

Six pointer/size pairs after the root signature; pairs 2 and 4 pass the bare kind-6
program rule in 9,996 of 9,996 non-empty and 10,000 of 10,000 calls. Counts and sizes only.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@hah346

hah346 commented Nov 23, 2026

Copy link
Copy Markdown

Offline VS/PS library coverage for the slot-57 work. Windows x64, LLVM MC 23.1.5, SPIRV-Tools 2026.4, translator at e5658e4, --wave64-emulate and --wave64-graphics warn, 1.0.2.1 library.

  • 11,339 distinct VS/PS programs attempted, 9,211 accepted by spirv-val (1,340 VS, 7,871 PS).
  • Of 13,407 graphics records containing VS and optionally PS, 13,242 have every required translated stage. The remaining 165 lack a PS (19 of those also lack the VS).
  • Of those 13,242 complete records, 5,256 have at least one wave64 graphics tier C stage, leaving 7,986 complete records without a tier C warning. That is a translator classification for 32-wide GPUs, not execution proof. Among the tier C records, 282 have only unsafe-vote-branch and 176 only cross-lane in the recorded reasons.
  • Independent RTX 2060 smoke: 16 actual pairs created Vulkan graphics pipelines with generic PSO state. That is a small wave32 sample and does not measure retail slot-57 coverage or draws. pso_state_decode: read the pipeline library's graphics state blobs as GPU registers (slot 57) #8507 (comment)

This characterizes the shader side of a future handler. The 13,407 records are a catalog cohort, not the first 10,000 calls from the title. AI-assisted; aggregate counts only.

@tedin7

tedin7 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

checked: #8273 | with: diff review only (docs-only PR: docs/fspx.md, +30 lines); arithmetic check of the table; cross-reference check against the tree | on: read on Linux; no build or test was run, and none applies to a docs change | result: no defect found; the measurements themselves are not reproducible here

  • PR head: 901d54b, merged (clean) onto origin/main 867d922.
  • Internal consistency: the per-call counts add up for every pair I could add: pair 0 (103+3,484+6,125+288 = 10,000), pair 1 (1,065+687+5,466+144+2,566+72 = 10,000), pair 5 (8,853+1,126+7+4+8+1+1 = 10,000); 9,996 non-empty pair-2 blobs = 10,000 minus the 4 empty calls, as the text says.
  • Cross-references hold: the "bare kind-6 rule above" (4-byte multiple, at least 36 bytes, prologue words 0, 3, 6 with bits 31..16 = 0xD580) is in the table of the same file and matches the numbers used; PC device slot 57 is ID3D12Device5::CreateLifetimeTracker and 61 is CreateMetaCommand, as the text says; the "shaders: translate the pipeline library's compute pipelines, which the executable creates with slot 67 (RT-5) #7529 runs cs only" statement matches that PR's title, which I checked separately.
  • The text keeps measured facts and hypotheses apart ("Hypotheses, not confirmed", "Not read", "Not done") and states the condition of the measurement (Wine 11.22, RTX 3060, runtime: DirectStorage zlib requests (file and memory sources) #7180 needed for non-zero blobs). I found no claim stronger than its evidence.
  • Not verified: the 10,000-call probe itself (needs the retail executable and its data, which I do not have), the sizes and the 9,996/10,000 pass counts, and the hypotheses about what pairs 0, 1, 3 and 5 are. I treated them as the author's measurement.

AI-assisted.

@wildheathen

Copy link
Copy Markdown
Contributor

The caller's side of device slot 57, read statically from the retail executable. That's my own 1.0.2.1 copy, whose SHA-256 matches the docs. File only, no run: tools/d3d12_device_calls.py from #7998 to find the site, then a disassembly of the calling routine. No addresses, offsets or bytes below, only slot numbers, call shapes and public SDK names.

  • One call site. The census finds 1 site for slot 57 (this in rcx), so the ~10,000 calls at boot all go through one routine.

  • Shape: four arguments, (this, desc, riid, ppv).

    • rdx points at the description inside a work item.
    • r8 is the address of IID_ID3D12PipelineState. The 16 bytes there are the public SDK GUID.
    • r9 is a stack slot for the out pointer.

    So the title expects an object that answers for ID3D12PipelineState, the same contract as CreateGraphicsPipelineState / CreatePipelineState. (The census estimates 5 arguments for this site; it reads as 4.)

  • Where it runs: inside a job routine that the title submits to its job system, so it runs on a worker thread. The routine walks a linked list of work items and makes one slot-57 call per item.

  • What it does with the result:

    • The HRESULT first goes through a device-loss check. That check reacts only to DXGI_ERROR_DEVICE_REMOVED, DXGI_ERROR_DEVICE_HUNG, DXGI_ERROR_DEVICE_RESET and DXGI_ERROR_DRIVER_INTERNAL_ERROR, and calls the title's device-lost handler for them.
    • Any other negative HRESULT (E_NOTIMPL, E_INVALIDARG, ...) skips that item: no assert, no retry, and no PSO is kept for it. The loop moves on to the next item.
    • On success the returned pointer goes into the title's pipeline cache, keyed by a 32-byte value taken from the work item.

What this means for a handler (inference from the above, not a run):

  1. A refusal is safe for the title. A handler can serve the descriptions it can translate and return E_INVALIDARG / E_NOTIMPL for the rest, and the boot carries on with those pipelines missing. That also fits today's long runs, which reach the frame loop with 10,241 refused slot-57 calls and no crash.
  2. It must never return one of the four device-loss codes for a refusal. Those take the title's device-lost path.
  3. The out object must answer QueryInterface for ID3D12PipelineState. That's the IID the title passes, and the title later binds whatever lands in its cache.

cc #8890, which implements a slot-57 handler: points 1-3 are its contract on the title's side.

AI-assisted.

@OlaiFG7

OlaiFG7 commented Nov 23, 2026

Copy link
Copy Markdown

Reviewed 901d54b, docs read, AI-assisted: the table gives counts and sizes only, with no bytes, addresses or hashes; it is consistent with the slot 67 paragraph and with the kind-6 prologue rule already in docs/fspx.md, and the --stages flag it mentions exists. Nits: #8890 also edits docs/fspx.md for slot 57 and implements the handler, so the "Not done: a slot-57 handler" sentence goes stale if it lands first; and consider an issue link instead of a username for the finding. I did not judge the measurement itself.

@CourtyardGames

Copy link
Copy Markdown

checked: 901d54b | base: main@dde82f27e + #8273 | on: Windows 11, MSVC 14.51, NVIDIA RTX 4070 SUPER (621.14) | result: docs-only change, no code or build impact; I checked its cross-references against the tree and found them consistent (not re-measured: the 10,000-call counts need a game copy, which I do not have).

  • Read: the full diff (+30 lines in docs/fspx.md, nothing else; no scripts, links to downloads, or binaries).
  • Built/tests: not built; the PR touches no source, so there is nothing for a build or ctest to exercise.
  • Cross-checked against the tree: slot 57 is ID3D12Device5::CreateLifetimeTracker by the PC vtable order (Device 7..43, Device1 44..46, Device2 47, Device3 48..50, Device4 51..56, Device5 57), and the Vulkan device in runtime/shims/d3d12_vulkan_device.cpp implements it as "not supported", as the text says. "The bare kind-6 rule above" exists in the table at docs/fspx.md line 196 (multiple of 4, at least 36 bytes, words 0/3/6 with bits 31..16 = 0xD580), and the new text applies it as quoted. tools/shader_library.py does take --stages cs,ps,vs,ms, and shaders: translate the pipeline library's compute pipelines, which the executable creates with slot 67 (RT-5) #7529 is the compute-only (cs) run, as stated.
  • Noticed: the "hypotheses, not confirmed" and "not read / not done" parts are labelled as such, which is the right level of claim for a note without a handler. Coordinating who works on what (49) (moved to #8186) #8047 (cited as exotiquee's finding) is not a PR in this repo, so it is presumably an issue; worth confirming the number. The counts in the table (e.g. 9,996 of 9,996, 10,000 of 10,000) are the author's measurement and I could not reproduce them.

AI-assisted.
agent: yes

@SweatierKey

Copy link
Copy Markdown
Contributor

Complementary static ABI note for docs/fspx.md (slot 57): the single slot-57 caller's descriptor populator builds a 0x108-byte (264 B) descriptor mapping all 7 (program, stage_blob) stage pairs (0x20 B each, starting at +0x28) in 1:1 order with docs/shader_library.md §2:

  • +0x00: ID3D12RootSignature*
  • +0x08/+0x10: (state_blob, state_blob_size)
  • +0x18/+0x20: (pipeline_blob, pipeline_blob_size)
  • +0x28..+0x47: stage 0 (PS) (prog, prog_size, stage_blob, stage_blob_size)
  • +0x48..+0x67: stage 1 (VS) (prog, prog_size, stage_blob, stage_blob_size)
  • +0x68..+0x87: stage 2 (MS) (prog, prog_size, stage_blob, stage_blob_size)
  • +0x88..+0x107: stages 3..6 (0x20 B each; zeroed when the archive index is 0xFFFFFFFF)

This explains why reading only the first two stage pairs (0x68 B) leaves MS-only records empty (detailed on #8890).

(Clean-room static ABI inspection only — struct offsets, counts, and sizes; no game bytes, addresses, or hashes.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants