Repository navigation
Conversation
Phantomn
force-pushed
the
fix/wsl-cuda-parallelism
branch
from
October 8, 2026 13:00
1dbbed4 to
ec07ffd
Compare
Author
|
Friendly ping: |
WSL reports process.platform "linux" but its CUDA runs on the Windows GPU driver, so the Windows-CUDA one-context default from tobi#519 did not apply there. With the computed pool (8 contexts on an 8 GB card) qmd embed aborted intermittently in cuMemAddressReserve (ggml-cuda.cu:106, out of memory) with plenty of VRAM free. Move isWSL() from store.ts to llm.ts (store.ts already imports llm.ts) and treat WSL CUDA like Windows CUDA. QMD_EMBED_PARALLELISM still wins. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Phantomn
force-pushed
the
fix/wsl-cuda-parallelism
branch
from
October 28, 2026 02:15
ec07ffd to
5045955
Compare
Author
|
Rebased onto current
The CI and Nix workflows on this PR show |
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.
Problem
On WSL2 with CUDA,
qmd embedsometimes aborts with exit 134:This happens with plenty of VRAM free (RTX 4060 Ti 8 GB, about 6.8 GB free, embeddinggemma-300M).
Root cause
resolveSafeParallelismalready serializes CUDA to one context on Windows because of #519. It only checksprocess.platform === "win32". WSL reportslinux, but its CUDA runs on the Windows GPU driver:nvidia-smiinside WSL shows the Windows driver version. So WSL gets the full computed pool (8 contexts here), and the same class of multi-context CUDA failure appears.Change
isWSL()fromstore.tstollm.tsand export it.store.tsalready imports fromllm.ts, so this avoids an import cycle and keeps one WSL detector.resolveSafeParallelism: treat WSL + CUDA like Windows + CUDA and default to 1 context. Vulkan and CPU are unchanged.QMD_EMBED_PARALLELISMstill overrides it.wsloption so tests are deterministic on any host.Evidence (WSL2 Ubuntu 24.04, driver 616.92, qmd 2.8.3)
A single ~1700-chunk document, re-embedded repeatedly with other CUDA processes holding the GPU:
QMD_EMBED_PARALLELISMcuMemAddressReserveabortThe same abort also hit 2 real
qmd embedruns before the investigation. Cost of serializing: 31s → 42s for that document.Ruled out along the way: real VRAM exhaustion (about 6.8 GB free), other processes holding CUDA (embed still succeeded with 5 holders), and address-space leaks from context create/dispose cycles (VmSize flat over 40 cycles).
Tests
test/llm.test.ts: the new WSL case fails onmainand passes here.vitest run test/: 1247 passed, 79 skipped. Run withWSL_DISTRO_NAME/WSL_INTEROPunset, as CI does.tsc -p tsconfig.build.json --noEmitandoxlintare clean.Note: 4 Git Bash tests in
test/store-paths.test.tsfail when run inside WSL on bothmainand this branch, becauseisWSL()is true there. That behavior is pre-existing and unchanged.Related: #519, #640
🤖 Generated with Claude Code