Proposal: architecture overview and the CPU trunk #131
Closed
opened 2026-11-21 16:47:24 +00:00 by Leyukaka
·
10 comments
No Branch/Tag specified
main
codex/indirect-large-backed-views
codex/word3-preflight-check
codex/vertex-table-two-records
codex/live-index-alias
codex/copied-vertex-buffer-srv
codex/windows-stage-test-output
codex/preserve-live-srv-retirement
codex/share-render-target-tracking
codex/sgd5-negative-offset-fixture
coverage-dashboard
codex/mesh-loose-root
codex/mesh86-cache-padding
codex/xmem-scatter-preflight
codex/mesh-depth-ps
codex/indirect-dispatch-refresh
codex/compute-container-index
codex/startup-compute-formatted-load
codex/compute-indirect-producer
codex/compute-atomic-soffset
codex/mesh-dual-handoff
codex/startup-run-sh-watcher-control
codex/queue31-page-alias
codex/indexed-indirect-compute-root
codex/typed-buffer-view-metadata
codex/translated-indexed-address-alias
codex/fixed-mesh-create-result
codex/xmem-section-lease
codex/startup-slot86-mesh-cache
codex/restore-mesh-barrier-iteration
codex/translated-indirect-upload-index
codex/xapu-completion-opt-in
codex/translated-indexed-rect
codex/translated-indexed-indirect
codex/startup-mesh-lds-integration
codex/startup-console-ms24
codex/startup-slot57-mesh-request
codex/indirect-copy-provenance
codex/present-color-producer-trace
codex/compute-dispatch-binding-trace
codex/translated-indirect-table-buffers
codex/indirect-copy-provenance-base
codex/mix-half-literal-source
codex/translated-indirect-draw
codex/xmem-scatter-diagnostics
codex/slot148-recording-upload
codex/slot70-loading-art-verified
codex/command-list-upload-arena
codex/recover-failed-command-list
codex/startup-heap-timing-notes
codex/align-audio-input-timeline
codex/synthetic-depth-export-control
codex/startup-texture1d-on-windows
codex/1629-packed-position-fixture
codex/cpu-srv-refresh
codex/stream-root-srv-draw
codex/audio-mixer-timer
codex/startup-reload-published-shader
codex/priority-integrate-1284
codex/guest-sixteen-page-record
codex/aot-placed-dxr-batch
codex/guest-directory-selection
codex/gamesave-enumerate-read
codex/readme-archive-to-pixels
codex/pe-placed-view-draw
codex/archive-directory-gpu
codex/slot133-dxr-build
codex/materialize-placed-vertex-view
codex/dstorage-directory-offsets
codex/xg-nine-bc-copy
codex/xg-slot10-bc64-arrays
codex/dxr-guest-address-readback
codex/gpu-va-high-bits
codex/clarify-diagnostic-startup-scope
codex/xg-six-levels
codex/typed-derived-blend
codex/english-legal-text-progress
codex/address-bc-4ks
codex/dstorage-bounded-file-read
codex/wide-srv-offsets-menu
codex/startup-memory-srv
codex/bound-view-tail
codex/language-selector-readback
codex/setup-menu-progress
codex/cpu-plane-refresh
codex/startup-ubyte-vertex
codex/presenter-window-selection
codex/startup-uniform-buffer-lane
codex/intro-loop-timing
codex/static-clzero-loops
codex/document-rtx-intro
codex/startup-insertq
codex/nv12-startup-texture
codex/stream-stage-draw
codex/startup-null-uav-format
codex/startup-draw-capture
codex/shorten-windows-checks
codex/dstorage-rfc1950
codex/startup-dump-fence
codex/pr1135-review-base
codex/startup-stream-requests
codex/startup-chroma-view
codex/readme-graphics-pipeline-streams
codex/static-crt-free-tls
codex/arc-140t-rtx-5080-laptop-gpu-reports
codex/main-startup-progress-entry
codex/signed-dxil-catalogue
codex/reloc-free-preferred-base
codex/quad-dpp-bit-mask
codex/raw-srv-bounds
codex/rx9070-31044-hardware-report
codex/gpu-page-source-provenance
codex/runtime-placeholder-interior
codex/gpu-copy-queue-tile-order
codex/pe-pin-external-providers
codex/xmem-placeholder-reservations
codex/xmem-shared-physical-pages
codex/pe-package-startup
codex/xmem-tools-memory-query
codex/cpu-stack-output-import
codex/pe-load-security-cookie
codex/record-three-bvh-retests
codex/cpu-rbp-frame-anchor
codex/xmem-default-startup
codex/record-rtx-3050-ti-9597
codex/docs-readme-start-here
codex/check-compute-mad24-truncation
codex/docs-discord-community
codex/bound-rcx-branch-mutants
codex/rtx5060ti-bvh-62114
codex/837-neutral-readme-disclaimer
codex/record-rtx-3070-ti
codex/title-neutral-public-wording
codex/exe-shadow-frame-submissions
codex/exe-shadow-runtime-chain
codex/readme-polish
codex/gpu-coverage-nov23
codex/spirv-minlod
codex/shadow-shim-device
codex/exe-two-shadow-frames
codex/shim-dispatch-cleanup
codex/fix-spirv-cache-probe
codex/sampler-use
codex/ballot-bit-extract
codex/packed-fma-release
codex/cpu-packed-fma-o2
codex/publish-coverage-dashboard
codex/mesh-cbv-binding-order
codex/spirv-window-fixture
codex/ps-e32-float-uint
codex/ps-cbuffer-reads
codex/fixed-profile-rescan
codex/shim-compute-integration
codex/readme-visible-coverage
codex/readme-research-navigation
codex/integrate-pr-256
codex/indexed-mesh
codex/sampled-coverage
codex/first-ms
codex/dual-ps
codex/ps-attribute
codex/compute-first
codex/ps-export
codex/readme-research-status
codex/ps-layout
codex/blast-window
codex/chart-caption
codex/reviewer-roles
codex/blast-aot
codex/archive-program
codex/crc-stream-program
codex/exe-image-data-chain
codex/local-cpu-fixture-coverage
codex/exe-bound-frame-chain
codex/exe-mapped-comparison
codex/contribution-dependencies
codex/exe-entry-aot
codex/bink-frame-heap-integration
docs/hardware-seven-reports
codex/bink-custom-heap
codex/bink-heap-callers
codex/discussions-entry-points
codex/gpu-community-batch-64
codex/ffx-scratch-writers
codex/generic-project-documentation
codex/ffx-dispatch-rcas
codex/four-windows-gpu-reports
codex/title-neutral-project-wording
codex/community-coverage-provenance
codex/rcas-packed-texels
codex/community-gpu-retests
codex/community-build-and-gpu-reports
codex/ffx-provider-loop
codex/ffx-recurrent-views
codex/ffx-recurrent-resource
codex/amd-wave64-reports
codex/ffx-backend-slots
codex/upscaler-device-init
codex/ffx-context-lifecycle
codex/ffx-version-query
codex/ffx-provider-contract
codex/typed-object-callback
codex/cpu-ordinal-import
codex/chained-cpu-ranges
codex/cpu-import-call
codex/cpu-direct-call
codex/cpu-leaf-aot
codex/community-project-status
codex/script-state-path-replay
codex/script-state-evidence
codex/bc7-resident-tail
codex/bcpack-mip-tail
codex/bc7-texture-draw
codex/asset-ranges
codex/pixel-constants
codex/pixel-aot
codex/pre-exe-workloads
codex/root-signature-device-coverage
engineering/packed-bvh-leaves
engineering/bvh-build-and-update
engineering/intake-root-roundtrip
community/gpu-check-release
community/english-contributor-entry
gpu-check-v0.1.0
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
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
R0Y00/Xbox2Windows#131
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-21T16:47:24Z.
This is a proposed
docs/architecture.mdfor discussion before any PR. It maps the components and their data flow, lists where the boundaries are weak or duplicated, collects what each CPU path refuses today, and ends with a proposal on the CPU trunk.That proposal differs from the direction stated in the README and on #46: it suggests making native mapping plus a shared shim layer the path expected to reach startup, with static translation kept as the reference and for functions that need patching. I've put it here first so you can accept, reject or reshape it. Steps 1, 2 and 5 of the "first steps" list are useful under either direction, and I'm happy to start with those whatever you decide on the rest.
How it was produced: an AI-assisted review. A first draft was written from the code; Codex and Grok each reviewed the repository independently, read-only; Fable checked every factual claim against
a46f1ff, and its corrections were applied. A human contributor took the decisions and reviewed the result. Every claim points to a file so it can be checked. If something is wrong, I'll fix the page before any PR.AI-assisted.
Architecture
This page describes how the parts of Xbox2Windows fit together, where their boundaries are weak, and one proposal for what to do next. Measured results and reproduction commands stay in experiments.md; this page links to them instead of repeating them.
How this page was produced
This page came out of an AI-assisted architecture review meant to move the project forward as a whole, not one test at a time:
a46f1ff, and the corrections were applied.Claims point to files and lines so they can be checked. The proposal at the end is a suggestion from this review. It is not a decision of the maintainers.
What the tree is today
Xbox2Windows is an evidence lab for running Xbox Series X|S (Scarlett) software on x64 Windows. CI uses only fixtures built from this repository. Some results come from pinned local package DLLs and are recorded in
docs/experiments.mdwith their SHA-256. No title executable has been run, and the inspected build did not contain one. Title CPU execution, startup and frame rate are unverified (README, first paragraph).The Scarlett CPU code is already x64 PE32+. The work is therefore about three things:
Components
MicrosoftGame.Config, layout and PE files → startup locations, import inventory, dependency pathstools/intake_exe.py,tools/pe_inventory.py,tools/dependency_paths.py,tools/verify_build.py,tools/resource_inventory.pystatic_exe_intake,conditional_import_paths,layout_chunk_summarytools/cpu_leaf_aot.py,tools/cpu_call_aot.py,tools/cpu_chained_aot.py,tools/cpu_ranges.py; the shared integer lowererlower()intools/ffx_version_query.py, reused bytools/bink_heap_aot.pyand thetools/ffx_*.pyprofilescpu_aot_*.pdata, DLL TLS callbacks and entry point → callable exportstools/pe_map.cppcpu_native_map,cpu_native_seh,cpu_native_tlssrc/era_heap.*, plus per-experiment providers intests/(for exampletests/cpu/bink_heap_provider.cpp)era_heap_*,desktop_memory_query,cpu_aot_bink_heaptools/pixel_aot.py;tools/ffx_dispatch_aot.py(a second opcode table over the same disassembler); hand-written HLSL for BVH/DXR intests/pixel_aot_*,ffx_*,bvh_*tools/bc7_tiles.py,tools/paged_resource.py,tools/bcpack_probe.py,tools/script_*bcpack_prefix_and_mip_tail,bc7_draw_*,script_*offscreen_check→ adapter or WARP → Markdown reporttests/offscreen_check.cpp,tools/gpu-check/,tools/package-gpu-check.ps1*_warp,*_hardware, the hardware thread (#1)src/currently holds onlyera_heap.*andrgb9e5.hlsli. Most runtime behaviour lives in test-side providers and hosts.Boundaries that are weak or duplicated
CMakeLists.txt, thecpu_translationtargets). Native mapping binds through a resolver supplied by the host (tools/pe_map.cpp).tools/cpu_ranges.pyreadsmin(VirtualSize, SizeOfRawData), whilepe_mapmapsVirtualSizeand zero-fills the rest. Data past the raw size exists in a mapped image but is invisible to intake and to the translators.tools/pe_inventory.py);pe_maprejects them.src/era_heap.cpprejects any attribute bits outside 24–28, so it refuses the measured Bink word0x05e50000.tests/cpu/bink_heap_provider.cppaccepts only that word. Each experiment therefore has its own heap.tools/ffx_version_query.py).tests/offscreen_check.cpphosts triangle, compute, DXR, BVH, FidelityFX, pixel readback and BC7. Together withCMakeLists.txtanddocs/experiments.md, it is where unrelated contributions collide.What each path refuses
These refusals are the current edge of the CPU work. Each one is a candidate for a fixture.
tools/cpu_call_aot.py);tools/cpu_chained_aot.py);lower()intools/ffx_version_query.py).pe_maprefusals: each returns a named error.pe_map:LoadLibrarydoes too, so an EXE's own startup is never run;Imports and shims
An Xbox image imports from system DLLs such as
kernelx,xmemandd3d12_xs, which do not exist on a desktop.xmem.dllandd3d12_xs.dll(docs/experiments.md, "PE dependency baseline").tools/pe_inventory.py), so the counts may change on another Windows build. This is an inference from the code and has not been measured.tools/ffx_device_init.py).tools/dependency_paths.py). With another loader the tool reports no conditional edges and still exits 0. The translation tool (tools/ffx_version_query.py) raises on a hash mismatch instead.There is no shared shim library and no shared contract for a shimmed call: structure sizes, error codes, allocation ownership and attribute words. Each experiment binds the few calls it needs.
GPU path
pixel_aot.pyfor one straight-line pixel subset;ffx_dispatch_aot.pyfor four pinned compute programs;docs/experiments.md, "Offline pixel shader recompilation");tools/ffx_dispatch_aot.py).dxil-ms-xb2target (docs/experiments.md). Clearing root-flag bits makes root-signature serialization succeed but does not address those programs. The BVH and wave64 rows in the README are desktop results.Evidence model and CI
_hardwaretests; it also smoke-tests the GPU check package on WARP. An Ubuntu job assembles and translates gfx1013 fixtures with LLVM 15, and a Linux job runs the platform-independent Python checks (.github/workflows/windows.yml).FFX_UPSCALER_IMAGEandBINK_HEAP_IMAGEare local-only. CI builds the source-built controls under the same test names.cpu_*PE test, are registered only ifout/pe-env/Scripts/python.exeexists at configure time (CMakeLists.txt,if(EXISTS "${INTAKE_PYTHON}")). The README and CONTRIBUTING document this requirement. Configure still gives no warning, and the three smoke tests pass without these tests.Adding an experiment
tests/cpu/for machine-code shapes, C++ or HLSL elsewhere.CMakeLists.txt, and record the measurement indocs/experiments.md.Proposal for discussion: the CPU trunk
Current direction. The README and the maintainer's comment on #46 set static recompilation as the main direction, with the native run as an independent reference for checking translated calls and shims.
Proposal. This review recommends a different weighting. Make native mapping plus a shared shim layer the trunk that is expected to reach a title's startup. Keep static translation for differential evidence and for functions that must be patched or instrumented. The facts behind it:
pe_mapruns the original instructions. It already reproduces DIR64 relocations, ordinary imports and.pdata. For DLLs it also reproduces TLS callbacks and the entry point, compared with the Windows loader incpu_native_tls. It raises and catches an exception inside a mapped image (cpu_native_seh).Steps 1, 2 and 5 are useful under either direction. The choice belongs to the maintainers.
First steps, using source-built fixtures only
pe_map. Add a readability check to export lookup. Reject a double release or a pointer thatpe_map_imagedid not return. Write down a lifecycle contract for callbacks that map or release images.xmemprovider exportingXMemAlloc/XMemFreethat accepts the measured attribute words, used by bothera_heap_checkand the Bink heap fixture.pe_map. A new source-built DLL with one/DELAYLOADimport. The delayed call is bound and compared withLoadLibrary. The existingintake_candidate.execannot serve: it is an EXE and has TLS data, both of whichpe_mapdoes not run.cpu_*tests cannot disappear unnoticed.Known inconsistencies
src/is described as the Windows runtime, but most runtime behaviour lives in test-side providers.STATUSintests/cpu/native_map_check.py: it names only theMapStatusvalues that test uses, not the full enum intools/pe_map.cpp.tools/cpu_chained_aot.pyandtools/ffx_version_query.pycopy from guest addresses supplied by the profile without a host-side bounds check.Imported from R0Y00/Xbox2Windows. Originally posted by sof9816 on 2026-11-21T16:57:34Z.
@R0Y00 @Leyukaka Is anyone already working on a source-built test where a mapped DLL triggers an offscreen draw? I saw the proposed EXE process-startup fixture here and the existing TLS work in #78 and #139.
The smaller test I have in mind would use the existing process-attach path, call a frame export, bind one graphics import to the existing offscreen renderer, and check a translated shader's pixel readback on an RTX 3060 Ti and WARP. With that import withheld, mapping should fail before a draw. All inputs would be source-built.
Would you prefer this as a small follow-up fixture, or would it overlap with the process-startup work? If someone has a branch underway, I can help verify it on Windows.
Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-21T17:05:59Z.
I'm not working on that, and I don't think it overlaps with the process-startup fixture. That fixture is about EXE startup order, static initialization and TLS data across two threads; yours is about a mapped DLL reaching the renderer through one bound graphics import. Yours also covers the "first graphics integration" step that one of the reviews behind this proposal ranked third. The withheld-import control is a useful negative case.
On my side, the next
pe_mapchange is a hardening PR (readability checks in export lookup, andpe_map_releasereturning 0 for unknown or already released pointers). It is stacked on #139 and touchespe_map_exportandpe_map_release. If your fixture calls an export of the mapped DLL, it should work with either version.Whether it should land before the process-startup work is the maintainer's call.
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-21T17:17:01Z.
The source-built mapped-DLL draw is a good independent integration task. Please use a normal Windows load as the reference and compare the same exported draw and readback under pe_map. Track EXE startup separately; static recompilation remains the project objective.
Imported from R0Y00/Xbox2Windows. Originally posted by sof9816 on 2026-11-21T17:31:01Z.
@Leyukaka Is anyone already implementing the separate source-built EXE startup fixture in step 4? I found the proposal but no branch for it. If there is a branch or PR, I'd like to build it on Windows 11 and compare DLL initialization, TLS on the main and worker threads, and the process exit code with a normal Windows launch. I'll keep this separate from the mapped-DLL draw PR.
Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-21T18:01:14Z.
No one is working on it on my side, and there is no branch, so it's yours if you want it. As the maintainer asked above, keeping it separate from the mapped-DLL draw makes sense.
One thing that may help: #139 changes
cpu_tls_sinkto record the calling thread for each call, so notifications can be filtered per thread. That would make the main-thread versus worker-thread TLS comparison straightforward. It also adds a one-shot hook armed for a single thread. Thesink_recordsignature is unchanged.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-21T18:07:29Z.
A short status note following up on this proposal. The counts are measured on
ccfa703. The percentages are my own rough estimates of how far each area is from "a title starts on Windows", not measurements, so please correct anything you see differently.Repository at
ccfa703: 307 commits from 25 authors (counted by name), 110 merged PRs, 25 open PRs and 15 open issues. Locally, 103 CTest tests pass on Windows 11 build 26300; the two wave64 tests are skipped on this adapter.pe_map)XMemVirtualQuery, a few D3D12 device callsxmem.dll/d3d12_xs.dllinterfaces), the behaviour behind the 1,329 edges that resolve on the desktop, COM and vtable interfacesMapping is the smaller of these problems, so its higher number says little about the whole. Overall, the project is roughly 3–5% of the way to a title starting. Static recompilation remains the objective, and the mapper serves as the reference that translated calls and shims are checked against.
From this proposal's step list:
pe_map(#163, #164): ready locally. It waits for #139 to merge.era_heapnow accepts the measured words; a shared XMem provider for mapped images is still open.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-21T18:12:06Z.
Step 2 has a proposed shared provider in #183. Lead decision requested before exposing its four named exports: should the desktop provider register graphics allocations as GPU-intended and guarantee that the working-set query returns FALSE, sets ERROR_NOT_SUPPORTED and leaves the buffer untouched? The PR distinguishes these desktop policies from the caller observations. #189/#188 separately reuse the allocator in the existing Bink fixture.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-21T18:26:26Z.
Lead decision for #183. Adopt the following contract for the shared x64 Windows provider.
These are Windows adapter policies. Please review #183 against the four export tests and the normal required CI; the interface decision is settled. Static recompilation remains the CPU objective.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T03:24:40Z.
For the next development cycle we will allocate maintainer-led development and review time as follows.
These are approximate shares of maintainer effort across the cycle. Count a change once under its main deliverable. Contributors can continue existing claims. Please link the consuming fixture or measured blocker when claiming new work. We will revisit the mix when the next integration run identifies its first blocker.
Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-29T00:48:15Z.
The five first steps are done: export and release checks in
pe_map(#163, #164), the shared XMem provider (#183), delay imports (#127), the process-startup fixture (#165), the missing-Python warning (#148). The CPU trunk proposal was not adopted (11-21: static recompilation remains the objective), and the 11-23 allocation sets the current priorities. Closing.