metal: allow disabling binary pipeline archives #523
No reviewers
Labels
No labels
accessibility
bug
claimed
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
tester report
urgent
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LakshanSivakumar--Native-Victory-macOS!523
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@fruvs on GitHub · 2026-11-27 23:52 UTC · original
fruvs:codex/metal-pipeline-archive-opt-out→main· +9 −0 · 2 files · 1 commits · draftProblem
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.@AnastasisKon on GitHub · 2026-11-28 17:05 UTC · original · approved these changes
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.