Skip to content

d3d12_xs: one line per device slot in the three spots every slot PR edits, so slot PRs stop conflicting (no behaviour change) - #7460

Closed
tibzejoker wants to merge 1 commit into
ProjectLeonida:mainfrom
tibzejoker:slot-table-anchors
Closed

tibzejoker wants to merge 1 commit into
ProjectLeonida:mainfrom
tibzejoker:slot-table-anchors

Conversation

@tibzejoker

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue: #7333 (comment), from @kormocicsaba's finding (stop-by-stop review in #7333).

What and why

No behaviour change. Every open device-slot PR conflicts with every other one. The conflicts aren't in the slot handlers themselves but in three shared spots that each PR edits:

  1. the device_slot_overridden chain of slot == N || in d3d12_xs_device.cpp;
  2. the slot lists repeated in the prose comments of d3d12_xs_device.h (and at the top of the .cpp);
  3. the end of proxy_slot's if constexpr chain (every new branch goes just before the final else), plus the end of xs_proxy_mock_test's main().

So the boot-chain slot PRs can only land one at a time, with a rebase after each.

This PR gives each of those spots one line per slot:

  • device_slot_overridden reads kOverriddenDeviceSlots, a table with one slot per line in slot order, each line saying what the slot does. The configurable Xbox routes (48/73 and 78/79/80 by default) are still checked separately, since their indices come from the environment.
  • The prose comments point at that table instead of repeating its slots.
  • proxy_slot's branches are sorted by slot (they were 0, 1, 2, 8, 9, 36, 32, 31…, 75, 14, 62, 67, 76), with a note that a new slot goes between its neighbours, not before the final else.
  • xs_proxy_mock_test's checks are one per line in a list.

After this, a slot PR adds its own table line and its own branch, and two such PRs touch different lines.

For open slot PRs: after this lands, a rebase means moving your slot == N into its own table line and your branch to its slot position. Most of the existing conflicts with other slot PRs then go away.

Tested

RTX 4090, driver 617.42, Windows 11 26200, MSVC 2022 RelWithDebInfo: xs_proxy_mock_test (PASS, also --env-slots, which moves all five routes) and device_proxy_test (OK, 0 failures, including its device_slot_overridden checks). Synthetic only, no game files.

AI-assisted: yes (Claude Code).

🤖 Generated with Claude Code

…dits (no behaviour change)

Every open device-slot PR conflicts with every other in the same three shared spots (found by
@kormocicsaba in the coordination issue): the device_slot_overridden chain of 'slot == N ||', the
slot lists repeated in the prose comments of d3d12_xs_device.h/.cpp, and the end of proxy_slot's
if-constexpr chain plus the end of xs_proxy_mock_test's main().

- device_slot_overridden reads kOverriddenDeviceSlots, a table with one slot per line in slot order,
  each with what it does; the configurable Xbox routes are still checked separately.
- The comments point at that table instead of repeating its slots.
- proxy_slot's branches are in slot order, with a note that a new slot goes between its neighbours,
  not before the final else.
- xs_proxy_mock_test's checks are one per line.

A slot PR now adds its own table line and its own branch, and two of them touch different lines.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@CharlyRien

Copy link
Copy Markdown

Tested e890cbf (merged on main) on Windows 11 23H2 (22631), MSVC 2022 Build Tools RelWithDebInfo, RTX 3090: pass. AI-assisted.

  • All six xs_proxy_mock* ctests pass (no_reserve, no_protect, no_handler, env_slots, env_slots_invalid included), and so do the run_tiny_* runs.
  • Full ctest gives the same results as main on this host. The four failures it shares with main (d3d12_vulkan_device, d3d12_indirect_dispatch_count, d3d12_execute_indirect_validation, d3d12_indirect_rt) are 23H2 host differences or are already being fixed elsewhere, and are unrelated to this PR.

This is a synthetic check only: I have no retail executable, so the "no behaviour change" claim is verified through the mock proxy, not a real boot.

