Compare commits

...
Author SHA1 Message Date
atharvranjan 9ae6d1ee70 research: record independent D3DMetal memory probes for #473
Signed-off-by: Arths17 <Atharvranjan8@gmail.com>
2026-11-26 13:31:00 -06:00
15 changed files with 1433 additions and 0 deletions

No files matched your search

+1
View File
@@ -10,6 +10,7 @@ Guest execution uses original, purpose-built test programs. Commercial Xbox game
remains unsupported.
### Added
- Added the collaborative D3DMetal memory research workspace for #473, with an original six-check standalone probe, an isolated CrossOver runner and two raw Apple M4 run records. This host returned E_NOTIMPL for both existing-memory heap opens, while custom L0 heaps and fence-synchronized persistent-map buffer readback matched. Physical zero-copy, memory overhead, other Apple Silicon generations and independent acceptance remain unverified; #464 production implementation is unchanged.
- Added `docs/research/d3dmetal-gpu-limits.md` and `tests/conformance/test_d3dmetal_gpu_limits/` (#453). The fixture is an original D3D12 compute test that loads the host `d3d12.dll` directly, with four original HLSL kernels and committed DXC 1.9.2609 output (`shaders/compile.sh` regenerates them). It skips with exit 77 below shader model 6.6. Required checks:
- a kernel without `WaveSize` runs, and its lane indices form a permutation within each wave;
- a per-texel spin lock with acquire and release fences and a 1024-try cap emulates 64-bit add and max with no dropped update and exact values.
+2
View File
@@ -18,6 +18,8 @@
## Research, Testing & Licensing
- [D3DMetal Unified-Memory and Zero-Copy Research](research/d3dmetal-zero-copy/README.md) — Shared six-check synthetic probe, per-host raw logs and evidence limits for #473 / #464.
- [Hybrid Workloads & Measurement Protocol](testing/hybrid-workloads.md) — Original Windows workloads, receipt fields, timing conventions, and negative controls.
- [CrossOver Licensing & Redistribution Boundaries](research/crossover-licensing.md) — Per-component license review for CrossOver, Wine, DXMT, DXVK, VKD3D-Proton, MoltenVK, D3DMetal, and Rosetta 2.
- [Upstream Research Registry](research/upstream-registry.md) & [Component Reuse Matrix](research/component-reuse-matrix.md) — Public upstream evaluation and provenance screening.
@@ -0,0 +1,3 @@
# Preserve Windows stdout/stderr bytes as recorded, including CRLF line endings.
results/**/stdout.txt -text whitespace=cr-at-eol
results/**/stderr.txt -text whitespace=cr-at-eol
@@ -0,0 +1,95 @@
# D3DMetal unified-memory and zero-copy research
Collaborative research for [#473](https://github.com/MacosPorters/betterxen/issues/473), informing [#464](https://github.com/MacosPorters/betterxen/issues/464). Maintainer-agreed participants are @Arths17, @skakwy and @CarReal8917; participation is not an exclusive claim. The shared branch is [`research/d3dmetal-zero-copy`](https://github.com/MacosPorters/betterxen/tree/research/d3dmetal-zero-copy). It is based on `origin/main` commit `f7fb52bc56f671f9da7109f8aef8d3f04de59aee` and is not being merged into main.
This directory contains an original synthetic probe, a runner, separate run records and [consolidated findings](findings.md). It neither imports nor tests the production `xmem` or `d3d12_xs` implementation. @devil8blade retains the implementation of #464. Findings here do not certify that implementation or establish Xbox compatibility.
## Build and run
Requirements: Apple Silicon macOS, an externally installed licensed CrossOver with D3DMetal, supported Rosetta 2, Python 3.11+, and native ARM64 MinGW-w64 cross-compiler tools. Nothing proprietary is downloaded or bundled. The compiler is an ARM64 host executable; its output is a Windows x86-64 guest executable.
Use an existing **win64** CrossOver bottle. The runner copies it into a fresh scratch directory, changes only that temporary copy, builds outside the checkout, selects D3DMetal, runs with `ROSETTA_ADVERTISE_AVX=1`, and enforces a **30-second** process timeout. No BetterXen shim directory is added to the search path. It prints the resolved `d3d12.dll` path and checks that `d3d12_xs.dll` is absent. The original bottle and the checkout are not written by the runner.
```sh
# Fetch this branch even in a clone that normally fetches only main.
git fetch origin research/d3dmetal-zero-copy:refs/remotes/origin/research/d3dmetal-zero-copy
git worktree add --detach ../betterxen-zero-copy origin/research/d3dmetal-zero-copy
cd ../betterxen-zero-copy
python3 docs/research/d3dmetal-zero-copy/run.py \
--bottle "/absolute/path/to/an/existing/CrossOver/bottle" \
--scratch /tmp/bx-uma-verify/run-01
```
The scratch directory must not exist. `--crossover /Applications/CrossOver.app` and `--compiler x86_64-w64-mingw32-g++` select non-default installations. Existing bottle configuration can affect a run; record relevant settings and verify the loaded backend. The runner uses a small child-environment allowlist and never forwards host credential variables.
The runner invokes this compilation, with absolute scratch paths in the actual receipt:
```sh
x86_64-w64-mingw32-g++ -std=c++20 -O2 -static -static-libgcc -static-libstdc++ \
-Wall -Wextra -Werror probe.cpp -o probe.exe -lkernel32
```
Outputs are `probe.cpp`, `probe.exe`, `receipt.json`, `stdout.txt` and `stderr.txt`. The receipt records source/executable SHA-256, compiler command/result, PE format/imports, host, software, environment and run outcome. Temporary bottle contents are removed after its private wineserver is stopped. The caller removes the remaining scratch files **after preserving the selected research records**.
Two launch attempts in the initial experiment stopped before the probe because the host ClamAV database was absent. For the original executable compiled locally from this source, the temporary bottle uses `AllowUntrusted=1` and `AntiVirusScan=untrusted`; the source bottle's scanner settings are unchanged. This does not bypass any dependency license or activation requirement.
## Fixed six-check baseline
Do not change these checks to improve an outcome. Unsupported HRESULTs and not-run paths are evidence, not passes. Exit 0 means no observed data/submission mismatch; it does **not** mean every capability is supported. Inspect each printed result.
| Check | Fixed experiment |
| --- | --- |
| 1: device | Obtain `ID3D12Device3`; query `ARCHITECTURE1` (`UMA`, `CacheCoherentUMA`, `TileBasedRenderer`, `IsolatedMMU`) and `D3D12_OPTIONS.ResourceHeapTier`. |
| 2: existing memory | `OpenExistingHeapFromAddress` on 64 KiB `VirtualAlloc` (`MEM_COMMIT\|MEM_RESERVE`, `PAGE_READWRITE`); `OpenExistingHeapFromFileMapping` on 64 KiB anonymous read/write mapping. Print HRESULTs; if supported, place a buffer and check CPU writes by GPU readback with no staging upload. |
| 3: custom/placement | Six heap cases: WRITE_BACK/L0/ALLOW_ALL; WRITE_COMBINE/L0/ALLOW_ALL; WRITE_BACK/L0 with each of the three ALLOW_ONLY restrictions; WRITE_BACK/L1/ALLOW_ALL control. Place a UAV-capable buffer and 64×64 RGBA8 texture together on one WRITE_BACK/L0 heap at disjoint allocation-info-aligned offsets; run `WriteToSubresource`/`ReadFromSubresource` round-trip. |
| 4: persistent Map | Two CPU→GPU copies with different magic pairs, followed by UPLOAD→placed GPU copy and direct CPU read through the original pointer. Fence after each; no buffer Unmap/remap or CPU→GPU staging upload in the forward direction. |
| 5: latency | WRITE_BACK/L0 at 64 KiB and 256 MiB; WRITE_COMBINE/L0 at 256 MiB; UPLOAD at 256 MiB, in that order. Touch each 64 KiB interval before timing, then 5 warmups and 40 timed submissions. Every iteration updates offsets 0 and size−64, copies 64 bytes from each end to READBACK and checks all 32 words after its fence. Print total ms, average ms/submit, N/40 and warmup matches. |
| 6: dirty pages | 64 KiB `MEM_WRITE_WATCH`; write bytes at offsets 0 and 16384; `GetWriteWatch(WRITE_WATCH_FLAG_RESET,...)`; print return, count, granularity and dirty offsets. |
All CUSTOM test heaps use explicit CPU-page and memory-pool properties; UPLOAD uses the standard heap type. The six creation cases use 2 MiB heaps, mixed placement uses 2 MiB, and the persistent coherence buffer uses a 64 KiB heap. The latency tests use exactly the named buffer/heap sizes and copy only 128 bytes per submit. READBACK buffers are 128 bytes. Latency includes CPU writes, command-list reset/encoding, transitions, queue submission, fence wait, device-status query and comparison; it is not GPU-only time. Prefault and warmups are excluded. No API-validation or verbose loader tracing is enabled in the timed baseline.
The 64 KiB prefault stride follows the requested experiment; it does not touch every physical 16 KiB host page in the 256 MiB region. A separately named, fully resident memory-overhead experiment is needed before interpreting resident allocation sizes.
## Synchronization and lifetime
The CPU finishes stores and executes an x86 store fence before submission. Each submission has its own D3D12 fence value and a bounded event wait. CUSTOM buffers transition from COMMON to COPY_SOURCE/COPY_DEST and back; UPLOAD stays GENERIC_READ and READBACK stays COPY_DEST. The CPU overwrites or reads GPU-used memory only after the previous fence. Resources remain mapped until release, with placed resources destroyed before their heaps. Wrapping allocations, mapping views and mapping handles are retained through any successful visibility test and released after resources and GPU completion.
The texture is in COMMON, mapped with a null output pointer before the CPU subresource methods, then unmapped after that separate round-trip. A CPU texture round-trip is not a GPU texture coherence test. The baseline does not test simultaneous CPU/GPU access, atomic interoperability, console flush APIs, multiple queues, aliasing barriers, resource reuse while work is in flight, render-target/depth texture placement, other formats or texture GPU readback.
These rules follow the public [Map contract](https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12resource-map), [resource barriers](https://learn.microsoft.com/en-us/windows/win32/direct3d12/using-resource-barriers-to-synchronize-resource-states-in-direct3d-12) and [CPU texture access requirements](https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12resource-writetosubresource). They do not establish console semantics.
## Backend receipt and supplemental investigations
A selected setting is insufficient to identify the backend. For a **separate, untimed diagnostic** use a new scratch directory:
```sh
python3 docs/research/d3dmetal-zero-copy/run.py \
--bottle "/absolute/path/to/an/existing/CrossOver/bottle" \
--scratch /tmp/bx-uma-verify/backend-receipt --receipt-only
```
This mode only creates a device, repeats existing-memory wrapping, and pauses for 10 seconds to permit OS loaded-library inspection; it does not replace or change the six-check baseline. The runner enables `--debugmsg -all,+loaddll,+d3d12`. Inspect the specific probe PID with `lsof -n -p <pid>` or `vmmap <pid>` and preserve the app's `apple_gptk/.../d3d12.dll`, `dxgi.dll` and `D3DMetal.framework` paths. Sample only the intended process, not another contributor's Wine session. Avoid including account names or personal paths in committed diagnostics; disclose any excerpts/redactions. The initial runtime inspection is recorded as an excerpt in its run directory.
Supplemental experiments must be versioned separately and must not alter baseline sizes, checks or iteration counts. Follow-up work includes:
- Resident/physical memory at allocation, prefault, submission and retirement; record measurement tool, baselines, page residency, compression, pressure and variability. Virtual size alone is insufficient.
- Copy profiling that distinguishes shared storage, full-buffer shadow copies and dirty-page copies. Similar small-copy latency is consistent with sharing but does not prove physical aliasing or absence of internal copies.
- GPU texture readback/coherence by format/layout and render/depth usage. Buffer success does not establish these.
- Dirty-page fallback with reset/rearming races, alignment, coalescing, explicit copies, budget accounting and concurrent writes. Baseline `GetWriteWatch` success does not establish a working fallback.
## Independent results and acceptance
Create a new `results/<date>-<chip>-<contributor>-<run>/` directory for every run. Retain raw benchmark stdout/stderr unedited (the local `.gitattributes` preserves their Windows CRLF bytes), exact software/hardware receipts, timeout/exit status, backend evidence, source revision/hash and run limitations. Do not commit the executable, bottle, caches, proprietary frameworks or credentials. A result owner may append new runs; do not rewrite another contributor's measurements. DCO-sign commits with the contributor's existing Git identity and push normally without force. If another contributor updated the shared branch, fetch and reconcile before pushing.
An independent reviewer must re-derive expected values and API legality from primary sources. The author of this probe has not certified it independently. Require independent results from at least two contributors on at least two Apple Silicon generations, with repeated sessions before scaling claims. M1–M5 are coverage targets, not measured support. Follow the full evidence checklist in #473; unresolved mechanisms remain class U. Hardware readbacks are local class A observations, not independent acceptance or Xbox hardware validation.
## Provenance and primary sources
`probe.cpp` and `run.py` are newly authored synthetic research under the repository's GPL-3.0-or-later license. No upstream implementation or emulator code was copied. MinGW-w64 14.0.0 headers and GCC 16.2.0 are externally installed build tools on the initial host. CrossOver 26.3.0.39832, D3DMetal 3.0 and Rosetta 2 are externally installed runtime components; nothing proprietary is redistributed. Existing [upstream registry](../upstream-registry.md) and [reuse matrix](../component-reuse-matrix.md) cover runtime research; this work adds no vendored dependency. Review exact file licenses and update those records before adopting any future third-party source.
Public API references used to author and review the experiments:
- [Architecture1 flags](https://learn.microsoft.com/en-us/windows/win32/api/d3d12/ns-d3d12-d3d12_feature_data_architecture1) and [heap properties](https://learn.microsoft.com/en-us/windows/win32/api/d3d12/ns-d3d12-d3d12_heap_properties).
- [OpenExistingHeapFromAddress](https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12device3-openexistingheapfromaddress) and [OpenExistingHeapFromFileMapping](https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12device3-openexistingheapfromfilemapping).
- [CreatePlacedResource](https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12device-createplacedresource), [Map](https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12resource-map), [WriteToSubresource](https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12resource-writetosubresource) and [ReadFromSubresource](https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12resource-readfromsubresource).
- [GetWriteWatch](https://learn.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-getwritewatch).
@@ -0,0 +1,55 @@
# Version-scoped findings
Research issue [#473](https://github.com/MacosPorters/betterxen/issues/473); methodology and limitations are in the [research README](README.md). This is a one-host observation, independent of #464's production implementation. The newly written probe still needs independent source review and reproduction by another contributor.
## Recorded host and runtime
Both sessions used Apple M4; unified RAM 25769803776 bytes (24 GiB); macOS 27.0, build 26A428; CrossOver public 26.3.0, product 26.3.0.39832, build tag cxoffice-26.3.0rc2, timestamp 20260715T103801Z; D3DMetal framework short/build version 3.0, SourceVersion 32047000000000; Rosetta package 1.0.0.0.1788432274; Windows 11 template win11_64 / WineArch win64; native ARM64 GCC 16.2.0 / MinGW-w64 14.0.0_3. The source bottle was copied into a temporary private prefix. ROSETTA_ADVERTISE_AVX=1 and CX_GRAPHICS_BACKEND=d3dmetal were set; timed runs had WINEDEBUG=-all.
Loaded-library inspection in a separate diagnostic confirmed the app's apple_gptk D3D12 DLL, DXGI DLL, D3DMetal framework and Rosetta runtime. The guest reported no d3d12_xs.dll. No timed-run stderr or method-specific D3DMetal log message was emitted. Unsupported calls returned their printed HRESULTs.
## Baseline outcomes
These exact outcomes agreed in both local sessions:
| Experiment | Observation | Evidence scope |
| --- | --- | --- |
| Architecture | UMA=0, CacheCoherentUMA=0, TileBasedRenderer=0, IsolatedMMU=0; ResourceHeapTier=2 | API-reported values, not a description of the Mac's physical topology |
| Existing-memory opens | Address and mapping both 0x80004001 (E_NOTIMPL) | CPU visibility through these heaps not tested because no heap opened |
| CUSTOM heaps | All five WRITE_BACK/WRITE_COMBINE L0 cases 0x00000000; WRITE_BACK/L1 control 0x80070057 (E_INVALIDARG) | Creation only for restricted heap cases; no render/depth texture usage tested |
| Mixed placement | UAV-capable 64 KiB buffer at 0; 64×64 RGBA8 texture at 65536; both alive on one heap | Texture CPU round-trip 4096/4096 words; no GPU texture readback |
| CPU→GPU persistent map | 11223344/A1B2C3D4 then 55AA00FF/F00DBA5E both matched | Fence-separated buffer copies; no Unmap/remap or staging upload |
| GPU→CPU persistent map | C001D00D/9E3779B9 matched at original CPU pointer | GPU copy from UPLOAD, fence, direct CPU read |
| Dirty-page tracking | Return 0; count 2; granularity 4096; offsets 0 and 16384 | Single allocation/reset query; fallback correctness not established |
Hardware execution is local class A evidence within these workloads. Public D3D12 API contracts are class B; internal sharing/copy mechanism and cross-generation behavior are class U. These are not independent acceptance or Xbox compatibility claims.
## Latency observations
Each row has 5/5 warmup matches and 40/40 timed matches. Size increases by 4096× between the two WRITE_BACK cases. Each submission copies just 128 bytes; timings include CPU encoding, fence synchronization and validation.
| Session | Case | Total ms / 40 | Average ms/submit | Exact matches |
| --- | --- | ---: | ---: | ---: |
| Initial | WRITE_BACK/L0 64 KiB | 20.635900 | 0.515898 | 40/40 |
| Initial | WRITE_BACK/L0 256 MiB | 30.937300 | 0.773432 | 40/40 |
| Initial | WRITE_COMBINE/L0 256 MiB | 11.762100 | 0.294052 | 40/40 |
| Initial | UPLOAD 256 MiB | 10.118800 | 0.252970 | 40/40 |
| Shared-runner verification | WRITE_BACK/L0 64 KiB | 11.558300 | 0.288957 | 40/40 |
| Shared-runner verification | WRITE_BACK/L0 256 MiB | 11.961700 | 0.299042 | 40/40 |
| Shared-runner verification | WRITE_COMBINE/L0 256 MiB | 9.973900 | 0.249347 | 40/40 |
| Shared-runner verification | UPLOAD 256 MiB | 8.198200 | 0.204955 | 40/40 |
The two sizes do not show latency proportional to the 4096× size difference in these sessions. This is consistent with shared storage or a sparse-copy mechanism; it does not establish O(1) behavior generally, physical aliasing, or guaranteed zero-copy. The machine was not idle; a background C++ language-service process was observed using about one CPU core before the initial run. Session variation is substantial, and no statistical confidence or performance improvement is claimed.
## Raw records
- [Initial stdout](results/2026-11-26-apple-m4-arths17-initial/stdout.txt), [stderr](results/2026-11-26-apple-m4-arths17-initial/stderr.txt), [receipt](results/2026-11-26-apple-m4-arths17-initial/receipt.json), [backend excerpt and launch notes](results/2026-11-26-apple-m4-arths17-initial/backend-receipt.txt).
- [Shared-runner stdout](results/2026-11-26-apple-m4-arths17-runner/stdout.txt), [stderr](results/2026-11-26-apple-m4-arths17-runner/stderr.txt), [receipt](results/2026-11-26-apple-m4-arths17-runner/receipt.json). This run records the exact published source hash and executed PE hash. The initial executable was not retained/hashed before the diagnostic extension was added; its incomplete receipt is explicitly marked.
## Unresolved work for the collaborators
1. Independently review the probe against public contracts and reproduce the same source revision on another Apple Silicon generation; append independent raw logs and repeated timing sessions.
2. Measure resident/physical memory and internal copy activity in a separately named supplemental experiment. Neither was measured here. A 64 KiB prefault stride does not make every host page resident; do not infer a second 256 MiB allocation from virtual size or these timings.
3. Establish GPU texture coherence/readback, format/layout and render/depth restrictions separately. The current texture check is only a CPU round-trip.
4. Verify lifetime/reuse, dirty-page rearming/reset races and explicit fallback copying where necessary. The baseline only serializes accesses with per-submission fences.
5. Give #464 evidence-scoped recommendations: these runtime versions reject both caller-memory wrapping APIs, while host-allocated custom L0 heaps support the observed buffer access. This does not supply an arbitrary-xmem-to-heap bridge, justify silent fallbacks or permit console flush operations to become no-ops.
+253
View File
@@ -0,0 +1,253 @@
// SPDX-License-Identifier: GPL-3.0-or-later
// Original synthetic public-D3D12 research probe; issue #473.
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
#include <windows.h>
#include <d3d12.h>
#include <tlhelp32.h>
#include <emmintrin.h>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <vector>
#include <utility>
template<class T> struct Ptr {
T* p=nullptr;
Ptr()=default; Ptr(const Ptr&)=delete; Ptr& operator=(const Ptr&)=delete;
~Ptr(){if(p)p->Release();}
T* operator->()const{return p;}
explicit operator bool()const{return p!=nullptr;}
void** out(){return reinterpret_cast<void**>(&p);}
};
static int failures=0;
static bool hr(const char* label,HRESULT h){
std::printf("%s HRESULT=0x%08lX\n",label,static_cast<unsigned long>(h));
return SUCCEEDED(h);
}
static D3D12_HEAP_PROPERTIES props(D3D12_HEAP_TYPE type,D3D12_CPU_PAGE_PROPERTY cpu=D3D12_CPU_PAGE_PROPERTY_UNKNOWN,D3D12_MEMORY_POOL pool=D3D12_MEMORY_POOL_UNKNOWN){
D3D12_HEAP_PROPERTIES p{};p.Type=type;p.CPUPageProperty=cpu;p.MemoryPoolPreference=pool;p.CreationNodeMask=1;p.VisibleNodeMask=1;return p;
}
static D3D12_RESOURCE_DESC buffer(UINT64 n,D3D12_RESOURCE_FLAGS flags=D3D12_RESOURCE_FLAG_NONE){
D3D12_RESOURCE_DESC d{};d.Dimension=D3D12_RESOURCE_DIMENSION_BUFFER;d.Width=n;d.Height=1;d.DepthOrArraySize=1;d.MipLevels=1;d.SampleDesc.Count=1;d.Layout=D3D12_TEXTURE_LAYOUT_ROW_MAJOR;d.Flags=flags;return d;
}
static bool heap(ID3D12Device3* d,UINT64 size,D3D12_CPU_PAGE_PROPERTY cpu,D3D12_MEMORY_POOL pool,D3D12_HEAP_FLAGS flags,Ptr<ID3D12Heap>& h,const char* label){
D3D12_HEAP_DESC desc{};desc.SizeInBytes=size;desc.Properties=props(D3D12_HEAP_TYPE_CUSTOM,cpu,pool);desc.Alignment=65536;desc.Flags=flags;
return hr(label,d->CreateHeap(&desc,__uuidof(ID3D12Heap),h.out()));
}
static bool committed(ID3D12Device3* d,UINT64 n,D3D12_HEAP_TYPE type,D3D12_RESOURCE_STATES state,Ptr<ID3D12Resource>& r,const char* label){
auto p=props(type);auto b=buffer(n);
return hr(label,d->CreateCommittedResource(&p,D3D12_HEAP_FLAG_NONE,&b,state,nullptr,__uuidof(ID3D12Resource),r.out()));
}
struct Engine {
ID3D12Device3* dev;
Ptr<ID3D12CommandQueue> queue;Ptr<ID3D12CommandAllocator> alloc;Ptr<ID3D12GraphicsCommandList> list;Ptr<ID3D12Fence> fence;
HANDLE event=nullptr;UINT64 sequence=0;
explicit Engine(ID3D12Device3* d):dev(d){}
~Engine(){if(event)CloseHandle(event);}
bool init(){
D3D12_COMMAND_QUEUE_DESC q{};q.Type=D3D12_COMMAND_LIST_TYPE_DIRECT;
if(!hr("queue",dev->CreateCommandQueue(&q,__uuidof(ID3D12CommandQueue),queue.out())))return false;
if(!hr("allocator",dev->CreateCommandAllocator(q.Type,__uuidof(ID3D12CommandAllocator),alloc.out())))return false;
if(!hr("command_list",dev->CreateCommandList(0,q.Type,alloc.p,nullptr,__uuidof(ID3D12GraphicsCommandList),list.out())))return false;
if(!hr("initial_close",list->Close()))return false;
if(!hr("fence",dev->CreateFence(0,D3D12_FENCE_FLAG_NONE,__uuidof(ID3D12Fence),fence.out())))return false;
event=CreateEventW(nullptr,FALSE,FALSE,nullptr);
std::printf("fence_event success=%d error=%lu\n",event!=nullptr,event?0:GetLastError());return event!=nullptr;
}
bool begin(){
HRESULT h=alloc->Reset();if(FAILED(h))return hr("allocator.Reset",h);
h=list->Reset(alloc.p,nullptr);if(FAILED(h))return hr("list.Reset",h);return true;
}
void transition(ID3D12Resource* r,D3D12_RESOURCE_STATES from,D3D12_RESOURCE_STATES to){
if(from==to)return;
D3D12_RESOURCE_BARRIER b{};b.Type=D3D12_RESOURCE_BARRIER_TYPE_TRANSITION;b.Transition.pResource=r;b.Transition.StateBefore=from;b.Transition.StateAfter=to;b.Transition.Subresource=D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES;list->ResourceBarrier(1,&b);
}
bool submit(){
HRESULT h=list->Close();if(FAILED(h))return hr("list.Close",h);
_mm_sfence();
ID3D12CommandList* lists[]={list.p};queue->ExecuteCommandLists(1,lists);
h=queue->Signal(fence.p,++sequence);if(FAILED(h))return hr("queue.Signal",h);
if(fence->GetCompletedValue()<sequence){
h=fence->SetEventOnCompletion(sequence,event);if(FAILED(h))return hr("fence.SetEventOnCompletion",h);
DWORD w=WaitForSingleObject(event,5000);if(w!=WAIT_OBJECT_0){std::printf("fence_wait result=0x%08lX last_error=%lu\n",w,GetLastError());return false;}
}
h=dev->GetDeviceRemovedReason();if(FAILED(h))return hr("device_removed",h);return true;
}
bool readEnds(ID3D12Resource* source,UINT64 n,D3D12_RESOURCE_STATES state,ID3D12Resource* dest){
if(!begin())return false;
const bool needsBarrier=(state & D3D12_RESOURCE_STATE_COPY_SOURCE)==0;
if(needsBarrier)transition(source,state,D3D12_RESOURCE_STATE_COPY_SOURCE);
list->CopyBufferRegion(dest,0,source,0,64);
list->CopyBufferRegion(dest,64,source,n-64,64);
if(needsBarrier)transition(source,D3D12_RESOURCE_STATE_COPY_SOURCE,state);
return submit();
}
};
static void modules(){
HANDLE s=CreateToolhelp32Snapshot(TH32CS_SNAPMODULE,GetCurrentProcessId());
MODULEENTRY32 m{};m.dwSize=sizeof(m);
if(s!=INVALID_HANDLE_VALUE){
if(Module32First(s,&m))do{
if(strstr(m.szModule,"d3d12")||strstr(m.szModule,"dxgi"))std::printf("module %s path=%s\n",m.szModule,m.szExePath);
}while(Module32Next(s,&m));CloseHandle(s);
}
std::printf("d3d12_xs_loaded=%d\n",GetModuleHandleA("d3d12_xs.dll")!=nullptr);
}
static void wrapping(ID3D12Device3* d,Engine* e){
std::puts("[2] Existing-memory wrapping (64 KiB)");
void* mem=VirtualAlloc(nullptr,65536,MEM_COMMIT|MEM_RESERVE,PAGE_READWRITE);
std::printf("VirtualAlloc success=%d error=%lu\n",mem!=nullptr,mem?0:GetLastError());
HANDLE mapping=CreateFileMappingW(INVALID_HANDLE_VALUE,nullptr,PAGE_READWRITE,0,65536,nullptr);
std::printf("CreateFileMappingW success=%d error=%lu\n",mapping!=nullptr,mapping?0:GetLastError());
void* view=mapping?MapViewOfFile(mapping,FILE_MAP_ALL_ACCESS,0,0,65536):nullptr;
if(mapping)std::printf("MapViewOfFile success=%d error=%lu\n",view!=nullptr,view?0:GetLastError());
{
Ptr<ID3D12Heap> a,f;
if(mem)hr("OpenExistingHeapFromAddress",d->OpenExistingHeapFromAddress(mem,__uuidof(ID3D12Heap),a.out()));
if(mapping)hr("OpenExistingHeapFromFileMapping",d->OpenExistingHeapFromFileMapping(mapping,__uuidof(ID3D12Heap),f.out()));
for(int i=0;i<2;++i){
ID3D12Heap* h=i?f.p:a.p;auto* cpu=static_cast<volatile uint32_t*>(i?view:mem);
const char* label=i?"file_mapping_visibility":"address_visibility";
if(!h){std::printf("%s NOT_RUN (heap open failed)\n",label);continue;}
if(!cpu||!e){std::printf("%s NOT_RUN (missing CPU view or queue)\n",label);continue;}
Ptr<ID3D12Resource> placed,readback;auto b=buffer(65536);
if(!hr(label,d->CreatePlacedResource(h,0,&b,D3D12_RESOURCE_STATE_COMMON,nullptr,__uuidof(ID3D12Resource),placed.out())))continue;
if(!committed(d,128,D3D12_HEAP_TYPE_READBACK,D3D12_RESOURCE_STATE_COPY_DEST,readback,"wrap_readback"))continue;
void* p=nullptr;D3D12_RANGE range{0,128};if(!hr("wrap_readback.Map",readback->Map(0,&range,&p)))continue;
cpu[0]=0x13579BDFu;cpu[(65536-64)/4]=0x2468ACE0u;_mm_sfence();
bool submitted=e->readEnds(placed.p,65536,D3D12_RESOURCE_STATE_COMMON,readback.p);
auto* actual=static_cast<volatile uint32_t*>(p);bool ok=submitted&&actual[0]==0x13579BDFu&&actual[16]==0x2468ACE0u;
std::printf("%s actual=%08X,%08X expected=13579BDF,2468ACE0 match=%d\n",label,actual[0],actual[16],ok);if(!ok)++failures;
}
}
if(view)UnmapViewOfFile(view);
if(mapping)CloseHandle(mapping);
if(mem)VirtualFree(mem,0,MEM_RELEASE);
}
static void placement(ID3D12Device3* d){
std::puts("[3] CUSTOM heap creation (size=2097152 alignment=65536)");
const D3D12_HEAP_FLAGS flags[]={D3D12_HEAP_FLAG_NONE,D3D12_HEAP_FLAG_NONE,D3D12_HEAP_FLAG_ALLOW_ONLY_BUFFERS,D3D12_HEAP_FLAG_ALLOW_ONLY_NON_RT_DS_TEXTURES,D3D12_HEAP_FLAG_ALLOW_ONLY_RT_DS_TEXTURES,D3D12_HEAP_FLAG_NONE};
const char* labels[]={"WRITE_BACK/L0/ALLOW_ALL","WRITE_COMBINE/L0/ALLOW_ALL","WRITE_BACK/L0/ALLOW_ONLY_BUFFERS","WRITE_BACK/L0/ALLOW_ONLY_NON_RT_DS_TEXTURES","WRITE_BACK/L0/ALLOW_ONLY_RT_DS_TEXTURES","WRITE_BACK/L1/ALLOW_ALL control"};
for(int i=0;i<6;++i){Ptr<ID3D12Heap> h;heap(d,2097152,i==1?D3D12_CPU_PAGE_PROPERTY_WRITE_COMBINE:D3D12_CPU_PAGE_PROPERTY_WRITE_BACK,i==5?D3D12_MEMORY_POOL_L1:D3D12_MEMORY_POOL_L0,flags[i],h,labels[i]);}
Ptr<ID3D12Heap> h;if(!heap(d,2097152,D3D12_CPU_PAGE_PROPERTY_WRITE_BACK,D3D12_MEMORY_POOL_L0,D3D12_HEAP_FLAG_NONE,h,"mixed_heap")){std::puts("mixed placement NOT_RUN");return;}
Ptr<ID3D12Resource> b,t;auto bd=buffer(65536,D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS);
bool bok=hr("placed_UAV_buffer offset=0",d->CreatePlacedResource(h.p,0,&bd,D3D12_RESOURCE_STATE_COMMON,nullptr,__uuidof(ID3D12Resource),b.out()));
D3D12_RESOURCE_DESC td{};td.Dimension=D3D12_RESOURCE_DIMENSION_TEXTURE2D;td.Width=64;td.Height=64;td.DepthOrArraySize=1;td.MipLevels=1;td.Format=DXGI_FORMAT_R8G8B8A8_UNORM;td.SampleDesc.Count=1;td.Layout=D3D12_TEXTURE_LAYOUT_UNKNOWN;
auto ba=d->GetResourceAllocationInfo(0,1,&bd);auto ta=d->GetResourceAllocationInfo(0,1,&td);
if(!ta.Alignment||ba.SizeInBytes==~UINT64(0)||ta.SizeInBytes==~UINT64(0)){std::puts("invalid allocation info; texture NOT_RUN");return;}
UINT64 off=(ba.SizeInBytes+ta.Alignment-1)/ta.Alignment*ta.Alignment;
std::printf("buffer allocation size=%llu alignment=%llu; texture size=%llu alignment=%llu offset=%llu\n",ba.SizeInBytes,ba.Alignment,ta.SizeInBytes,ta.Alignment,off);
bool tok=hr("placed_RGBA8_texture same_heap",d->CreatePlacedResource(h.p,off,&td,D3D12_RESOURCE_STATE_COMMON,nullptr,__uuidof(ID3D12Resource),t.out()));
std::printf("mixed_buffer_and_texture_live=%d\n",bok&&tok);
if(!tok)return;
HRESULT mapped=t->Map(0,nullptr,nullptr);if(!hr("texture.Map(null ppData)",mapped)){std::puts("texture roundtrip NOT_RUN");return;}
std::vector<uint32_t> input(4096),output(4096,0xDEADBEEFu);for(size_t i=0;i<input.size();++i)input[i]=0x8A31C57Fu^(uint32_t(i)*0x0103070Bu);
HRESULT w=t->WriteToSubresource(0,nullptr,input.data(),256,16384);hr("texture.WriteToSubresource",w);
HRESULT r=t->ReadFromSubresource(output.data(),256,16384,0,nullptr);hr("texture.ReadFromSubresource",r);
size_t matches=0;for(size_t i=0;i<input.size();++i)matches+=input[i]==output[i];
std::printf("texture roundtrip exact_words=%zu/4096 match=%d\n",matches,SUCCEEDED(w)&&SUCCEEDED(r)&&matches==4096);
if(FAILED(w)||FAILED(r)||matches!=4096)++failures;
// The texture test is separate from the persistent buffer tests.
t->Unmap(0,nullptr);
}
static void coherence(ID3D12Device3* d,Engine& e){
std::puts("[4] Bidirectional persistent Map; no Unmap or remap");
Ptr<ID3D12Heap> h;Ptr<ID3D12Resource> b,readback,upload;
if(!heap(d,65536,D3D12_CPU_PAGE_PROPERTY_WRITE_BACK,D3D12_MEMORY_POOL_L0,D3D12_HEAP_FLAG_NONE,h,"coherence_heap"))return;
auto bd=buffer(65536,D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS);
if(!hr("coherence_placed_UAV_buffer",d->CreatePlacedResource(h.p,0,&bd,D3D12_RESOURCE_STATE_COMMON,nullptr,__uuidof(ID3D12Resource),b.out())))return;
if(!committed(d,128,D3D12_HEAP_TYPE_READBACK,D3D12_RESOURCE_STATE_COPY_DEST,readback,"coherence_readback"))return;
if(!committed(d,65536,D3D12_HEAP_TYPE_UPLOAD,D3D12_RESOURCE_STATE_GENERIC_READ,upload,"coherence_upload"))return;
void *cp=nullptr,*rp=nullptr,*up=nullptr;D3D12_RANGE rr{0,128},none{0,0};
if(!hr("placed.Map",b->Map(0,nullptr,&cp)))return;
if(!hr("readback.Map",readback->Map(0,&rr,&rp)))return;
if(!hr("upload.Map",upload->Map(0,&none,&up)))return;
auto* cpu=static_cast<volatile uint32_t*>(cp);auto* actual=static_cast<volatile uint32_t*>(rp);
const uint32_t values[3][2]={{0x11223344u,0xA1B2C3D4u},{0x55AA00FFu,0xF00DBA5Eu},{0xC001D00Du,0x9E3779B9u}};
for(int i=0;i<2;++i){
cpu[0]=values[i][0];cpu[1]=values[i][1];_mm_sfence();
bool submitted=e.readEnds(b.p,65536,D3D12_RESOURCE_STATE_COMMON,readback.p);
bool ok=submitted&&actual[0]==values[i][0]&&actual[1]==values[i][1];
std::printf("CPU->GPU round=%d expected=%08X,%08X actual=%08X,%08X match=%d\n",i+1,values[i][0],values[i][1],actual[0],actual[1],ok);if(!ok)++failures;
}
auto* src=static_cast<volatile uint32_t*>(up);src[0]=values[2][0];src[1]=values[2][1];_mm_sfence();
if(!e.begin())return;
e.transition(b.p,D3D12_RESOURCE_STATE_COMMON,D3D12_RESOURCE_STATE_COPY_DEST);
e.list->CopyBufferRegion(b.p,0,upload.p,0,8);
e.transition(b.p,D3D12_RESOURCE_STATE_COPY_DEST,D3D12_RESOURCE_STATE_COMMON);
bool submitted=e.submit();bool ok=submitted&&cpu[0]==values[2][0]&&cpu[1]==values[2][1];
std::printf("GPU->CPU same_cpu_ptr expected=%08X,%08X actual=%08X,%08X match=%d\n",values[2][0],values[2][1],cpu[0],cpu[1],ok);if(!ok)++failures;
}
static void benchmark(ID3D12Device3* d,Engine& e,const char* label,UINT64 n,bool isUpload,D3D12_CPU_PAGE_PROPERTY property){
std::printf("[5] BENCH %s size=%llu warmup=5 timed=40\n",label,n);
Ptr<ID3D12Heap> h;Ptr<ID3D12Resource> b,r;
D3D12_RESOURCE_STATES state=isUpload?D3D12_RESOURCE_STATE_GENERIC_READ:D3D12_RESOURCE_STATE_COMMON;
if(isUpload){if(!committed(d,n,D3D12_HEAP_TYPE_UPLOAD,state,b,"bench_upload"))return;}
else{
if(!heap(d,n,property,D3D12_MEMORY_POOL_L0,D3D12_HEAP_FLAG_NONE,h,"bench_heap"))return;
auto bd=buffer(n);if(!hr("bench_placed_buffer",d->CreatePlacedResource(h.p,0,&bd,state,nullptr,__uuidof(ID3D12Resource),b.out())))return;
}
if(!committed(d,128,D3D12_HEAP_TYPE_READBACK,D3D12_RESOURCE_STATE_COPY_DEST,r,"bench_readback"))return;
void *bp=nullptr,*rp=nullptr;D3D12_RANGE none{0,0},read{0,128};
if(!hr("bench_source.Map",b->Map(0,&none,&bp)))return;
if(!hr("bench_readback.Map",r->Map(0,&read,&rp)))return;
auto* bytes=static_cast<volatile unsigned char*>(bp);
for(UINT64 i=0;i<n;i+=65536)bytes[i]=0x5A;
_mm_sfence();
std::printf("prefault stride=65536 touches=%llu\n",n/65536);
auto* first=static_cast<volatile uint32_t*>(bp);auto* last=reinterpret_cast<volatile uint32_t*>(static_cast<unsigned char*>(bp)+n-64);auto* actual=static_cast<volatile uint32_t*>(rp);
LARGE_INTEGER frequency{},start{},end{};QueryPerformanceFrequency(&frequency);
int warmMatches=0,timedMatches=0;double total=0;
for(int i=-5;i<40;++i){
uint32_t value=0xB1630000u+uint32_t(i+5)*0x00010307u;
if(i==0)QueryPerformanceCounter(&start);
for(int j=0;j<16;++j){first[j]=value^uint32_t(j)*0x01010101u;last[j]=(~value)^uint32_t(j)*0x0103070Bu;}
_mm_sfence();
bool ok=e.readEnds(b.p,n,state,r.p);if(!ok){std::puts("BENCH aborted (submission failed)");++failures;return;}
for(int j=0;j<16;++j)ok=ok&&actual[j]==(value^uint32_t(j)*0x01010101u)&&actual[16+j]==((~value)^uint32_t(j)*0x0103070Bu);
if(i<0)warmMatches+=ok;else timedMatches+=ok;
if(!ok)std::printf("BENCH mismatch iteration=%d first=%08X expected=%08X last=%08X expected=%08X\n",i,actual[0],value,actual[16],~value);
}
QueryPerformanceCounter(&end);total=1000.0*double(end.QuadPart-start.QuadPart)/double(frequency.QuadPart);
std::printf("BENCH_RESULT %s bytes=%llu total_ms=%.6f avg_ms_per_submit=%.6f exact_matches=%d/40 warmup_matches=%d/5\n",label,n,total,total/40,timedMatches,warmMatches);
if(timedMatches!=40||warmMatches!=5)++failures;
}
static void writewatch(){
std::puts("[6] MEM_WRITE_WATCH 65536 bytes; writes at 0 and 16384");
void* p=VirtualAlloc(nullptr,65536,MEM_COMMIT|MEM_RESERVE|MEM_WRITE_WATCH,PAGE_READWRITE);
std::printf("writewatch.VirtualAlloc success=%d error=%lu\n",p!=nullptr,p?0:GetLastError());if(!p)return;
auto* bytes=static_cast<volatile unsigned char*>(p);bytes[0]=0x61;bytes[16384]=0x72;
PVOID addresses[64]{};ULONG_PTR count=64;DWORD granularity=0;
UINT rc=GetWriteWatch(WRITE_WATCH_FLAG_RESET,p,65536,addresses,&count,&granularity);
std::printf("GetWriteWatch return=%u dirty_page_count=%llu granularity=%lu\n",rc,static_cast<unsigned long long>(count),granularity);
if(rc==0)for(ULONG_PTR i=0;i<count&&i<64;++i)std::printf("dirty_page[%llu] offset=%llu\n",static_cast<unsigned long long>(i),static_cast<unsigned long long>(static_cast<unsigned char*>(addresses[i])-static_cast<unsigned char*>(p)));
VirtualFree(p,0,MEM_RELEASE);
}
int main(int argc,char**){
setvbuf(stdout,nullptr,_IONBF,0);std::puts("Independent standalone D3D12 UMA probe; C++20; sizeof(void*)=8 expected");
std::printf("sizeof(void*)=%zu\n",sizeof(void*));
HMODULE dll=LoadLibraryA("d3d12.dll");if(!dll){std::printf("LoadLibraryA(d3d12.dll) failed error=%lu\n",GetLastError());writewatch();return 2;}
char path[32768]{};GetModuleFileNameA(dll,path,sizeof(path));std::printf("LoadLibraryA(d3d12.dll) path=%s\n",path);
using Create=HRESULT(WINAPI*)(IUnknown*,D3D_FEATURE_LEVEL,REFIID,void**);
FARPROC symbol=GetProcAddress(dll,"D3D12CreateDevice");
Create create=nullptr;static_assert(sizeof(create)==sizeof(symbol));std::memcpy(&create,&symbol,sizeof(create));
if(!create){std::printf("GetProcAddress failed error=%lu\n",GetLastError());writewatch();return 2;}
Ptr<ID3D12Device> base;
if(!hr("D3D12CreateDevice FL11_0",create(nullptr,D3D_FEATURE_LEVEL_11_0,__uuidof(ID3D12Device),base.out()))){writewatch();return 2;}
Ptr<ID3D12Device3> d;if(!hr("QueryInterface ID3D12Device3",base->QueryInterface(__uuidof(ID3D12Device3),d.out()))){writewatch();return 2;}
modules();if(argc>1){wrapping(d.p,nullptr);std::puts("backend receipt pause 10 seconds");Sleep(10000);return 0;}std::puts("[1] Device capability queries, NodeIndex=0");
D3D12_FEATURE_DATA_ARCHITECTURE1 a{};
if(hr("D3D12_FEATURE_ARCHITECTURE1",d->CheckFeatureSupport(D3D12_FEATURE_ARCHITECTURE1,&a,sizeof(a))))std::printf("UMA=%d CacheCoherentUMA=%d TileBasedRenderer=%d IsolatedMMU=%d\n",a.UMA,a.CacheCoherentUMA,a.TileBasedRenderer,a.IsolatedMMU);
D3D12_FEATURE_DATA_D3D12_OPTIONS o{};
if(hr("D3D12_FEATURE_D3D12_OPTIONS",d->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS,&o,sizeof(o))))std::printf("ResourceHeapTier=%d\n",int(o.ResourceHeapTier));
Engine e(d.p);bool ready=e.init();wrapping(d.p,ready?&e:nullptr);placement(d.p);
if(ready){
coherence(d.p,e);
benchmark(d.p,e,"CUSTOM/WRITE_BACK/L0/64KiB",65536,false,D3D12_CPU_PAGE_PROPERTY_WRITE_BACK);
benchmark(d.p,e,"CUSTOM/WRITE_BACK/L0/256MiB",268435456,false,D3D12_CPU_PAGE_PROPERTY_WRITE_BACK);
benchmark(d.p,e,"CUSTOM/WRITE_COMBINE/L0/256MiB",268435456,false,D3D12_CPU_PAGE_PROPERTY_WRITE_COMBINE);
benchmark(d.p,e,"UPLOAD/256MiB",268435456,true,D3D12_CPU_PAGE_PROPERTY_UNKNOWN);
}else{std::puts("[4,5] NOT_RUN: queue initialization failed");++failures;}
writewatch();std::printf("END observed_data_or_submission_failures=%d (unsupported HRESULTs reported separately)\n",failures);return failures?1:0;
}
@@ -0,0 +1,21 @@
Separate untimed backend diagnostic, same copied bottle and backend selection.
This is a path/trace excerpt, not a complete raw lsof log: user/PID columns and unrelated paths omitted.
Loaded-file paths observed by lsof:
/usr/libexec/rosetta/runtime
/Library/Apple/usr/libexec/oah/libRosettaRuntime
/Applications/CrossOver.app/Contents/SharedSupport/CrossOver/lib64/apple_gptk/external/D3DMetal.framework/Versions/A/D3DMetal
/Applications/CrossOver.app/Contents/SharedSupport/CrossOver/lib64/apple_gptk/wine/x86_64-windows/dxgi.dll
/Applications/CrossOver.app/Contents/SharedSupport/CrossOver/lib64/apple_gptk/wine/x86_64-windows/d3d12.dll
Loader trace excerpt:
00d4:trace:loaddll:build_module Loaded L"C:\\windows\\system32\\d3d12.dll" at 00006FFFFE7C0000: builtin
00d4:trace:loaddll:build_module Loaded L"C:\\windows\\system32\\dxgi.dll" at 00006FFFFD460000: builtin
No method-specific D3DMetal messages observed. Both opens returned 0x80004001.
Initial launch preparation: two launches exited 2 before guest stdout, reporting:
LibClamAV Error: cli_loaddbdir: No supported database files found in /opt/homebrew/var/lib/clamav
ERROR: Can't open file or directory
Temporary clone only: AntiVirusScan=untrusted and AllowUntrusted=1 for this original locally compiled executable.
A supplemental diagnostic helper later failed its pgrep -x probe.exe lookup after lsof took long enough for the paused process to exit. It did not invalidate the already captured lsof paths or either completed baseline run. No vmmap evidence is claimed.
@@ -0,0 +1,129 @@
{
"chip": {
"command": [
"sysctl",
"-n",
"machdep.cpu.brand_string"
],
"exit_code": 0,
"stdout": "Apple M4\n",
"stderr": ""
},
"ram_bytes": {
"command": [
"sysctl",
"-n",
"hw.memsize"
],
"exit_code": 0,
"stdout": "25769803776\n",
"stderr": ""
},
"macos": {
"command": [
"sw_vers"
],
"exit_code": 0,
"stdout": "ProductName:\t\tmacOS\nProductVersion:\t\t27.0\nBuildVersion:\t\t26A428\n",
"stderr": ""
},
"host_arch": {
"command": [
"uname",
"-m"
],
"exit_code": 0,
"stdout": "arm64\n",
"stderr": ""
},
"compiler": {
"command": [
"x86_64-w64-mingw32-g++",
"--version"
],
"exit_code": 0,
"stdout": "x86_64-w64-mingw32-g++ (GCC) 16.2.0\nCopyright (C) 2026 Free Software Foundation, Inc.\nThis is free software; see the source for copying conditions. There is NO\nwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n",
"stderr": ""
},
"crossover": {
"command": [
"/Applications/CrossOver.app/Contents/SharedSupport/CrossOver/bin/wine",
"--version"
],
"exit_code": 0,
"stdout": "Product Name: CrossOver\nPublic Version: 26.3.0\nProduct Version: 26.3.0.39832\nBuild Tag: cxoffice-26.3.0rc2\nBuild Timestamp: 20260715T103801Z\n",
"stderr": ""
},
"rosetta": {
"command": [
"pkgutil",
"--pkg-info",
"com.apple.pkg.RosettaUpdateAuto"
],
"exit_code": 0,
"stdout": "package-id: com.apple.pkg.RosettaUpdateAuto\nversion: 1.0.0.0.1788432274\nvolume: /\nlocation: /\ninstall-time: 1791147684\n",
"stderr": ""
},
"d3dmetal_Info.plist": {
"DTPlatformVersion": "15.4",
"CFBundleIdentifier": "com.apple.D3DMetal",
"DTCompiler": "com.apple.compilers.llvm.clang.1_0",
"DTPlatformBuild": "24E241",
"CFBundleInfoDictionaryVersion": "6.0",
"CFBundleVersion": "3.0",
"CFBundleExecutable": "D3DMetal",
"DTXcodeBuild": "16E140",
"DTSDKName": "macosx15.4.internal",
"CFBundleShortVersionString": "3.0",
"DTXcode": "1630",
"CFBundleSupportedPlatforms": [
"MacOSX"
],
"CFBundlePackageType": "FMWK",
"BuildMachineOSBuild": "23A344013",
"LSMinimumSystemVersion": "14.0",
"DTPlatformName": "macosx",
"DTSDKBuild": "24E241",
"CFBundleDevelopmentRegion": "English",
"CFBundleName": "D3DMetal"
},
"d3dmetal_version.plist": {
"BuildVersion": "1",
"CFBundleShortVersionString": "3.0",
"CFBundleVersion": "3.0",
"ProjectName": "D3DRendererMetal",
"SourceVersion": "32047000000000"
},
"installed_backend_dll": {
"path": "/Applications/CrossOver.app/Contents/SharedSupport/CrossOver/lib64/apple_gptk/wine/x86_64-windows/d3d12.dll",
"sha256": "bbda1c4e94ee70255c528c5689b28333ca9bece2d755ede7c4197977a534704f"
},
"bottle": {
"template": "win11_64",
"architecture": "win64",
"mode": "temporary private clone; --no-update",
"runtime_backend_setting": "CX_GRAPHICS_BACKEND=d3dmetal"
},
"environment": {
"ROSETTA_ADVERTISE_AVX": "1",
"CX_GRAPHICS_BACKEND": "d3dmetal",
"WINEDEBUG": "-all"
},
"timeout_seconds": 30,
"run_exit_code": 0,
"timed_out": false,
"process_elapsed_seconds": 6.482681,
"source_sha256": null,
"executable_sha256": null,
"receipt_limitations": "Host/software re-queried unchanged for the shared-runner run. Initial source/executable hashes were not captured before diagnostic additions; not independently reviewed.",
"launch": [
"/Applications/CrossOver.app/Contents/SharedSupport/CrossOver/bin/wine",
"--bottle",
"/tmp/bx-uma-verify/bottle",
"--no-update",
"--no-gui",
"--workdir",
"/tmp/bx-uma-verify",
"/tmp/bx-uma-verify/probe.exe"
]
}
@@ -0,0 +1,91 @@
Independent standalone D3D12 UMA probe; C++20; sizeof(void*)=8 expected
sizeof(void*)=8
LoadLibraryA(d3d12.dll) path=C:\windows\system32\d3d12.dll
D3D12CreateDevice FL11_0 HRESULT=0x00000000
QueryInterface ID3D12Device3 HRESULT=0x00000000
module d3d12.dll path=C:\windows\system32\d3d12.dll
module dxgi.dll path=C:\windows\system32\dxgi.dll
d3d12_xs_loaded=0
[1] Device capability queries, NodeIndex=0
D3D12_FEATURE_ARCHITECTURE1 HRESULT=0x00000000
UMA=0 CacheCoherentUMA=0 TileBasedRenderer=0 IsolatedMMU=0
D3D12_FEATURE_D3D12_OPTIONS HRESULT=0x00000000
ResourceHeapTier=2
queue HRESULT=0x00000000
allocator HRESULT=0x00000000
command_list HRESULT=0x00000000
initial_close HRESULT=0x00000000
fence HRESULT=0x00000000
fence_event success=1 error=0
[2] Existing-memory wrapping (64 KiB)
VirtualAlloc success=1 error=0
CreateFileMappingW success=1 error=0
MapViewOfFile success=1 error=0
OpenExistingHeapFromAddress HRESULT=0x80004001
OpenExistingHeapFromFileMapping HRESULT=0x80004001
address_visibility NOT_RUN (heap open failed)
file_mapping_visibility NOT_RUN (heap open failed)
[3] CUSTOM heap creation (size=2097152 alignment=65536)
WRITE_BACK/L0/ALLOW_ALL HRESULT=0x00000000
WRITE_COMBINE/L0/ALLOW_ALL HRESULT=0x00000000
WRITE_BACK/L0/ALLOW_ONLY_BUFFERS HRESULT=0x00000000
WRITE_BACK/L0/ALLOW_ONLY_NON_RT_DS_TEXTURES HRESULT=0x00000000
WRITE_BACK/L0/ALLOW_ONLY_RT_DS_TEXTURES HRESULT=0x00000000
WRITE_BACK/L1/ALLOW_ALL control HRESULT=0x80070057
mixed_heap HRESULT=0x00000000
placed_UAV_buffer offset=0 HRESULT=0x00000000
buffer allocation size=65536 alignment=65536; texture size=65536 alignment=65536 offset=65536
placed_RGBA8_texture same_heap HRESULT=0x00000000
mixed_buffer_and_texture_live=1
texture.Map(null ppData) HRESULT=0x00000000
texture.WriteToSubresource HRESULT=0x00000000
texture.ReadFromSubresource HRESULT=0x00000000
texture roundtrip exact_words=4096/4096 match=1
[4] Bidirectional persistent Map; no Unmap or remap
coherence_heap HRESULT=0x00000000
coherence_placed_UAV_buffer HRESULT=0x00000000
coherence_readback HRESULT=0x00000000
coherence_upload HRESULT=0x00000000
placed.Map HRESULT=0x00000000
readback.Map HRESULT=0x00000000
upload.Map HRESULT=0x00000000
CPU->GPU round=1 expected=11223344,A1B2C3D4 actual=11223344,A1B2C3D4 match=1
CPU->GPU round=2 expected=55AA00FF,F00DBA5E actual=55AA00FF,F00DBA5E match=1
GPU->CPU same_cpu_ptr expected=C001D00D,9E3779B9 actual=C001D00D,9E3779B9 match=1
[5] BENCH CUSTOM/WRITE_BACK/L0/64KiB size=65536 warmup=5 timed=40
bench_heap HRESULT=0x00000000
bench_placed_buffer HRESULT=0x00000000
bench_readback HRESULT=0x00000000
bench_source.Map HRESULT=0x00000000
bench_readback.Map HRESULT=0x00000000
prefault stride=65536 touches=1
BENCH_RESULT CUSTOM/WRITE_BACK/L0/64KiB bytes=65536 total_ms=20.635900 avg_ms_per_submit=0.515898 exact_matches=40/40 warmup_matches=5/5
[5] BENCH CUSTOM/WRITE_BACK/L0/256MiB size=268435456 warmup=5 timed=40
bench_heap HRESULT=0x00000000
bench_placed_buffer HRESULT=0x00000000
bench_readback HRESULT=0x00000000
bench_source.Map HRESULT=0x00000000
bench_readback.Map HRESULT=0x00000000
prefault stride=65536 touches=4096
BENCH_RESULT CUSTOM/WRITE_BACK/L0/256MiB bytes=268435456 total_ms=30.937300 avg_ms_per_submit=0.773432 exact_matches=40/40 warmup_matches=5/5
[5] BENCH CUSTOM/WRITE_COMBINE/L0/256MiB size=268435456 warmup=5 timed=40
bench_heap HRESULT=0x00000000
bench_placed_buffer HRESULT=0x00000000
bench_readback HRESULT=0x00000000
bench_source.Map HRESULT=0x00000000
bench_readback.Map HRESULT=0x00000000
prefault stride=65536 touches=4096
BENCH_RESULT CUSTOM/WRITE_COMBINE/L0/256MiB bytes=268435456 total_ms=11.762100 avg_ms_per_submit=0.294052 exact_matches=40/40 warmup_matches=5/5
[5] BENCH UPLOAD/256MiB size=268435456 warmup=5 timed=40
bench_upload HRESULT=0x00000000
bench_readback HRESULT=0x00000000
bench_source.Map HRESULT=0x00000000
bench_readback.Map HRESULT=0x00000000
prefault stride=65536 touches=4096
BENCH_RESULT UPLOAD/256MiB bytes=268435456 total_ms=10.118800 avg_ms_per_submit=0.252970 exact_matches=40/40 warmup_matches=5/5
[6] MEM_WRITE_WATCH 65536 bytes; writes at 0 and 16384
writewatch.VirtualAlloc success=1 error=0
GetWriteWatch return=0 dirty_page_count=2 granularity=4096
dirty_page[0] offset=0
dirty_page[1] offset=16384
END observed_data_or_submission_failures=0 (unsupported HRESULTs reported separately)
@@ -0,0 +1,179 @@
{
"chip": {
"command": [
"sysctl",
"-n",
"machdep.cpu.brand_string"
],
"exit_code": 0,
"stdout": "Apple M4\n",
"stderr": ""
},
"ram_bytes": {
"command": [
"sysctl",
"-n",
"hw.memsize"
],
"exit_code": 0,
"stdout": "25769803776\n",
"stderr": ""
},
"macos": {
"command": [
"sw_vers"
],
"exit_code": 0,
"stdout": "ProductName:\t\tmacOS\nProductVersion:\t\t27.0\nBuildVersion:\t\t26A428\n",
"stderr": ""
},
"host_arch": {
"command": [
"uname",
"-m"
],
"exit_code": 0,
"stdout": "arm64\n",
"stderr": ""
},
"compiler": {
"command": [
"x86_64-w64-mingw32-g++",
"--version"
],
"exit_code": 0,
"stdout": "x86_64-w64-mingw32-g++ (GCC) 16.2.0\nCopyright (C) 2026 Free Software Foundation, Inc.\nThis is free software; see the source for copying conditions. There is NO\nwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n",
"stderr": ""
},
"crossover": {
"command": [
"/Applications/CrossOver.app/Contents/SharedSupport/CrossOver/bin/wine",
"--version"
],
"exit_code": 0,
"stdout": "Product Name: CrossOver\nPublic Version: 26.3.0\nProduct Version: 26.3.0.39832\nBuild Tag: cxoffice-26.3.0rc2\nBuild Timestamp: 20260715T103801Z\n",
"stderr": ""
},
"rosetta": {
"command": [
"pkgutil",
"--pkg-info",
"com.apple.pkg.RosettaUpdateAuto"
],
"exit_code": 0,
"stdout": "package-id: com.apple.pkg.RosettaUpdateAuto\nversion: 1.0.0.0.1788432274\nvolume: /\nlocation: /\ninstall-time: 1791147684\n",
"stderr": ""
},
"d3dmetal_Info.plist": {
"DTPlatformVersion": "15.4",
"CFBundleIdentifier": "com.apple.D3DMetal",
"DTCompiler": "com.apple.compilers.llvm.clang.1_0",
"DTPlatformBuild": "24E241",
"CFBundleInfoDictionaryVersion": "6.0",
"CFBundleVersion": "3.0",
"CFBundleExecutable": "D3DMetal",
"DTXcodeBuild": "16E140",
"DTSDKName": "macosx15.4.internal",
"CFBundleShortVersionString": "3.0",
"DTXcode": "1630",
"CFBundleSupportedPlatforms": [
"MacOSX"
],
"CFBundlePackageType": "FMWK",
"BuildMachineOSBuild": "23A344013",
"LSMinimumSystemVersion": "14.0",
"DTPlatformName": "macosx",
"DTSDKBuild": "24E241",
"CFBundleDevelopmentRegion": "English",
"CFBundleName": "D3DMetal"
},
"d3dmetal_version.plist": {
"BuildVersion": "1",
"CFBundleShortVersionString": "3.0",
"CFBundleVersion": "3.0",
"ProjectName": "D3DRendererMetal",
"SourceVersion": "32047000000000"
},
"installed_backend_dll": {
"path": "/Applications/CrossOver.app/Contents/SharedSupport/CrossOver/lib64/apple_gptk/wine/x86_64-windows/d3d12.dll",
"sha256": "bbda1c4e94ee70255c528c5689b28333ca9bece2d755ede7c4197977a534704f"
},
"source_sha256": "33e90bfee89e812f48990613cd74ced56473e5c3fc5d973f2ba1116090646a0c",
"bottle": {
"template": "win11_64",
"architecture": "win64",
"mode": "temporary private clone; --no-update",
"runtime_backend_setting": "CX_GRAPHICS_BACKEND=d3dmetal"
},
"environment": {
"ROSETTA_ADVERTISE_AVX": "1",
"CX_GRAPHICS_BACKEND": "d3dmetal",
"WINEDEBUG": "-all"
},
"timeout_seconds": 30,
"mode": "six-check-baseline",
"compile": {
"command": [
"x86_64-w64-mingw32-g++",
"-std=c++20",
"-O2",
"-static",
"-static-libgcc",
"-static-libstdc++",
"-Wall",
"-Wextra",
"-Werror",
"/private/tmp/bx-uma-verify/reproduction/probe.cpp",
"-o",
"/private/tmp/bx-uma-verify/reproduction/probe.exe",
"-lkernel32"
],
"exit_code": 0,
"stdout": "",
"stderr": ""
},
"executable_sha256": "268a22eab53663a3f5e3ef9a8cd0374831ad181843780fe107493d04865f9748",
"executable_format": {
"command": [
"file",
"/private/tmp/bx-uma-verify/reproduction/probe.exe"
],
"exit_code": 0,
"stdout": "/private/tmp/bx-uma-verify/reproduction/probe.exe: PE32+ executable (console) x86-64, for MS Windows\n",
"stderr": ""
},
"pe_imports": {
"command": [
"/opt/homebrew/bin/x86_64-w64-mingw32-objdump",
"-p",
"/private/tmp/bx-uma-verify/reproduction/probe.exe"
],
"exit_code": 0,
"stdout": "/private/tmp/bx-uma-verify/reproduction/probe.exe: file format pei-x86-64\nMagic\t\t\t020b\t(PE32+)\n\tDLL Name: KERNEL32.dll\n\tDLL Name: api-ms-win-crt-convert-l1-1-0.dll\n\tDLL Name: api-ms-win-crt-environment-l1-1-0.dll\n\tDLL Name: api-ms-win-crt-filesystem-l1-1-0.dll\n\tDLL Name: api-ms-win-crt-heap-l1-1-0.dll\n\tDLL Name: api-ms-win-crt-locale-l1-1-0.dll\n\tDLL Name: api-ms-win-crt-math-l1-1-0.dll\n\tDLL Name: api-ms-win-crt-private-l1-1-0.dll\n\tDLL Name: api-ms-win-crt-runtime-l1-1-0.dll\n\tDLL Name: api-ms-win-crt-stdio-l1-1-0.dll\n\tDLL Name: api-ms-win-crt-string-l1-1-0.dll",
"stderr": ""
},
"temporary_config_sha256": "068c00572582ec340e75335ed08a9087a4a525e55e3eb1144d816409555da73d",
"launch": [
"/Applications/CrossOver.app/Contents/SharedSupport/CrossOver/bin/wine",
"--bottle",
"/private/tmp/bx-uma-verify/reproduction/bottle",
"--no-update",
"--no-gui",
"--workdir",
"/private/tmp/bx-uma-verify/reproduction",
"/private/tmp/bx-uma-verify/reproduction/probe.exe"
],
"run_exit_code": 0,
"timed_out": false,
"process_elapsed_seconds": 2.5438959590392187,
"stop_private_server": {
"command": [
"/Applications/CrossOver.app/Contents/SharedSupport/CrossOver/bin/wineserver",
"-k"
],
"exit_code": 0,
"stdout": "",
"stderr": ""
},
"source_bottle_config_unchanged": true
}
@@ -0,0 +1,91 @@
Independent standalone D3D12 UMA probe; C++20; sizeof(void*)=8 expected
sizeof(void*)=8
LoadLibraryA(d3d12.dll) path=C:\windows\system32\d3d12.dll
D3D12CreateDevice FL11_0 HRESULT=0x00000000
QueryInterface ID3D12Device3 HRESULT=0x00000000
module d3d12.dll path=C:\windows\system32\d3d12.dll
module dxgi.dll path=C:\windows\system32\dxgi.dll
d3d12_xs_loaded=0
[1] Device capability queries, NodeIndex=0
D3D12_FEATURE_ARCHITECTURE1 HRESULT=0x00000000
UMA=0 CacheCoherentUMA=0 TileBasedRenderer=0 IsolatedMMU=0
D3D12_FEATURE_D3D12_OPTIONS HRESULT=0x00000000
ResourceHeapTier=2
queue HRESULT=0x00000000
allocator HRESULT=0x00000000
command_list HRESULT=0x00000000
initial_close HRESULT=0x00000000
fence HRESULT=0x00000000
fence_event success=1 error=0
[2] Existing-memory wrapping (64 KiB)
VirtualAlloc success=1 error=0
CreateFileMappingW success=1 error=0
MapViewOfFile success=1 error=0
OpenExistingHeapFromAddress HRESULT=0x80004001
OpenExistingHeapFromFileMapping HRESULT=0x80004001
address_visibility NOT_RUN (heap open failed)
file_mapping_visibility NOT_RUN (heap open failed)
[3] CUSTOM heap creation (size=2097152 alignment=65536)
WRITE_BACK/L0/ALLOW_ALL HRESULT=0x00000000
WRITE_COMBINE/L0/ALLOW_ALL HRESULT=0x00000000
WRITE_BACK/L0/ALLOW_ONLY_BUFFERS HRESULT=0x00000000
WRITE_BACK/L0/ALLOW_ONLY_NON_RT_DS_TEXTURES HRESULT=0x00000000
WRITE_BACK/L0/ALLOW_ONLY_RT_DS_TEXTURES HRESULT=0x00000000
WRITE_BACK/L1/ALLOW_ALL control HRESULT=0x80070057
mixed_heap HRESULT=0x00000000
placed_UAV_buffer offset=0 HRESULT=0x00000000
buffer allocation size=65536 alignment=65536; texture size=65536 alignment=65536 offset=65536
placed_RGBA8_texture same_heap HRESULT=0x00000000
mixed_buffer_and_texture_live=1
texture.Map(null ppData) HRESULT=0x00000000
texture.WriteToSubresource HRESULT=0x00000000
texture.ReadFromSubresource HRESULT=0x00000000
texture roundtrip exact_words=4096/4096 match=1
[4] Bidirectional persistent Map; no Unmap or remap
coherence_heap HRESULT=0x00000000
coherence_placed_UAV_buffer HRESULT=0x00000000
coherence_readback HRESULT=0x00000000
coherence_upload HRESULT=0x00000000
placed.Map HRESULT=0x00000000
readback.Map HRESULT=0x00000000
upload.Map HRESULT=0x00000000
CPU->GPU round=1 expected=11223344,A1B2C3D4 actual=11223344,A1B2C3D4 match=1
CPU->GPU round=2 expected=55AA00FF,F00DBA5E actual=55AA00FF,F00DBA5E match=1
GPU->CPU same_cpu_ptr expected=C001D00D,9E3779B9 actual=C001D00D,9E3779B9 match=1
[5] BENCH CUSTOM/WRITE_BACK/L0/64KiB size=65536 warmup=5 timed=40
bench_heap HRESULT=0x00000000
bench_placed_buffer HRESULT=0x00000000
bench_readback HRESULT=0x00000000
bench_source.Map HRESULT=0x00000000
bench_readback.Map HRESULT=0x00000000
prefault stride=65536 touches=1
BENCH_RESULT CUSTOM/WRITE_BACK/L0/64KiB bytes=65536 total_ms=11.558300 avg_ms_per_submit=0.288957 exact_matches=40/40 warmup_matches=5/5
[5] BENCH CUSTOM/WRITE_BACK/L0/256MiB size=268435456 warmup=5 timed=40
bench_heap HRESULT=0x00000000
bench_placed_buffer HRESULT=0x00000000
bench_readback HRESULT=0x00000000
bench_source.Map HRESULT=0x00000000
bench_readback.Map HRESULT=0x00000000
prefault stride=65536 touches=4096
BENCH_RESULT CUSTOM/WRITE_BACK/L0/256MiB bytes=268435456 total_ms=11.961700 avg_ms_per_submit=0.299042 exact_matches=40/40 warmup_matches=5/5
[5] BENCH CUSTOM/WRITE_COMBINE/L0/256MiB size=268435456 warmup=5 timed=40
bench_heap HRESULT=0x00000000
bench_placed_buffer HRESULT=0x00000000
bench_readback HRESULT=0x00000000
bench_source.Map HRESULT=0x00000000
bench_readback.Map HRESULT=0x00000000
prefault stride=65536 touches=4096
BENCH_RESULT CUSTOM/WRITE_COMBINE/L0/256MiB bytes=268435456 total_ms=9.973900 avg_ms_per_submit=0.249347 exact_matches=40/40 warmup_matches=5/5
[5] BENCH UPLOAD/256MiB size=268435456 warmup=5 timed=40
bench_upload HRESULT=0x00000000
bench_readback HRESULT=0x00000000
bench_source.Map HRESULT=0x00000000
bench_readback.Map HRESULT=0x00000000
prefault stride=65536 touches=4096
BENCH_RESULT UPLOAD/256MiB bytes=268435456 total_ms=8.198200 avg_ms_per_submit=0.204955 exact_matches=40/40 warmup_matches=5/5
[6] MEM_WRITE_WATCH 65536 bytes; writes at 0 and 16384
writewatch.VirtualAlloc success=1 error=0
GetWriteWatch return=0 dirty_page_count=2 granularity=4096
dirty_page[0] offset=0
dirty_page[1] offset=16384
END observed_data_or_submission_failures=0 (unsupported HRESULTs reported separately)
@@ -0,0 +1,344 @@
Validation of research branch based on origin/main f7fb52bc56f671f9da7109f8aef8d3f04de59aee.
No production source changes; these are local checks, not independent acceptance.
COMMAND: cargo fmt --all -- --check
EXIT: 0
COMMAND: CARGO_BUILD_JOBS=2 cargo clippy --locked --workspace --all-targets -- -D warnings
EXIT: 0
Checking dxbc-accc v0.2.0 (/private/tmp/bx-uma-verify/research-repo/shader-transpiler/crates/dxbc-accc)
Compiling libc v0.2.191
Checking d3dmetal-harness v0.2.0 (/private/tmp/bx-uma-verify/research-repo/shader-transpiler/crates/d3dmetal-harness)
Checking bx-probe v0.2.0 (/private/tmp/bx-uma-verify/research-repo/launcher/crates/bx-probe)
Checking bx-telemetry v0.2.0 (/private/tmp/bx-uma-verify/research-repo/launcher/crates/bx-telemetry)
Checking bx-cli v0.2.0 (/private/tmp/bx-uma-verify/research-repo/launcher/crates/bx-cli)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.42s
COMMAND: CARGO_BUILD_JOBS=2 cargo test --locked --workspace
EXIT: 0
Compiling dxbc-accc v0.2.0 (/private/tmp/bx-uma-verify/research-repo/shader-transpiler/crates/dxbc-accc)
Compiling d3dmetal-harness v0.2.0 (/private/tmp/bx-uma-verify/research-repo/shader-transpiler/crates/d3dmetal-harness)
Compiling bx-telemetry v0.2.0 (/private/tmp/bx-uma-verify/research-repo/launcher/crates/bx-telemetry)
Compiling bx-probe v0.2.0 (/private/tmp/bx-uma-verify/research-repo/launcher/crates/bx-probe)
Compiling libc v0.2.191
Compiling bx-cli v0.2.0 (/private/tmp/bx-uma-verify/research-repo/launcher/crates/bx-cli)
Finished `test` profile [unoptimized + debuginfo] target(s) in 2.71s
Running unittests src/main.rs (/tmp/bx-uma-verify/cargo-target/debug/deps/bx_cli-2151914d755a0d54)
running 18 tests
test stage::tests::closure_follows_shim_imports_only ... ok
test stage::tests::system32_is_under_drive_c ... ok
test stage::tests::uninitialized_prefix_is_an_error_not_a_skip ... ok
test stage::tests::writes_only_inside_system32 ... ok
test tests::bottle_mode_passes_overrides_and_backend_as_launcher_options ... ok
test tests::converts_unix_path_to_wine_z_drive ... ok
test tests::formats_clwb_summary_lines ... ok
test stage::tests::missing_shim_is_reported_and_nothing_is_staged ... ok
test tests::isolated_env_strips_secrets_and_pins_path ... ok
test tests::parses_run_arguments ... ok
test stage::tests::copies_then_leaves_identical_copy_alone ... ok
test stage::tests::replaces_an_older_copy ... ok
test stage::tests::stages_the_runtime_and_its_shim_dependency ... ok
test supervise::tests::classifies_exit_timeout_and_signal ... ok
test tests::a_timeout_cleans_up_a_bottle_outside_the_default_directory ... ok
test supervise::tests::an_idle_server_is_accepted_only_when_the_wait_succeeds ... ok
test supervise::tests::a_timeout_stops_children_that_ignore_sigterm ... ok
test tests::a_timeout_cleans_up_a_managed_bottle_private_stub_created_on_first_launch ... ok
test result: ok. 18 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.67s
Running unittests src/lib.rs (/tmp/bx-uma-verify/cargo-target/debug/deps/bx_probe-395eaa3c3f91592a)
running 1 test
test tests::classifies_tracks_accurately ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Running unittests src/lib.rs (/tmp/bx-uma-verify/cargo-target/debug/deps/bx_telemetry-314c6b3d802f702b)
running 4 tests
test tests::preserves_clwb_record_count_without_valid_counters ... ok
test tests::aggregates_stub_and_veh_events ... ok
test tests::collects_unhandled_exceptions_in_log_order ... ok
test tests::uses_highest_counter_from_sampled_clwb_records ... ok
test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Running unittests src/lib.rs (/tmp/bx-uma-verify/cargo-target/debug/deps/d3dmetal_harness-be2050e4ff5342c1)
running 22 tests
test kernel::tests::matches_independently_computed_values ... ok
test kernel::tests::no_expected_word_equals_the_sentinel ... ok
test framework::tests::resolves_directory_or_binary ... ok
test framework::tests::environment_wins_over_crossover ... ok
test macho::tests::rejects_unknown_truncated_and_oversized_headers ... ok
test framework::tests::explicit_path_wins_over_environment_and_crossover ... ok
test framework::tests::unresolved_request_does_not_fall_back ... ok
test macho::tests::thin_x86_64_and_arm64 ... ok
test macho::tests::universal_32_and_64_bit_entries ... ok
test framework::tests::crossover_default_then_absent ... ok
test report::tests::device_removal_is_reported_with_its_reason ... ok
test report::tests::init_failure_and_failed_steps_take_precedence ... ok
test report::tests::rejects_malformed_and_unversioned_output ... ok
test report::tests::parses_a_complete_report ... ok
test report::tests::reports_every_mismatch_and_the_first_one ... ok
test report::tests::untouched_sentinel_means_the_kernel_did_not_run ... ok
test report::tests::unfinished_or_foreign_dispatch_is_incomplete ... ok
test tests::rejects_a_framework_without_an_x86_64_slice ... ok
test tests::embedded_kernel_is_an_sm_6_6_compute_dxil_container ... ok
test runner::tests::passes_the_framework_and_only_allowlisted_environment ... ok
test runner::tests::kills_a_probe_that_exceeds_the_timeout ... ok
test runner::tests::a_descendant_holding_the_pipes_cannot_outlast_the_deadline ... ok
test result: ok. 22 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.51s
Running unittests src/main.rs (/tmp/bx-uma-verify/cargo-target/debug/deps/bx_d3dmetal_harness-11f25afb9b566af7)
running 2 tests
test tests::parses_run_options ... ok
test tests::rejects_bad_options ... ok
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Running tests/live_d3dmetal.rs (/tmp/bx-uma-verify/cargo-target/debug/deps/live_d3dmetal-6d63df8591429451)
running 1 test
test sm_6_6_compute_readback_matches_host_values ... ignored, needs a user-supplied D3DMetal.framework and BX_D3DMETAL_PROBE
test result: ok. 0 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 0.00s
Running unittests src/lib.rs (/tmp/bx-uma-verify/cargo-target/debug/deps/dxbc_accc-919debdd3ca67e95)
running 19 tests
bx-shader event=prepare status=unsupported detail=no_dxil_passthrough kind=accc_only(3) stage=compute(6) sm_major=6 sm_minor=0 container_size=148 dxil_chunk_size=0 accc_chunk_size=104 has_root_signature=0 digest=abababababababababababababababab fspx=1 fspx_version=1 sections=0@64+8,1@72+12,6@84+16,7@100+4 rdna_off=84 rdna_size=16
test tests::c_abi_empty_dxil_chunk_returns_invalid ... ok
test tests::classifies_synthetic_legacy_shdr ... ok
test tests::c_abi_zero_bitcode_dxil_returns_invalid ... ok
test tests::c_abi_inspect_and_passthrough_round_trip ... ok
test tests::classifies_synthetic_accc_fspx_magic_only ... okbx-shader event=prepare status=unsupported detail=no_dxil_passthrough kind=accc_only(3) stage=compute(6) sm_major=6 sm_minor=0 container_size=112 dxil_chunk_size=0 accc_chunk_size=40 has_root_signature=0 digest=abababababababababababababababab fspx=1 fspx_version=1 sections=none rdna_off=none rdna_size=none
test tests::c_abi_legacy_is_unsupported_and_invalid_inputs_allocate_nothing ... ok
test tests::classifies_synthetic_dxil_cs_6_6 ... ok
test tests::dxil_bitcode_offset_is_relative_to_bitcode_header ... ok
test tests::dxil_stage_wins_over_fspx_stage_in_dual_container ... ok
test tests::c_abi_accc_only_is_unsupported_and_logged ... ok
test tests::extracts_synthetic_fspx_sections_stage_and_rdna_bounds ... ok
test tests::prepare_copies_container_size_not_trailing_bytes ... ok
test tests::later_fspx_stage_is_used_when_earlier_table_has_none ... ok
test tests::prepare_passes_dxil_through_when_fspx_is_malformed ... ok
test tests::rejects_invalid_magic_and_short_headers ... ok
test tests::rejects_malformed_fspx_sections ... ok
test tests::rejects_truncated_tables_and_chunk_bounds ... ok
test tests::truncated_prefixes_do_not_panic ... ok
test tests::fspx_section_count_is_bounded ... ok
test result: ok. 19 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Doc-tests bx_probe
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Doc-tests bx_telemetry
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Doc-tests d3dmetal_harness
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Doc-tests dxbc_accc
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
COMMAND: CARGO_BUILD_JOBS=2 cargo build --locked -p bx-cli
EXIT: 0
Compiling bx-cli v0.2.0 (/private/tmp/bx-uma-verify/research-repo/launcher/crates/bx-cli)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.40s
COMMAND: BX_BUILD_JOBS=2 scripts/build-shims.sh
EXIT: 0
-- The C compiler identification is GNU 16.2.0
-- The CXX compiler identification is GNU 16.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt/homebrew/bin/x86_64-w64-mingw32-gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /opt/homebrew/bin/x86_64-w64-mingw32-g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done (0.7s)
-- Generating done (0.1s)
-- Build files have been written to: /tmp/bx-uma-verify/build-shims
[ 1%] Building CXX object win32_bridge/CMakeFiles/ntuser_msg_1_0.dir/empty_forwarder.cpp.obj
[ 2%] Building CXX object runtime_veh/CMakeFiles/bx_runtime_veh.dir/runtime_veh.cpp.obj
[ 4%] Linking CXX shared library ../bin/ext-ms-win-rtcore-ntuser-message-l1-1-0.dll
[ 4%] Built target ntuser_msg_1_0
[ 5%] Building CXX object win32_bridge/CMakeFiles/ntuser_msg_ansi_1_0.dir/empty_forwarder.cpp.obj
[ 7%] Linking CXX shared library ../bin/bx_runtime_veh.dll
[ 7%] Built target bx_runtime_veh
[ 8%] Building CXX object win32_bridge/CMakeFiles/ntuser_win_1_0.dir/empty_forwarder.cpp.obj
[ 10%] Linking CXX shared library ../bin/ext-ms-win-rtcore-ntuser-message-ansi-l1-1-0.dll
[ 10%] Built target ntuser_msg_ansi_1_0
[ 11%] Building CXX object win32_bridge/CMakeFiles/ntuser_win_ansi_1_0.dir/empty_forwarder.cpp.obj
[ 13%] Linking CXX shared library ../bin/ext-ms-win-rtcore-ntuser-window-l1-1-0.dll
[ 13%] Built target ntuser_win_1_0
[ 14%] Building CXX object xmem/CMakeFiles/xmem.dir/xmem.cpp.obj
[ 15%] Linking CXX shared library ../bin/ext-ms-win-rtcore-ntuser-window-ansi-l1-1-0.dll
[ 15%] Built target ntuser_win_ansi_1_0
[ 17%] Building CXX object xcrdapi/CMakeFiles/xcrdapi.dir/xcrdapi.cpp.obj
[ 18%] Building CXX object xmem/CMakeFiles/xmem.dir/physical_pages.cpp.obj
[ 20%] Linking CXX shared library ../bin/XCRDAPI.dll
[ 20%] Built target xcrdapi
[ 21%] Building CXX object xg_xs/CMakeFiles/xg_xs.dir/xg_xs.cpp.obj
[ 23%] Linking CXX shared library ../bin/xmem.dll
[ 23%] Built target xmem
[ 24%] Building CXX object xgameruntime/CMakeFiles/xgameruntime.dir/xgameruntime.cpp.obj
[ 26%] Linking CXX shared library ../bin/xg_xs.dll
[ 26%] Built target xg_xs
[ 27%] Building CXX object xgameruntime/CMakeFiles/xgameruntime.dir/task_queue.cpp.obj
[ 28%] Building CXX object xgameruntime/CMakeFiles/xgameruntime.dir/com_dispatch.cpp.obj
[ 30%] Building CXX object gameinput/CMakeFiles/gameinput.dir/gameinput.cpp.obj
[ 31%] Linking CXX shared library ../bin/xgameruntime.dll
[ 31%] Built target xgameruntime
[ 33%] Building CXX object audio/CMakeFiles/acphal.dir/acphal.cpp.obj
[ 34%] Linking CXX shared library ../bin/GameInput.dll
[ 34%] Built target gameinput
[ 36%] Building CXX object audio/CMakeFiles/xapu.dir/xapu.cpp.obj
[ 37%] Linking CXX shared library ../bin/AcpHal.dll
[ 39%] Linking CXX shared library ../bin/xapu.dll
[ 39%] Built target acphal
[ 40%] Building CXX object audio/CMakeFiles/chad.dir/chad.cpp.obj
[ 40%] Built target xapu
[ 42%] Building CXX object conformance/test_d3dmetal_gpu_limits/CMakeFiles/test_d3dmetal_gpu_limits.dir/main.cpp.obj
[ 43%] Linking CXX shared library ../bin/chad.dll
[ 43%] Built target chad
[ 44%] Building CXX object conformance/test_shim_exports/CMakeFiles/test_shim_exports.dir/main.cpp.obj
[ 46%] Linking CXX executable ../../bin/test_shim_exports.exe
[ 47%] Linking CXX executable ../../bin/test_d3dmetal_gpu_limits.exe
[ 47%] Built target test_shim_exports
[ 49%] Building CXX object conformance/test_system32_staging/CMakeFiles/test_system32_staging.dir/main.cpp.obj
[ 49%] Built target test_d3dmetal_gpu_limits
[ 50%] Building CXX object conformance/test_veh_clwb/CMakeFiles/test_veh_clwb.dir/main.cpp.obj
[ 52%] Linking CXX executable ../../bin/test_system32_staging.exe
[ 53%] Linking CXX executable ../../bin/test_veh_clwb.exe
[ 53%] Built target test_system32_staging
[ 53%] Built target test_veh_clwb
[ 55%] Building CXX object conformance/test_veh_clwb/CMakeFiles/test_veh_unhandled.dir/main_unhandled.cpp.obj
[ 56%] Building CXX object conformance/test_xcrdapi/CMakeFiles/test_xcrdapi.dir/main.cpp.obj
[ 57%] Linking CXX executable ../../bin/test_veh_unhandled.exe
[ 57%] Built target test_veh_unhandled
[ 59%] Building CXX object conformance/test_xg_xs/CMakeFiles/test_xg_xs.dir/main.cpp.obj
[ 60%] Linking CXX executable ../../bin/test_xcrdapi.exe
[ 60%] Built target test_xcrdapi
[ 62%] Building CXX object conformance/test_xgameruntime/CMakeFiles/test_xgameruntime.dir/main.cpp.obj
[ 63%] Linking CXX executable ../../bin/test_xg_xs.exe
[ 63%] Built target test_xg_xs
[ 65%] Building CXX object conformance/test_xgameruntime/CMakeFiles/test_xgameruntime_unentitled.dir/main.cpp.obj
[ 66%] Linking CXX executable ../../bin/test_xgameruntime.exe
[ 66%] Built target test_xgameruntime
[ 68%] Building CXX object conformance/test_xmem/CMakeFiles/test_xmem.dir/main.cpp.obj
[ 69%] Linking CXX executable ../../bin/unentitled/test_xgameruntime.exe
[ 69%] Built target test_xgameruntime_unentitled
[ 71%] Building CXX object conformance/test_xmem_physical/CMakeFiles/test_xmem_physical.dir/main.cpp.obj
[ 72%] Linking CXX executable ../../bin/test_xmem.exe
[ 72%] Built target test_xmem
[ 73%] Building CXX object win32_bridge/CMakeFiles/psm_appnotify_1_0.dir/psm_appnotify.cpp.obj
[ 75%] Linking CXX shared library ../bin/api-ms-win-core-psm-appnotify-l1-1-0.dll
[ 76%] Linking CXX executable ../../bin/test_xmem_physical.exe
[ 76%] Built target psm_appnotify_1_0
[ 78%] Building CXX object win32_bridge/CMakeFiles/psm_appnotify_1_1.dir/psm_appnotify.cpp.obj
[ 78%] Built target test_xmem_physical
[ 79%] Building CXX object d3d12_xs/CMakeFiles/d3d12_xs.dir/d3d12_xs.cpp.obj
[ 81%] Linking CXX shared library ../bin/api-ms-win-core-psm-appnotify-l1-1-1.dll
[ 81%] Built target psm_appnotify_1_1
[ 82%] Building CXX object d3d12_xs/CMakeFiles/d3d12_xs.dir/proxy.cpp.obj
[ 84%] Building CXX object d3d12_xs/CMakeFiles/d3d12_xs.dir/proxy_generated.cpp.obj
[ 85%] Building CXX object conformance/test_audio_input/CMakeFiles/test_audio_input.dir/main.cpp.obj
[ 86%] Linking CXX shared library ../bin/d3d12_xs.dll
[ 86%] Built target d3d12_xs
[ 88%] Building CXX object conformance/test_win32_bridge/CMakeFiles/test_win32_bridge.dir/main.cpp.obj
[ 89%] Linking CXX executable ../../bin/test_audio_input.exe
[ 89%] Built target test_audio_input
[ 91%] Building CXX object conformance/test_apiset_resolution/CMakeFiles/test_apiset_resolution.dir/main.cpp.obj
[ 92%] Linking CXX executable ../../bin/test_apiset_resolution.exe
[ 94%] Linking CXX executable ../../bin/test_win32_bridge.exe
[ 94%] Built target test_apiset_resolution
[ 95%] Building CXX object conformance/test_d3d12_xs/CMakeFiles/test_d3d12_xs.dir/main.cpp.obj
[ 95%] Built target test_win32_bridge
[ 97%] Building CXX object conformance/test_integration_boot/CMakeFiles/test_integration_boot.dir/main.cpp.obj
[ 98%] Linking CXX executable ../../bin/test_d3d12_xs.exe
[ 98%] Built target test_d3d12_xs
[100%] Linking CXX executable ../../bin/test_integration_boot.exe
[100%] Built target test_integration_boot
=== Verifying built PE32+ DLL Export Directories against abi/defs/*.def ===
OK AcpHal.dll (9 exact exports verified)
OK GameInput.dll (1 exact exports verified)
OK XCRDAPI.dll (1 exact exports verified)
OK api-ms-win-core-psm-appnotify-l1-1-0.dll (2 exact exports verified)
OK api-ms-win-core-psm-appnotify-l1-1-1.dll (2 exact exports verified)
OK bx_runtime_veh.dll (6 exact exports verified)
OK chad.dll (5 exact exports verified)
OK d3d12_xs.dll (4 exact exports verified)
OK ext-ms-win-rtcore-ntuser-message-ansi-l1-1-0.dll (2 exact exports verified)
OK ext-ms-win-rtcore-ntuser-message-l1-1-0.dll (1 exact exports verified)
OK ext-ms-win-rtcore-ntuser-window-ansi-l1-1-0.dll (3 exact exports verified)
OK ext-ms-win-rtcore-ntuser-window-l1-1-0.dll (1 exact exports verified)
OK xapu.dll (5 exact exports verified)
OK xg_xs.dll (2 exact exports verified)
OK xgameruntime.dll (49 exact exports verified)
OK xmem.dll (15 exact exports verified)
Verified 16 PE32+ shim DLLs (108 exact exports, 0 extra, 0 forbidden MinGW imports) in /tmp/bx-uma-verify/build-shims/bin
Native bx-cli architecture: file = Mach-O 64-bit executable arm64; lipo -archs = arm64.
COMMAND: /tmp/bx-uma-verify/cargo-target/debug/bx-cli run --prefix /tmp/bx-uma-verify/smoke-prefix --shims /tmp/bx-uma-verify/build-shims/bin --log /tmp/bx-uma-verify/veh-clwb.jsonl --exe /tmp/bx-uma-verify/build-shims/bin/test_veh_clwb.exe
EXIT: 0
bx-cli: replaced /tmp/bx-uma-verify/smoke-prefix/drive_c/windows/system32/bx_runtime_veh.dll
bx-cli: replaced /tmp/bx-uma-verify/smoke-prefix/drive_c/windows/system32/xgameruntime.dll
CLWB traps observed: 6
xmem stats: limit=8192 MB committed=8192 bytes
PASS: test_veh_clwb
Trace summary of /tmp/bx-uma-verify/veh-clwb.jsonl:
Trace events : 4
clwb VEH traps : at least 4 (sampled)
ADX illegal ops : 0
COMMAND: /tmp/bx-uma-verify/cargo-target/debug/bx-cli run --prefix /tmp/bx-uma-verify/smoke-prefix --shims /tmp/bx-uma-verify/build-shims/bin --log /tmp/bx-uma-verify/shim-exports.jsonl --exe /tmp/bx-uma-verify/build-shims/bin/test_shim_exports.exe
EXIT: 0
bx-cli: already current /tmp/bx-uma-verify/smoke-prefix/drive_c/windows/system32/bx_runtime_veh.dll
bx-cli: already current /tmp/bx-uma-verify/smoke-prefix/drive_c/windows/system32/xgameruntime.dll
PASS: test_shim_exports (25 checks verified)
Trace summary of /tmp/bx-uma-verify/shim-exports.jsonl:
Trace events : 1
clwb VEH traps : 0
ADX illegal ops : 0
COMMAND: /tmp/bx-uma-verify/cargo-target/debug/bx-cli trace /tmp/bx-uma-verify/veh-clwb.jsonl
EXIT: 0
Trace events : 4
clwb VEH traps : at least 4 (sampled)
ADX illegal ops : 0
Python runner source parsed with ast.parse; both receipt JSON documents parsed.
Published probe source SHA-256 matches the shared-runner execution receipt.
Runner compilation used -Wall -Wextra -Werror and exited 0; benchmark exited 0 with timeout false.
Git diff --cached --check accepts preserved CRLF raw logs through the research-local .gitattributes.
The original user checkout had no tracked-file content changes between preflight and the recorded checksum check.
COMMAND: python3 scripts/audit/docs_hygiene.py
EXIT: 0
docs hygiene: 190 tracked files checked, 0 problem(s)
+169
View File
@@ -0,0 +1,169 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-3.0-or-later
"""Build and run the six fixed UMA experiments without altering a source bottle."""
import argparse
import hashlib
import json
import os
from pathlib import Path
import plistlib
import re
import shutil
import signal
import subprocess
import sys
import time
def digest(path):
return hashlib.sha256(path.read_bytes()).hexdigest()
def command(args, env, cwd):
result = subprocess.run(args, cwd=cwd, env=env, capture_output=True)
return {"command": [str(x) for x in args], "exit_code": result.returncode,
"stdout": result.stdout.decode(errors="replace"),
"stderr": result.stderr.decode(errors="replace")}
def bottle_value(text, key):
matches = re.findall(r'^"' + re.escape(key) + r'"\s*=\s*"([^"]*)"', text, re.M)
return matches[-1] if matches else None
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--bottle", required=True, type=Path,
help="absolute path to existing CrossOver win64 bottle; copied, never modified")
parser.add_argument("--scratch", required=True, type=Path,
help="new empty directory outside the repository; all generated files go here")
parser.add_argument("--crossover", type=Path, default=Path("/Applications/CrossOver.app"))
parser.add_argument("--compiler", default="x86_64-w64-mingw32-g++")
parser.add_argument("--receipt-only", action="store_true",
help="separate diagnostic: device, wrapping, 10-second pause for library inspection; no benchmark")
args = parser.parse_args()
source = Path(__file__).resolve().with_name("probe.cpp")
scratch = args.scratch.expanduser().resolve()
# The runner itself never writes into a checkout or existing scratch directory.
repository = Path(__file__).resolve().parents[3]
if scratch == repository or repository in scratch.parents:
parser.error("--scratch must be outside this checkout")
if scratch.exists():
parser.error("--scratch already exists; use a fresh run directory")
bottle = args.bottle.expanduser().resolve()
config = bottle / "cxbottle.conf"
if not config.is_file():
parser.error("--bottle must contain cxbottle.conf")
original = config.read_text()
if bottle_value(original, "WineArch") != "win64":
parser.error("baseline requires an existing win64 bottle")
cx = args.crossover.expanduser().resolve() / "Contents/SharedSupport/CrossOver"
wine = cx / "bin/wine"
if not wine.is_file() or not shutil.which(args.compiler):
parser.error("CrossOver wine or cross-compiler is unavailable")
scratch.mkdir(parents=True)
os.chmod(scratch, 0o700)
# Small allowlist: do not forward host credentials or unrelated Wine overrides.
env = {key: os.environ[key] for key in
("HOME", "USER", "LOGNAME", "PATH", "LANG", "LC_ALL", "DISPLAY") if key in os.environ}
env["TMPDIR"] = str(scratch) + "/"
env.update(ROSETTA_ADVERTISE_AVX="1", CX_GRAPHICS_BACKEND="d3dmetal", WINEDEBUG="-all")
observations = {}
for name, cmd in {
"chip": ["sysctl", "-n", "machdep.cpu.brand_string"],
"ram_bytes": ["sysctl", "-n", "hw.memsize"],
"macos": ["sw_vers"], "host_arch": ["uname", "-m"],
"compiler": [args.compiler, "--version"],
"crossover": [str(wine), "--version"],
"rosetta": ["pkgutil", "--pkg-info", "com.apple.pkg.RosettaUpdateAuto"],
}.items():
observations[name] = command(cmd, env, scratch)
framework = cx / "lib64/apple_gptk/external/D3DMetal.framework/Versions/A"
for name in ("Info.plist", "version.plist"):
p = framework / "Resources" / name
observations["d3dmetal_" + name] = plistlib.loads(p.read_bytes()) if p.is_file() else None
backend = cx / "lib64/apple_gptk/wine/x86_64-windows/d3d12.dll"
observations["installed_backend_dll"] = {"path": str(backend), "sha256": digest(backend)} if backend.is_file() else None
observations["source_sha256"] = digest(source)
observations["bottle"] = {"template": bottle_value(original, "Template"),
"architecture": bottle_value(original, "WineArch"),
"mode": "temporary private clone; --no-update",
"runtime_backend_setting": "CX_GRAPHICS_BACKEND=d3dmetal"}
observations["environment"] = {k: env[k] for k in
("ROSETTA_ADVERTISE_AVX", "CX_GRAPHICS_BACKEND", "WINEDEBUG")}
observations["timeout_seconds"] = 30
observations["mode"] = "diagnostic-only" if args.receipt_only else "six-check-baseline"
local_source = scratch / "probe.cpp"
shutil.copy2(source, local_source)
exe = scratch / "probe.exe"
compile_cmd = [args.compiler, "-std=c++20", "-O2", "-static", "-static-libgcc",
"-static-libstdc++", "-Wall", "-Wextra", "-Werror",
str(local_source), "-o", str(exe), "-lkernel32"]
observations["compile"] = command(compile_cmd, env, scratch)
if observations["compile"]["exit_code"]:
(scratch / "receipt.json").write_text(json.dumps(observations, indent=2) + "\n")
print(observations["compile"]["stderr"], file=sys.stderr)
return 2
observations["executable_sha256"] = digest(exe)
observations["executable_format"] = command(["file", str(exe)], env, scratch)
objdump = shutil.which("x86_64-w64-mingw32-objdump")
if objdump:
pe = command([objdump, "-p", str(exe)], env, scratch)
pe["stdout"] = "\n".join(line for line in pe["stdout"].splitlines()
if "DLL Name:" in line or "Magic" in line or "file format" in line)
observations["pe_imports"] = pe
temporary_bottle = scratch / "bottle"
shutil.copytree(bottle, temporary_bottle, symlinks=True)
temporary_config = temporary_bottle / "cxbottle.conf"
# Apply overrides only to the disposable clone. This original locally built
# executable is trusted; scan third-party/untrusted launches normally.
# CrossOver's scanner otherwise aborts if the host lacks a ClamAV database.
configured = original.replace("[Bottle]", '[Bottle]\n"AllowUntrusted" = "1"', 1)
configured += '\n[EnvironmentVariables]\n"CX_GRAPHICS_BACKEND" = "d3dmetal"\n'
configured += '\n[CrossOver]\n"AntiVirusScan" = "untrusted"\n'
temporary_config.write_text(configured)
observations["temporary_config_sha256"] = digest(temporary_config)
launch = [str(wine), "--bottle", str(temporary_bottle), "--no-update", "--no-gui",
"--workdir", str(scratch)]
if args.receipt_only:
launch += ["--debugmsg", "-all,+loaddll,+d3d12"]
launch += [str(exe)]
if args.receipt_only:
launch += ["--receipt"]
observations["launch"] = launch
observations["run_exit_code"] = None
observations["timed_out"] = False
try:
start = time.monotonic()
with (scratch / "stdout.txt").open("wb") as out, (scratch / "stderr.txt").open("wb") as err:
child = subprocess.Popen(launch, cwd=scratch, env=env, stdout=out, stderr=err,
start_new_session=True)
try:
observations["run_exit_code"] = child.wait(timeout=30)
except subprocess.TimeoutExpired:
observations["timed_out"] = True
os.killpg(child.pid, signal.SIGKILL)
child.wait()
observations["run_exit_code"] = 124
except BaseException:
os.killpg(child.pid, signal.SIGKILL)
child.wait()
raise
observations["process_elapsed_seconds"] = time.monotonic() - start
finally:
# Never kill another bottle's server. Prefix disposal follows process exit.
stop_env = dict(env, WINEPREFIX=str(temporary_bottle))
observations["stop_private_server"] = command([str(cx / "bin/wineserver"), "-k"], stop_env, scratch)
observations["source_bottle_config_unchanged"] = config.read_text() == original
shutil.rmtree(temporary_bottle)
(scratch / "receipt.json").write_text(json.dumps(observations, indent=2) + "\n")
print((scratch / "stdout.txt").read_text(errors="replace"), end="")
print((scratch / "stderr.txt").read_text(errors="replace"), file=sys.stderr, end="")
print(f"RUN_EXIT={observations['run_exit_code']} TIMEOUT={observations['timed_out']} "
f"process_elapsed_s={observations['process_elapsed_seconds']:.6f}")
print("Receipt and raw logs:", scratch)
return observations["run_exit_code"]
if __name__ == "__main__":
sys.exit(main())