metal: allow disabling binary pipeline archives #519
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/519"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by fruvs on 2026-11-27T23:52:18Z.
Problem
On macOS 27.2.1 (Apple M5 Pro), Metal sometimes terminates the process while opening or populating an
MTLBinaryArchivewhen the executable is run from an app bundle in a restricted launch. I observed an Objective-C exception inrecordBinaryArchiveUsage:during a reopen, and a null dereference inMTLCompiler createBinaryArchiveAsRecompileTarget:…while adding the first compute pipeline to a fresh archive. The latter exits inside Metal before an error can reach the caller.Change
Add an opt-out with
VICTORY_NO_PIPELINE_ARCHIVE=1. This uses the existing direct pipeline compilation paths, while the translated shader and Metal library caches stay available. Default archive behavior stays enabled.Minimal reproducer
In a signed macOS app bundle, run this using a writable cache URL. Use the normal bundled launch as a control and the same executable under a sandbox profile that denies network, external writes and other executable launches, with
HOME,CFFIXED_USER_HOMEandTMPDIRpointing inside the writable directory.The synthetic program reproduced the fresh-archive null dereference on the first restricted launch. Its unrestricted fresh and warm controls passed, and later restricted launches also passed. The exact macOS trigger is still unresolved.
Verification
victory-metalarchive tests passed on native ARM64 with the default archive path.Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by AnastasisKon on 2026-11-28T17:05:50Z.
Review: APPROVED
Read the diff: a 4-line early return in
Archive::openforVICTORY_NO_PIPELINE_ARCHIVE=1, plus a documented paragraph indocs/native-host.md(the switch follows the repo'sVICTORY_*convention and the docs' cache section already documents the neighbouringVICTORY_NO_SHADER_CACHE). Rancargo test -p victory-metal --libon the head: 42 passed, 0 failed. The opt-out only skips the binary archive; the shader translation and Metal library caches stay on, as the body says. Approving.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.