Repository navigation
Cluster native Swift: serialized evaluation and quantized Metal repairs - #56
Draft
jonathan308 wants to merge 8 commits into
Draft
jonathan308 wants to merge 8 commits into
jonathan308 wants to merge 8 commits into
Conversation
GPU.deviceInfo() called MTLCreateSystemDefaultDevice() on every call. In a command-line process the first such call opens a window-server session (SLSCreateDefaultMetalDevice -> SLSMainDisplayID -> SLSInitialize -> CGSDisplayInitialize), which stalled for 7.1 s and 30.1 s on an M5 box. Compute the value once per process (static let), from the first device of MTLCopyAllDevices(), which is the device MLX's metal::load_device selects. Fall back to MTLCreateSystemDefaultDevice() only when that list is empty. The public API and the returned fields do not change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Source/Cmlx/include/mlx/c/distributed_group.h mirrors mlx-c's declarations of mlx_distributed_set_seal_codec and mlx_distributed_all_sum_sealed. The nested mlx and mlx-c checkouts carry the implementation on their darkbloom/sealed-all-sum branches (not bumped here: the integrator moves the nested pointers together). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ow server Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…sum) mlx 535d4e4e (on fdae3174): distributed::all_sum_sealed, two ranks; each partial crosses only as a codec-sealed frame, the peer's is opened (refused frames fail the evaluation) and the two are added in rank order. mlx-c 2415568 (on 489e965): the C API for it and its codec callbacks. The header mirror is 9244519. No kernel change: the metallib is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Make the cluster's native Swift path safe when Swift evaluation and a raw C collective completion share Metal streams. The Execution SPI exposes a synchronous scope using the existing recursive evaluation lock. Refresh core to 9e22e1998a3b6f7f6f4ad58dc2038ecf9f4d0cb9 and regenerate all four quantized JIT resources for partial-tile bounds and distinct offline Metal loader symbols. The cached device discovery and sealed all-sum surface remain included. Add GLMCalibration SPI for install-once Metal backing caps and snapshots, with the matching C bridge pinned at c4154afc4ef5d22cea324391fb7052d1fc68ce5f. The cap reserves pending backing before allocation and refunds only after actual Metal deallocation; it does not cap host or whole-process memory.
Before
After
The SPI scope is synchronous; callers must not suspend or wait for work submitted on another thread while holding it. It does not make arbitrary concurrent graph construction safe. Sealed all-sum remains stacked on #54; mlx-c moves to c4154afc4ef5d22cea324391fb7052d1fc68ce5f, adding the cap API atop the sealed all-sum branch. Its target base is included; the separate fork-main delta remains documentation/CI only. Current Swift main 9ad4718 and target base 64070c4 are integrated.
Evidence
sh tools/check-process-allocation-cap.shpasses the real VM/Blocks ledger and C bridge checks plus backend/header/Swift syntax checks. Pinned formatting passes. Current fork-diff coverage and upstream merge-base gate: 245/245. Independent allocator and CPU reviews found no outstanding scoped blocker.Earlier kernel/execution evidence below is retained separately.
Merge Danger
Door: two-way. Restore the consumer pin and matching native resources together.
Blast Radius: native. Shared Metal execution ordering and quantized kernels affect SDK consumers. The cap is optional and process-local, cannot be raised/reset, and includes fixed heap and pending allocations. It is not a host/driver/whole-process limit and grants no model qualification. Ordinary residency-registration failures now clean up their buffer ownership. Protected merges, release signing and deployment are separate actions.