@kormocicsaba

Copy link
Copy Markdown

Tested e890cbf merged onto main 6f58bd2: builds clean with MSVC (VS 18, RelWithDebInfo, Ninja), and ctest is 257 of 260. The three failures are the two that already fail on main 6f58bd2 (d3d12_vulkan_device, d3d12_indirect_dispatch_count) and d3d12_bindless_churn_validated, which is flaky under -j8 on main too. device_proxy, device_proxy_trace and all six xs_proxy_mock* tests pass. RTX 4070, driver 621.01, Windows 11 Pro 26300.

No behaviour change, as the title says: kOverriddenDeviceSlots holds the same 18 slots as main's if constexpr chain (0, 1, 2, 8, 9, 14, 31, 32, 34, 35, 36, 45, 46, 50, 62, 67, 75, 76), and the Xbox routes (48/73, 78/79/80) still come from xbox_device_slot_routes().

How much it helps, measured: I rebased 13 open slot PRs onto it the way the description asks (table line and proxy_slot branch at the sorted position, check appended to checks[]) and merged every pair with git merge-tree.

  • On main today: 99 of 136 pairs conflict.
  • With this PR: 44 of 78. Split by part:
    • checks[] and the check functions before no_dialogs(): 36 of 36. Every PR that adds a check still edits the same two spots.
    • table lines: 11 of 55; proxy_slot branches: 13 of 55. These are slots that land between the same neighbours (70 and 74 between 67 and 75; 86, 101, 108, 127, 133 all after 76).

So it fixes most of the source conflicts, and the mock test is now where they pile up. I've claimed that follow-up in #7496 and have a first version on top of this: each check goes in its own file under runtime/test/xs_proxy_mock/ and registers itself, and CMake globs the folder. Run the same way, the same 13 PRs then conflict in 13 of 78 pairs, none of them in the mock test. All 13 are in d3d12_xs_device.cpp, from slots that sort next to each other. It will be a separate PR, Depends on: #7460, so nothing changes here.

One overlap to settle before either lands: #7490 rewrites the same proxy into console slot order and conflicts with this PR in d3d12_xs_device.cpp and .h. It also reads slot 75 as UnregisterPagePoolX, where main and this PR route 75 to CreateCommandQueue1. Whichever lands first, the other needs a rebase. The slot-75 reading should be decided on evidence either way.

AI-assisted (Claude Code).

@ASTROWwwW

Copy link
Copy Markdown

Independent Windows check of e890cbf3c merged into main acccd0f1e (clean merge): pass. MSVC 2022 BuildTools RelWithDebInfo, Windows 11 26300, no game files. Build ok, no new warnings in d3d12_xs_device.* or xs_proxy_mock_test.cpp; full ctest 111/111, including xs_proxy_mock and xs_proxy_mock_no_reserve. D3D12/Vulkan tests skip here (no Vulkan SDK).

From the boot-log issue: every slot PR on the current ladder (#6964, #6954, #2490, #6953, #7075, #7021, #7066) conflicts with the others only in the three places this PR turns into one line per slot (#7154 (comment)). Merging this first would let them land without a rebase each.

AI-assisted (Claude Code).

@NolanCotter

Copy link
Copy Markdown
Contributor

Reviewed and tested on e890cbf3 against main (clang-cl 20 + xwin cross-build, Wine):

Behavior-preserving, verified two ways:

  • Slot set identical: kOverriddenDeviceSlots (0,1,2,8,9,14,31,32,34,35,36,45,46,50,62,67,75,76) is exactly the old slot <= 2 || ... chain — unsigned can't go below 0, so <=2 ≡ {0,1,2}.
  • proxy_slot branch order changed but the if constexpr chain is disjoint per instantiated Slot, so dispatch is identical. All 13 special-case branches still present.

Tests: xs_proxy_mock_test PASS (incl. the 48/73/78/79/80 route check), loader_test 88/0, unimplemented_policy_test 87/0.

Merge interaction: test-merged #2490's head on top — conflicts in exactly the two places this refactor targets (device_slot_overridden for its slot-12 line, the check_* list in the mock test). Both mechanical — one line each in the new array forms. That's the point of this PR, so the rebase cost lands where it should.

AI-assisted (Devin); no game files used.

@Kerwinss

Copy link
Copy Markdown

Tested e890cbf on Windows 11 Pro 10.0.26300, MSVC 14.51 (VS Build Tools 2026), Windows SDK 10.0.26100, NVIDIA GeForce RTX 4060 / 621.24, Khronos Vulkan headers via -DLEONIDA_VULKAN_HEADERS_FETCH=ON: pass, no regression.

Merged onto main 867d922 (clean), full runtime build, ctest -C RelWithDebInfo -j4: 237/239, same as main alone on this GPU; the two failures are main's own d3d12_depth_resolve (#7985) and d3d12_vulkan_device:6574. All seven xs_proxy_mock* entries pass, as do device_proxy, device_proxy_trace, queue_proxy and allocator_proxy, which fits "no behaviour change".

Picked from the "No game copy" list in #7154. AI-assisted (Claude Code). No game files.

@tedin7

tedin7 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

checked: #7460 at e890cbf, merged onto main 867d922 (clean merge) | on: Wine 11 on RunPod RTX 4090 (Linux), clang-cl cross-build; not native Windows, host D3D12/WARP comparisons do not run | ran: xs_proxy_mock_test built from the merged tree: default mode EXIT 0 (xs_proxy_mock_test: PASS (9 allocations refused on purpose)), and the five ctest modes run by hand: --fail-virtualalloc, --fail-virtualprotect, --fail-veh, --env-slots, --env-slots-invalid, all EXIT 0. No build warnings/errors in the three touched files.

diff review (3 files, 63+/28-): (1) kOverriddenDeviceSlots (0,1,2,8,9,14,31,32,34,35,36,45,46,50,62,67,75,76) is exactly the old slot <= 2 || ... chain, checked slot by slot. (2) The proxy_slot if constexpr branches are only moved: each condition is on a distinct slot (or a disjoint group), so branch order cannot change which one is taken. (3) The checks[] table in main keeps all eight checks in the same order and the same short-circuit on first failure; the captureless lambda around check_tail(true) is needed because it takes an argument. (4) Only comments change in the header; no game files, no behaviour change found.

Not verified: native Windows/MSVC build, GPU or title boot (this PR does not claim any), and I did not run a negative control since the PR claims none. Several other testers already posted passes on this head; this is an independent re-run on a different toolchain.

agent: yes
AI-assisted.

@akimfomin

Copy link
Copy Markdown

checked: A38 #7460 | base: main@867d922f + #7460 e890cbf3 (clean trial merge) | on: native Windows 11 28000.3501, portable LLVM/MinGW | result: xs_proxy_mock_test built and passed the default, --env-slots and --env-slots-invalid modes on the merged tree. The PR head also passed default and --env-slots.

For an independent no-behaviour-change check I queried device_slot_overridden() for all 256 indices at direct parent 26ecd9f9 and PR head e890cbf3. All 768 parent/head comparisons matched across default, five valid remaps, and rejected values. The mock build defines the two MSVC-specific allocation annotations empty. I could not run the separate native WARP device_proxy_test with the available MinGW SDK because its struct-return COM declarations differ from MSVC. Synthetic only.

agent: yes

@Cryptoteep

Copy link
Copy Markdown
Contributor

checked: #7460e890cbf | with: git merge-tree $(git merge-base main pr-7460) main pr-7460 + check_no_game_data | on: Windows 11, Intel CC150, RTX 5060 | result: clean merge onto main 867d922, 0 conflicts across all 3 files, 0 game data

Audited full diff:

  • kOverriddenDeviceSlots table cleanly centralizes slot entries in numeric order in runtime/shims/d3d12_xs_device.cpp, replacing the fragile multiline || chain in device_slot_overridden().
  • proxy_slot branches ordered monotonically by slot index, avoiding collisions when new slot handlers land.
  • xs_proxy_mock_test.cpp array checks formatted one per line.
  • Tested clean merge onto current main (867d922f0) without any textual or logical conflicts.
  • Verified python -I scripts/check_no_game_data.py runtime/shims/d3d12_xs_device.cpp runtime/shims/d3d12_xs_device.h runtime/test/xs_proxy_mock_test.cpp -> clean, exit 0.

@ASTROWwwW

Copy link
Copy Markdown

checked: #7460e890cbf (A38 from #8851) | base: main@867d922f0 + #7460 (clean merge) | with: full runtime build (MSVC 19.44, RelWithDebInfo) + ctest -j8 | on: Windows 11, RTX 5080, no game copy | result: pass: 262/265. The 3 failures (d3d12_vulkan_device, d3d12_depth_resolve, d3d12_indirect_rt) fail the same way on this machine without #7460 (checked earlier on the ladder branch with and without the changes). All 8 xs_proxy_mock* / device_proxy* tests pass.

Review, "no behaviour change": the slot set in kOverriddenDeviceSlots (0, 1, 2, 8, 9, 14, 31, 32, 34, 35, 36, 45, 46, 50, 62, 67, 75, 76) is exactly the one in the old if, and the configurable routes are still checked separately. In proxy_slot the if constexpr branches are only reordered (their conditions don't overlap), so dispatch is unchanged. The goal holds: one line per slot, so slot PRs no longer conflict on the same line. Recommended first in the boot-path merge order (#8851).

AI-assisted (Claude Code). agent: yes

@byPreaZy

Copy link
Copy Markdown

checked: #7460 | with: applied the diff on main 867d922, built xs_proxy_mock_test (MSVC 19.44, Ninja RelWithDebInfo) | on: Windows 11, RX 9060 XT (mock test, no GPU path) | result: PASS (9 intentional refusals), all 8 check groups run

Code read: the proxy_slot branches are reordered into strict slot order under if constexpr on distinct slots, so dispatch is unchanged; kOverriddenDeviceSlots lists exactly the old condition's set (0-2, 8, 9, 14, 31-36, 45, 46, 50, 62, 67, 75, 76) with the Xbox routes still checked separately; the test main() runs the same 8 checks via the table. No behaviour change, as advertised. This should genuinely stop the slot-PR conflicts.

AI-assisted check.

Raxstreams added a commit to Raxstreams/Leonida that referenced this pull request Nov 23, 2026
d3d12_xs: one line per device slot in the three spots every slot PR edits, so slot PRs stop conflicting (no behaviour change)

Fork integration. AI-assisted (Codex).
Raxstreams added a commit to Raxstreams/Leonida that referenced this pull request Nov 23, 2026
d3d12_xs: device slot 26 takes the return buffer in RCX and the device in RDX, as the retail executable calls it (RT-5)

Preserve the per-slot layout from ItsNotRexed#7460 while integrating the slot 26 handler and regression tests.

Fork integration. AI-assisted (Codex).
Raxstreams added a commit to Raxstreams/Leonida that referenced this pull request Nov 23, 2026
d3d12_xs: Xbox device slot 127 creates a committed resource through the PC CreateCommittedResource3 (retail boot chain stop 15)

Preserve the per-slot layout from ItsNotRexed#7460 while integrating the slot 127 handler and regression tests.

Fork integration. AI-assisted (Codex).
Raxstreams added a commit to Raxstreams/Leonida that referenced this pull request Nov 23, 2026
d3d12_xs: a console indirect argument of type 105 is created as DISPATCH (device slot 41, RT-5 stop 19)

Preserve the per-slot layout from ProjectLeonida#7460 while integrating the slot 41 handler and regression tests.

Fork integration. AI-assisted (Codex).
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.