Repository navigation
Enable Windows ARM64 CUDA GGUF inference - #385
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
The gitlink moves from 6fe39a2b to 2bda9817, keeping the existing patch stack and adding the cuDNN handle release.
Generate a .cmd launcher, run it through ComSpec, preserve environment overrides, and allow the cold delegate probe up to 60s on Windows.
…ead exit Use NVRTC-native integer types in kquant.cu.inc, expose mlx_clear_streams through the bridge, and call it on the model thread before Windows thread teardown.
Automatic DFlash2 verification uses the Metal-only fused GDN kernel. Skip companion auto-discovery off Darwin while retaining explicit draft validation.
Model swap now unregisters with dispose and waits for tracked disposals, preserving aliases and in-flight leases while preventing old native threads from overlapping the next load.
Compare discovered test files using forward slashes so serial-lane matching works on Windows.
Implement native endpoint discovery for input and render devices on Windows, including stable IDs, defaults, formats, and hot-plug error handling. Share the portable capture ring/worker with Windows and scope its producer methods to the platforms that use them.
Gate paged-attention validators, tracing imports, disk-tier unix helpers, and GGUF mincore sampling to macOS/unix while keeping them available to tests. These paths have no Windows consumer until a CUDA paged-attention backend exists.
Documents the inventory-and-implement workflow used to separate real Windows feature gaps from macOS-only paths.
846a6d2 to
d0131aa
Compare
Positioned reads use seek_read on Windows, GgufTensorType is imported unconditionally for release tests, and cold-tier/paged/ASR test helpers are gated to unix or macOS. Apply rustfmt to the WASAPI sources.
Add Windows prebuilt export/consumption with PowerShell hashing and per-target pinning, a windows-11-arm prebuilt job, and unsigned Windows ARM64 ZIP packaging with staged CUDA/cuDNN/OpenBLAS runtime files and release validation. macOS flow is unchanged.
Unindented here-string content terminated the YAML block scalar and made the workflow file invalid. Indent the release notes and pin snippet so the file parses.
cuda_13.4.2_windows_arm64_network.exe returns 404; the full installer cuda_13.4.2_windows_arm64.exe exists. Apply rustfmt to disk_tier.rs and build.rs.
Get-FileHash is available in pwsh on both the windows-11-arm runner and local machines; the powershell invocation failed on the runner.
read_exact_at needs std::os::unix::fs::FileExt in scope on macOS/Linux; the Windows seek_read branch keeps its own import.
ReleaseCapture is a command the model thread sends to the worker. Emitting it from the worker on exit left a command queued in the native-start and prepare-failure tests.
The worker releases its capture on exit, which is expected. assert_no_command now ignores that notification instead of treating it as an unexpected command, while ReleaseCapture stays constructed.
assert_no_command now accepts Disconnected as well as Empty: the capture worker closing its channel on exit is expected, not a queued command.
ae0688a to
e0416ae
Compare
…anes), Flash Next partial-store decode, app wait states (#389) ## Summary Deep-context speed for Qwen3.5 / 3.8 dense with a DFlash2 draft, real concurrency for DFlash2 turns, Flash Next decode on a partial store, and the app changes that go with them. | Area | What changed | |---|---| | Key pages | Dense Qwen3.5 (heads 24/4) stores K on 32-token pages, token-major, with their own prefill, verify and AR kernels. MoE keeps the 16-token page. | | Store move | The first load after this change moves stored chats from the 16-token page form to the new one. It runs inside the load, before the first turn, and is safe to cut: the next load goes on. | | DFlash2 lanes | Dense DFlash2 text turns are scheduler lanes and verify in waves of 2-4. Sampled lanes take their rows on the device. A lane gives the tokens it gives alone. | | Decode cycle | int8 KV queries for loads with a DFlash2 draft, a joined mixed projection, sampled DFlash2 rows on the device. | | GGUF planes | A GGUF load can plan Splash's weight-plane layout (kernels under `metal/splash_gguf`, Apache-2.0, listed in `THIRD_PARTY_NOTICES`). | | Flash Next | A partial store reads every missing expert of a lease in one fill; a store the host gate refused moves up to a direct store when the gate later admits it; a switch to a model that loads alone disposes the idle old model first. | | Host / app | Chat and Work wait states, run cards, context ring, compaction mark, composer hints; turn and runtime trace fields; model switch disposal merged with #385. | | Docs | `CLAUDE.md` limits, `docs/concurrent-inference.md`, `docs/paged-cache.md`, `docs/perf.md`, `docs/ffi-cpp.md`, `docs/qwen38-flash-next.md`, `docs/dashboard.md`. | ## Measured (M5 Max, 128 GB, Qwen3.8-27B UD-Q4_K_XL + DFlash2 draft, one trial per row) | Row at 146K context | Before key pages | This PR | Splash 1.6.1 (stored rows, no same-hold pair) | |---|---|---|---| | Decode, sampled, ms per cycle | 84.9 | 74.6 | 73.6 | | Decode, greedy, ms per cycle | 79.8 | 72.7 | 73.2 | | Cold 146K prompt | 317 s (16-token page) | 292 s | 312 s | The clock speed of the GPU differed between rows, so the Splash column is an indication only. Two no-harm cells at 25K (greedy alone, 3 lanes) read slower in one engine while another project compiled on the machine. They have no clean pair and are **not decided**. The other 25K cells in the same hold read 0.96-0.98 of the old build. ## Exactness - Same request, same state: same tokens (10 of 10 greedy repeats). - A DFlash2 lane equals the same request alone (23 of 23 on the real model; fixture pins for sampled lanes with a fixed seed). - A restored chat equals the chat with no restore, also after the store move, a restart, and three kills inside a move. ## Limits - **Downgrade:** a build without 32-token pages does not read moved chats; they prefill again. - **First load after the update:** longer by one read and one write of the stored chats (24 GB took about 58 s). The UI shows a plain load. - **AR rows in one fused step are not lane-exact:** on a dense load with K-quant or affine projections, autoregressive turns that decode in one `[N,1]` step take other kernels than a one-row step, so at temperature 0 such a turn can give other tokens than it gives alone. The route split is in `main` already; the docs said the opposite and now state the limit. DFlash2 lanes are not on this route. - **Not proven:** Windows and Linux compiles of the new unix-gated code (checked by reading only; CI decides). ## Test plan - [x] `cargo fmt --check`, `cargo clippy --all --all-targets -D warnings`: clean - [x] `cargo test -p mlx-core` lib: 5,552 passed, 0 failed, 245 ignored; integration: 161 passed, 0 failed - [x] `cargo test -p mlx-paged-attn`: 370 passed, 0 failed - [x] `vp run test`: 8,214 passed, 0 failed - [x] `vp check --no-fmt`, `vp fmt --check` on the changed files: pass - [x] `yarn build:native`, `yarn build:ts`; the two `index.d.cts` files are equal - [x] Real-model holds: store move on a clone of a live 24 GB store (81 of 81 states), kills inside the move, restore after restart, lanes equal alone - [ ] CI 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Fable 5.2 <[email protected]>
Summary
Enable native CUDA GGUF inference on Windows ARM64 (validated on an NVIDIA RTX Spark, CUDA 13.4), fix the desktop app startup and model-switching crashes, and add real Windows WASAPI audio-device discovery.
What changed
mlx_clear_streams()and model threads release CUDA streams before Windows thread teardown.849f8934, which releases the cuDNN handle and its graph caches insideclear_streams()while CUDA Runtime is still usable. Windows was destroying a used cuDNN handle from athread_localdestructor, wherecudnnDestroyreturnsCUDNN_STATUS_INTERNAL_ERROR(4000) andCHECK_CUDNN_ERRORthrows from anoexceptdestructor, terminating the process with0xC0000409. Upstream PR: [CUDA] clear cuDNN handles and graph caches on clear_streams ml-explore/mlx#4892.mlx.cmdlauncher on Windows, invoke it throughComSpec, and allow a longer cold delegate probe.Validation
Qwen3.8-27B,Qwen-AgentWorld-35B-A3B,Gemma-4-26B-A4B) pass two rounds of authenticated/v1/models+/v1/messagesrequests through the real Electron app, including sequential model switches; every answer is4withend_turnand the sidecar stays alive.session.dispose()andmodel.dispose()exits 0 with nocudnnDestroyexception.qwen3AsrInputDevices()/qwen3AsrAudioDevices()enumerate the real Cirrus Logic microphone array (48 kHz, 3 ch) and speakers (48 kHz, 2 ch) on this device.cargo check -p mlx-core --release --target aarch64-pc-windows-msvc: 0 errors, 0 warnings.tsc -bsucceeds; 78 focused TypeScript tests pass.pre-commit run --all-filespasses for the MLX submodule change.Known limits
AI assistance: Grok Build (Kimi K3.1 Pro).