Metal: add native Apple Silicon GPU conformance harness #460
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!460
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/460/head"
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?
@pedrofort on GitHub · 2026-11-24 03:41 UTC · original
pedrofort:metal-conformance→main· +1194 −1 · 5 files · 1 commits · closed without mergingOverview
This PR introduces an experimental native Metal GPU conformance harness for Apple Silicon.
It demonstrates that synthetic Xbox GFX10 shaders translated by VIctory can be converted from DXIL to Metal libraries and executed on Apple GPU hardware, with their outputs verified against independent CPU references.
The complete test path is:
GFX10 → VIctory → DXIL → Metal Shader Converter → Metal GPU execution → readback verificationNo Wine, Rosetta, Windows VM or game assets are required.
Hardware validation
Apple M5 with 16 GB unified memory
macOS 27.2.1
Native ARM64 executable
Rust 1.98.1
Xcode and macOS SDK 27.0
Metal Shader Converter 4.0.3
Metal API and GPU validation enabled
Results
Verification | Result -- | -- Automated checks with optional A/B comparison | 58/58 passed Translated shader pixel comparisons | 16,384/16,384 RGBA channel comparisons | 65,536 Maximum observed channel error in positive tests | 0 Compute buffer values | 64/64 Buffer guard values | 16/16 Failed checks | 0 Blocked checks | 0 Asset policy | 155 files passed Xtask unit tests | 5/5 passed Xtask Clippy | PassedGPU coverage
Constant pixel colors
Position-dependent floating-point arithmetic
Integer and floating-point conversions
Bitwise operations
Conditional selection
Dynamic byte permutation covering all 256 selector values in each output byte, using two operand pairs
Translated vertex shaders
Combined translated vertex and pixel pipelines
Native versus translated vertex pipeline equivalence
Compute dispatch with writable raw buffers
GPU memory readback and trailing guard verification
A negative control deliberately compares a red output against a checkerboard reference. The harness correctly detects the mismatch and rejects the result.
Optional differential testing
The harness accepts a second VIctory executable for A/B testing.
During development, the dynamic
v_perm_b32changes from #423 were tested against the original lowering. Both operand sets produced byte-identical GPU outputs, while the candidate no longer declared the INT64 shader feature.Reproduction
Install Apple's Metal Shader Converter and Xcode, then run:
All generated artifacts remain in a temporary directory outside the repository.
The runner produces detailed logs, GPU readbacks and a JSON summary. Failed or blocked checks return a nonzero exit status.
Asset policy
Only the three specifically named Python and Swift test sources are newly permitted. All existing file-size, binary-content, magic-signature and encoded-data checks remain enforced.
No generated binaries, proprietary assets or Apple converter components are committed.
Relationship to other PRs
The harness is independent of the implementation changes in #235, #423 and #438.
A working macOS VIctory executable is required. Native build portability was validated using #235 by @SkippySteve. The optional #423 comparison is not required for normal use.
Limitations
This is a GPU testing infrastructure, not a complete Metal backend or Xbox title runtime.
It does not establish game compatibility, general resource binding support, mesh shader compatibility or performance improvements.
Independent testing on other Apple Silicon generations is welcome.
AI-assisted implementation, reviewed and validated on physical Apple Silicon hardware.
@jeremygold02 on GitHub · 2026-11-24 17:38 UTC · original
Windows-side verification at head
8ce597b2beea8aa5073391010f012755c7a7fc76:cargo test --locked -p xtask metal_test_sources_are_still_checked -- --test-threads=1: 1 passed, 0 failed, 4 filtered. This checks that only the three named Metal harness sources are allowlisted, while other Python/Swift files, an executable-styleMZsignature, and an oversized source remain rejected.cargo run --locked -p xtask -- policy: asset policy passed for 155 files.python -m py_compile tests/metal/generate.py tests/metal/run.py: both Python files compiled successfully.I reviewed the Metal runner and Swift probe. The runner requires native Apple Silicon macOS and exits before creating its temporary lab or invoking Swift, the converter, or GPU commands on other platforms. Therefore the Metal conversion, shader execution, pixel readback and compute-buffer checks were not reproduced here; those hardware results remain unverified by this Windows run.
This verification was AI-assisted.
@Marvisak on GitHub · 2026-11-25 00:03 UTC · original
Automated triage for the maintainers. Closing because it is outside the project's scope (VIctory targets Windows hosts; ports, launchers and tooling for other platforms are not being taken).
Out of scope: a macOS/Apple Silicon Metal harness (Python and Swift, needs Apple's Metal Shader Converter and the conflicting Linux-build PR #235), and it adds three path exceptions for .py/.swift files to the asset-policy allowlist in xtask/src/policy.rs.
If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.
Pull request closed