Skip to content

fix: GemmaPrefillBridge Sendable + benchmark resource path - #43

Merged
ekryski merged 1 commit into
ekryski:alphafrom
TheTom:pr/alpha-sendable-resource-fixes
Apr 16, 2026
Merged

ekryski merged 1 commit into
ekryski:alphafrom
TheTom:pr/alpha-sendable-resource-fixes

Conversation

@TheTom

@TheTom TheTom commented Apr 16, 2026

Copy link
Copy Markdown

Summary

Two small fixes needed after the alpha cleanup merges:

  1. GemmaPrefillBridge Sendable: alpha's Swift 6 strict concurrency rejects the static let shared without Sendable conformance. Add @unchecked Sendable + nonisolated(unsafe).

  2. Benchmark resource path: prompt files live in Tests/Benchmarks/Resources/llm-test-prompts/ but the code was looking in Resources/ directly. Add the subdirectory to the path.

Test

After these fixes, benchmark runs clean:

[ENV] NAX: ENABLED ✓
[ENV] Gemma template: OK (16317 chars)
[BENCH] Prefill: 15616.6 tok/s
[BENCH] Generation: 190.1 tok/s
[BENCH] TTFT: 28ms

🤖 Generated with Claude Code

- GemmaPrefillBridge: @unchecked Sendable + nonisolated(unsafe) on shared
  (fixes Swift 6 strict concurrency error in alpha)
- InferenceBenchmark: load prompts from Resources/llm-test-prompts/
  (files live in subdirectory, not Resources/ directly)

Co-Authored-By: tturney1@gmail.com
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ekryski
ekryski merged commit e7151b9 into ekryski:alpha Apr 16, 2026
ekryski added a commit that referenced this pull request May 14, 2026
Add documentation/turbo-kernels.md explaining what each of the 11
custom Metal kernels in the upstream ekryski/mlx fork does, when it
runs, where its source lives, and how it's wired in Swift.

Covers:

* Encode family: turbo_fused_encode, turbo_fused_encode_wht
* A-path attention family: turbo_flash_p1 (+ causal/nr0 variants),
  turbo_flash_pass2 (+ fused_rot variant), turbo_flash_sdpa_v
* Separated fallback: turbo_score, turbo_value
* B-path support: turbo_dequant_rotated

Plus a routing-decision map (A vs B path, single-pass vs two-pass
TurboFlash), the env-var tunables table, and a section explaining
why TurboQuant peak GPU matches `--kv none` (lazy-compression
two-phase architecture vs AffineQuantizedKVCache's write-time
quantisation).

Future-work section enumerates 12 optimisation candidates split into
three buckets: already specced in #43, broader audit in #42, and
six items not yet specced (fused K+V dequant kernel, pass1+pass2
fusion at small ctx, eager prefill encode, adaptive per-layer
precision, sparse-V auto-tune, FWHT for value rotation).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
ekryski added a commit that referenced this pull request May 15, 2026
Add documentation/turbo-kernels.md explaining what each of the 11
custom Metal kernels in the upstream ekryski/mlx fork does, when it
runs, where its source lives, and how it's wired in Swift.

Covers:

* Encode family: turbo_fused_encode, turbo_fused_encode_wht
* A-path attention family: turbo_flash_p1 (+ causal/nr0 variants),
  turbo_flash_pass2 (+ fused_rot variant), turbo_flash_sdpa_v
* Separated fallback: turbo_score, turbo_value
* B-path support: turbo_dequant_rotated

Plus a routing-decision map (A vs B path, single-pass vs two-pass
TurboFlash), the env-var tunables table, and a section explaining
why TurboQuant peak GPU matches `--kv none` (lazy-compression
two-phase architecture vs AffineQuantizedKVCache's write-time
quantisation).

Future-work section enumerates 12 optimisation candidates split into
three buckets: already specced in #43, broader audit in #42, and
six items not yet specced (fused K+V dequant kernel, pass1+pass2
fusion at small ctx, eager prefill encode, adaptive per-layer
precision, sparse-V auto-tune, FWHT for value rotation).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
div0-space pushed a commit to LibraxisAI/mlx-swift-lm that referenced this pull request Nov 29, 2026
The Layr-Labs/mlx-swift revision moves from 8d927e6d to eedca444, the
new mlx-swift#63 head. It pins mlx ff4bb35b (Layr-Labs/mlx#43, a freed
compiled closure is erased from every thread compile cache, on top of
main with ekryski#40) and mlx-c 004c735f.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
div0-space pushed a commit to LibraxisAI/mlx-swift-lm that referenced this pull request Nov 29, 2026
div0-space pushed a commit to LibraxisAI/mlx-swift-lm that referenced this pull request Nov 29, 2026
SDK main gained ml-explore#358: Package.swift pins Layr-Labs/mlx-swift eedca444
(was 6c31f9f1), which pins mlx ff4bb35b (Layr-Labs/mlx ekryski#43: a freed
compiled closure is erased from every thread compile cache; ekryski#40: float16
and bfloat16 floor divide in float32) and mlx-c 004c735f. Clean merge.
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.

2 participants