cpu: drive a D3D12 compute dispatch from the translated shim EXE #519

Merged
R0Y00 merged 3 commits from upstream-pr/525 into main 2026-11-22 09:21:45 +00:00
R0Y00 commented 2026-11-22 09:14:05 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-22T09:14:05Z.


Change

Follow-up to #511, coordinated in the original PR. Extend its source-built CRT-free startup body to allocate, submit a compute job, release the allocation and return a status. The shared x64 translator reads the linked PE starting at AddressOfEntryPoint. The generated process records the SHA-256 of that input. Windows and pe_map run the same original file.

The EXE owns the branches, lifetime and import arguments. A fixture DLL implements the host boundary with XMem and a D3D12 queue, using the existing source-built compute shader. An independent byte oracle checks the GPU readback. The CPU test checks that the exact pointer returned in each process is passed on to dispatch and release.

Verification

Tested commit 64071d4 on Windows 11 build 26200.9974, MSVC 19.51, RTX 4060 Laptop (32.0.16.1656) and WARP (10.0.26100.9818). The integration test uses the default D3D12 debug-layer setting and does not enable it.

. ./tools/dev.ps1
foreach ($preset in 'dev','release') {
  cmake --build --preset $preset --parallel 10 --target cpu_shim_startup_lifted pe_map
  ctest --preset $preset --no-tests=error -R '^(cpu_native_shim_startup|cpu_shim_compute_(warp|hardware))$'
}

Three tests in each configuration. The 4096- and 8192-byte cases both pass attribute 0xa8004000, dispatch once with different seeds, read back 16 bytes, free once and exit 42. The SIZE_MAX case gets null from XMemAlloc, performs zero compute dispatches and frees, publishes zero compute bytes and exits 17. The original startup allocation and both missing-provider controls still run in the baseline test. The experiment and expected byte strings are documented in docs/experiments.md.

Source-built fixtures under the project's MIT license. AI-assisted implementation and verification.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6540664349 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/525). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-22T09:14:05Z. --- ## Change Follow-up to #511, coordinated in [the original PR](https://github.com/R0Y00/Xbox2Windows/pull/511#issuecomment-7076901174). Extend its source-built CRT-free startup body to allocate, submit a compute job, release the allocation and return a status. The shared x64 translator reads the linked PE starting at AddressOfEntryPoint. The generated process records the SHA-256 of that input. Windows and pe_map run the same original file. The EXE owns the branches, lifetime and import arguments. A fixture DLL implements the host boundary with XMem and a D3D12 queue, using the existing source-built compute shader. An independent byte oracle checks the GPU readback. The CPU test checks that the exact pointer returned in each process is passed on to dispatch and release. ## Verification Tested commit 64071d4 on Windows 11 build 26200.9974, MSVC 19.51, RTX 4060 Laptop (32.0.16.1656) and WARP (10.0.26100.9818). The integration test uses the default D3D12 debug-layer setting and does not enable it. ```powershell . ./tools/dev.ps1 foreach ($preset in 'dev','release') { cmake --build --preset $preset --parallel 10 --target cpu_shim_startup_lifted pe_map ctest --preset $preset --no-tests=error -R '^(cpu_native_shim_startup|cpu_shim_compute_(warp|hardware))$' } ``` Three tests in each configuration. The 4096- and 8192-byte cases both pass attribute 0xa8004000, dispatch once with different seeds, read back 16 bytes, free once and exit 42. The SIZE_MAX case gets null from XMemAlloc, performs zero compute dispatches and frees, publishes zero compute bytes and exits 17. The original startup allocation and both missing-provider controls still run in the baseline test. The experiment and expected byte strings are documented in docs/experiments.md. Source-built fixtures under the project's MIT license. AI-assisted implementation and verification.
upstream-sync closed this pull request 2026-11-24 06:43:30 +00:00
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
R0Y00/Xbox2Windows!519
No description provided.