Repository navigation
[Engine] strata-inkling CUDA: refuse a layer split when a later GPU's experts would go to host RAM - #6986
Open
GautamtmD wants to merge 1 commit into
Open
[Engine] strata-inkling CUDA: refuse a layer split when a later GPU's experts would go to host RAM#6986GautamtmD wants to merge 1 commit into
GautamtmD wants to merge 1 commit into
Conversation
…st-RAM experts Host-RAM (hybrid) experts only run on the first stage. When a later stage's experts did not fit its VRAM (an explicit --layer-split, a --vram-experts-gb cap, or a busy card), they were assigned to host RAM anyway and launch_ink_moe skipped them: the engine ran and produced wrong output with no error. Fail at load with a message that says what to change instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 and result
On a layer split, host-RAM (hybrid) experts only run on the first stage. The hybrid branch in
run_visitrequirescur_stage == 0. When a later stage's experts do not fit its VRAM budget,load_from_model_filestill gives them tier 2 (host RAM). On that stagelaunch_ink_moeskips tier > 1 experts. The engine starts, runs, and produces wrong output with no error.This happens with:
--layer-splitthat gives a GPU more layers than it can hold;--vram-experts-gbcap;Measured with
--layer-split 12,12 --vram-experts-gb 5.5on two 16 GB cards:main(6a6db7f)experts=1317+1095 GPU / 660 host; 441 of the second GPU's experts skippedinit: Layer-Split: the experts of GPU 0 do not fit in its VRAM (host-RAM experts only run on the first GPU); give it fewer layers (--layer-split), use --layer-split auto, or free VRAM, exit 1Related discussion
None needed: this is a focused fix. I found no existing issue or PR about it.
ink_cuda_mem_infoignored its device). That removes the most common way to reach this, but not the others listed above.Approach
When assigning a stage > 0 expert to host RAM, return a load error instead. The message says how to fix it.
Compatibility: a setup that used to start and quietly give wrong answers now refuses to start. Every setup whose experts fit is unchanged.
Validation
Environment:
strata-inklingbuilt fromengine/src/inkling2with-DSTRATA_ENABLE_CUDA=ON -DSTRATA_INK_CUDA_ARCHS=120.mainis 6a6db7f and this PR is 6a6db7f plus this commit.CUDA_DEVICE_ORDER=PCI_BUS_ID, so CUDA device 0 is the 5070 Ti.Passed:
strata-inkling --native Inkling-2-Mini-SQ-20.strata --gpus 1,0 --layer-split 12,12 --vram-experts-gb 5.5 --draft off --max-context 8192 --gen 8.mainstarts and generates.main:--dump-ref ref.bin ... --layer-split 6,18 --kv fp16 --prompt-ids <first 2048 tokens of docs/DETAILS.md>, all experts in VRAM.--kld-eval ref.bin --gpus 1,0 --layer-split 12,12 --vram-experts-gb 5.5 --kv fp16givesMean KLD=0.691638 | Top-1=77.28% | PPL=8.694.strata-inkling --native ... --draft off --max-context 8192 --gen 64gives the same greedy token ids (md5) asmainfor:--gpus 1,0 --layer-split auto--gpus 1,0 --layer-split 12,12--gpus 1,0 --layer-split ep2--gpu 1 --gpus 1strata-inkling --selfcheck --native ... --gpus 1,0 --layer-split auto: PASS.python tools/check --only py-tools: 1839 passed, 94 skipped, 2 failed. The same 2 fail onmainin the same environment (see Failed).Failed:
python tools/check --only py-tools:terminal.tools.test_exit_with_parenttest_a_packer_ends_with_the_process_that_started_itandtest_the_control_cli_ends_with_the_host_that_started_it.main(6a6db7f) on this machine (fresh venv withterminal/requirements.txtandrequirements-dev.txt, Python 3.12, Windows 11).terminal/tools, not the engine.Not run:
Limits
--layer-split autothe automatic partition already keeps later stages within their VRAM, so this mostly affects explicit splits and VRAM caps.🤖 Generated with Claude Code