Skip to content

scripts: skip test metallib copy on Swift 6.4 layout, add Metal Toolchain check - #222

Merged
solderzzc merged 2 commits into
mainfrom
ci/drop-test-metallib-copy
Oct 9, 2026
Merged

solderzzc merged 2 commits into
mainfrom
ci/drop-test-metallib-copy

Conversation

@solderzzc

@solderzzc solderzzc commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

Follow-up on #128 (Tier 3: make the local test suite runnable).

What this PR does now

  • Adds scripts/check-metal-toolchain.sh: fails early with the xcodebuild -downloadComponent MetalToolchain hint when the Metal Toolchain is missing.
  • scripts/install-test-metallib.sh and scripts/bootstrap_local_tests.sh: on the Swift 6.4 / Xcode 27 build layout (.build/out/) they only run the toolchain check and skip the metallib copy; on older toolchains they behave as before.

Why the copy is skipped only on Swift 6.4
Verified on Swift 6.4 / Xcode 27: SwiftPM compiles the Cmlx kernels and embeds default.metallib in mlx-swift_Cmlx.bundle inside every .xctest. Copying a metallib into <bundle>.xctest/Contents/MacOS invalidates the bundle signature, and the next incremental swift build --build-tests then fails at CodeSign (reproduced).

Not verified / correction
An earlier revision of this PR also removed the copy from ci.yml. That broke CI: the runner uses Xcode 26.3 (Swift 6.2, .build/arm64-apple-macosx/ layout), which does not embed the metallib (Failed to load the default metallib). ci.yml is restored to its original state. I could not reproduce the "unsigned library" abort reported with bare swift test, and I have no Swift 6.2 toolchain locally, so the old-layout path is covered by CI only.

🤖 Generated with Claude Code

solderzzc and others added 2 commits October 9, 2026 06:22
…lchain instead

SwiftPM compiles the Cmlx kernels itself and embeds default.metallib in
mlx-swift_Cmlx.bundle inside every .xctest. Hiding that file makes the MLX
tests abort with 'Failed to load the default metallib'; with it present the
suites pass without any copied metallib.

Copying a metallib into <bundle>.xctest/Contents/MacOS invalidates the bundle
signature and the next incremental 'swift build --build-tests' fails at
CodeSign. install-test-metallib.sh, bootstrap_local_tests.sh and the
build_and_unit_test CI step all did that.

- add scripts/check-metal-toolchain.sh (fails early with the fix)
- drop scripts/install-test-metallib.sh (its search path no longer matched
  the Swift 6.4 layout and it fell back to pip-installing the mlx wheel)
- bootstrap_local_tests.sh: toolchain check + build, optional --with-server
- coverage-report.sh: use the toolchain check
- ci.yml: remove only the Contents/MacOS copy; the copy next to the release
  binary stays

Refs #128

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…6.4 build layout

The previous commit removed the metallib copy from ci.yml, but CI runs Xcode 26.3
(Swift 6.2, .build/arm64-apple-macosx/ layout) where default.metallib is not embedded
in the test bundles, so the SwiftBuddy tests aborted with 'Failed to load the default
metallib'. The embedding only exists on Swift 6.4 (.build/out layout), so the scripts
now detect that layout and skip the copy there; ci.yml is back to its original state.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@solderzzc solderzzc changed the title test: stop copying metallib into .xctest bundles; check the Metal toolchain instead scripts: skip test metallib copy on Swift 6.4 layout, add Metal Toolchain check Oct 9, 2026
@solderzzc
solderzzc merged commit 8240a01 into main Oct 9, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant