runtime: define the physical-page allocation contract for startup #873
Closed
opened 2026-11-23 15:24:54 +00:00 by R0Y00
·
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#873
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 R0Y00 on 2026-11-23T15:24:54Z.
Refs #870 and #875. After binding the default allocator, the startup mapping probe reached
XMemAllocatePhysicalPages. The next slice is to verify the ABI and lifetime of the physical-page allocation and release pair.Acceptance
Available to claim. Comment with the environment you can test and links to related GPU VA work. Keep local inputs and raw logs off the tracker.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T15:30:19Z.
The public Microsoft GDK DirectStorage overview identifies one consumer of arrays of 64 KiB physical pages returned by this allocation path. That supports a 64 KiB case for a source-built fixture. It does not establish the declaration, output-array layout, other supported page sizes, or the release call. Those are still the open items. Please link evidence for the pair and include a failure/cleanup check before proposing shim behavior.
Imported from R0Y00/Xbox2Windows. Originally posted by rasptum on 2026-11-23T15:37:10Z.
Claiming this.
xmem.dllexportsXMemAllocatePhysicalPagesandXMemFreePhysicalPages(src/xmem_shim.cpp/.def), backed by a new page-number registry. Stacked on #879, which owns the same files.b1e77b6):AdvancedESRAM/PageAllocator.cppL197–232:BOOL XMemAllocatePhysicalPages(MEM_64K_PAGES, &count, pagePtr)with aULONG_PTRcount and aPULONG_PTRpage array. Release isXMemFreePhysicalPages(count, pagePtr)with the same count and array.AMDFidelityFX_FSR3FrameInterpolation/FSR3FrameInterpolation.cppL146–167: the flag argument is cast toULONG_PTR(XMEM_2MB_CLUSTERSorMEM_64K_PAGES). The count is in/out, and the caller asserts it comes back unchanged.XMemFreePhysicalPagesreturnsBOOL.kernelx.cpp(MIT) implements the kernelx-levelAllocateTitlePhysicalPages/FreeTitlePhysicalPages. They return 64 KiB page indices and set*NumberOfPages = 0withERROR_INVALID_PARAMETERon bad flags.MEM_64K_PAGES(the 64 KiB case from the DirectStorage note above) and allocate all or nothing. Fail closed, returningFALSE,*count = 0and the array untouched, on unknown flags or upper bits, a null pointer, a zero count, or a count above the desktop capacity. Release must name whole live grants. Negative controls: a short or long count on release, a double free, never-issued or forged page numbers, and duplicate entries are each refused with no state change. Forced exhaustion is followed by cleanup. Mapping, scatter mapping and transfer stay out.devandreleasepresets.era_heapattribute word; physical memory types still refused there), #874 (D3D12 VA startup contract, GPU VA side).AI-assisted (Claude Code).
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T15:41:13Z.
Thanks for taking this and for the two pinned Microsoft samples. I checked the calls: they establish the 64 KiB allocate/free pairing, the in/out count and page array, and use a Boolean success check. The examples do not settle count/array mutation on failure or whether partial release is permitted. Keep those cases explicitly labelled as proposed desktop policies until there is independent evidence.
Please take the independent source-built comparison and negative controls first. Startup integration is already being checked, so coordinate here before adding another implementation in the XMem shim. A fixture that checks real page lifetime, preserves a canary on refusal, then confirms that a valid release still succeeds would be directly reusable.
Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-23T15:48:02Z.
Independent source-built evidence, not a claim. rasptum owns #880.
I built an independent fixture in parallel before seeing the claim. It is uploaded at
triggered02/Xbox2Windows: xmem-physical-pages(commits7dcc36dand3d206a1, on top of the now-merged #879). I am not opening a competing shim PR.The reusable part is the source-built comparison, not the local shim policy:
cpu_xmem_physical.exeimportsXMemAllocatePhysicalPagesandXMemFreePhysicalPagesby name from the desktopxmem.dll. The same EXE runs under the Windows loader andpe_map, and the exits match.cpu_native_xmem_physical; the existingcpu_native_shim_startuppasses in Release.The fixture checks registry lifetime and cleanup, not mapped-page lifetime; mapping, scatter mapping and transfer remain out of scope. I can rebase the fixture and canary checks onto rasptum's implementation after it lands, or hand over the MASM/Python check. The local shim in the branch is only what proved the import can be passed.
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-23T15:54:40Z.
Opened draft #887 with the fixture and negative controls described above. It is explicitly not a competing implementation; I will reduce it to the fixture and canary checks once rasptum's #880 implementation lands, or close it in favour of theirs.
Imported from R0Y00/Xbox2Windows. Originally posted by rasptum on 2026-11-23T16:14:58Z.
Result: #892.
Tested: commit
729bfa1onorigin/main406e14a. Windows 10 Pro 10.0.19045.6466, MSVC 19.44.35207.1 x64. Synthetic inputs only.Source-built comparison first:
cpu_native_xmem_physical_pair: an EXE that imports the pair by name gives0x880under both the Windows loader andpe_map_run. Thefull_countandskip_releasemutations give0xf04and0xf06under both. A provider missing either export stops the mapping before entry.era_physical_controls: short count, long count, a single page of a grant, double free, never-issued page, forged mix and duplicate entry are each refused by the policy with state unchanged, and accepted by a lenient SlimEra-style release.xmem_shim_physical_pageschecks canaries on refusal and that a valid release still succeeds after refusals. It also covers exhaustion with cleanup.era_heap,desktop_memory_queryandxmem_shimsets.Established by the Microsoft samples: 64 KiB allocate/free pairing, the in/out count with a page array, and the
BOOLsuccess check.Proposed desktop policy (labeled in code and docs):
MEM_64K_PAGESonly, all or nothing,*count = 0and an untouched array on failure, release of whole live grants only.Open contract questions:
ULONG_PTRvsDWORD).XMEM_2MB_CLUSTERSand its count units.The EXE comparison follows @triggered02's independent fixture (credited in the PR, with Co-authored-by). Their observation, not mine: with both pairs bound, their local binding probe moved the first unresolved import to
xmem.dll!XMemIsToolsMemAvailable.AI-assisted (Claude Code).
Imported from R0Y00/Xbox2Windows. Originally posted by thegl0w on 2026-11-23T16:19:04Z.
I'd like to take the mapping follow-up that #880 leaves open:
XMemMapPhysicalPages,XMemMapPhysicalPagesScatterandXMemTransferMemory. It sits where our earlier memory work meets GPU addresses (#183, #268, #284, #327). With #892, mapping is likely the next boundary after the physical-page pair.Static pass on the package's main executable (file reads only, nothing executed; numbers only, nothing from the image is shared):
XMemMapPhysicalPagesbase + index * 8, consistent with an array of 8-byte page numbers.XMemMapPhysicalPagesScatterXMemTransferMemoryThese are observations only. Argument meanings, return values and failure behavior aren't established yet.
Plan, following the evidence-first order used for #874 and #880:
Contract note: argument widths, return semantics and the order relative to
XMemVirtualAllocand the physical-page pair. Only from evidence that can be shared or reproduced.Source-built EXE with a recording provider: imports the three names, records the inputs and both outcomes, and shows what the caller does next, under the Windows loader and
pe_map. No productionxmem.dllchange in this step.Then a desktop implementation proposal, stacked on #892. The direction I'd like to evaluate:
VirtualAlloc2withMEM_RESERVE_PLACEHOLDER);MapViewOfFile3(MEM_REPLACE_PLACEHOLDER), so a scatter mapping is several views of the same pages;era_title_gpu(#327), so they get desktop GPU addresses.This depends on how #888 reserves address space, so @descent81 and I should agree on the reservation type first. The page numbers would come from #892's registry (@rasptum).
Environment: Windows 11 Pro 26300, MSVC 19.44 x64, CMake/Ninja (
devandreleasepresets), NVIDIA GeForce RTX 3070 Laptop GPU and WARP, D3D12 debug layer available.Executables, dumps and raw logs stay local.
Imported from R0Y00/Xbox2Windows. Originally posted by rasptum on 2026-11-23T16:38:11Z.
Coordination note on the overlap between #892 and #901. Both edit
src/xmem_shim.cpp/.defand both reference this issue.Suggested split, following the claims already on #870/#880:
d0bf29aon it.XMemMapPhysicalPages,...Scatter,XMemTransferMemory): thegl0w claimed the follow-up here at 16:19Z, and R0Y00's #901 review (shared backing through unmap/remap, rejecting unowned tokens, validating the whole list before release) applies to that part.XMemVirtualAlloc: descent81's #888.XMemIsToolsMemAvailable: Holastor's #896 is the single landing PR (R0Y00, 16:34Z on #870, after triggered02 consolidated #900 into it).@stan495 would you be open to rebasing #901 onto #892 once it lands and reducing it to whatever isn't covered above, or pairing with thegl0w on the mapping slice? If you'd rather #901 carry the allocate/free pair instead, I'm fine folding #892's fixture and controls into yours with credit. Either way, one PR per piece keeps review simple.
AI-assisted (Claude Code).
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T16:43:32Z.
Completed by #892 (merged at
3dfe3a9). The bounded desktop registry implements the named allocation and matching release pair for 64 KiB page identifiers. The same source-built EXE passed under Windows and pe_map. Ownership, count, canary, missing-export and cleanup controls passed, and both Windows CI builds were green. These are bookkeeping identifiers. Shared backing, mapping/scatter, transfer and reservation semantics remain separate work under #870, #901 and #888.Imported from R0Y00/Xbox2Windows. Originally posted by stan495 on 2026-11-23T16:44:57Z.
Thanks @rasptum for the heads-up.
I've already closed #901, so please feel free to proceed with #892 for the allocate/free pair. Leaving the mapping slice to @thegl0w sounds good to me as well. Thanks!