Skip to content

[Engine] poly/expert_card: fix --expert-gpu crash when kCpuRows/kSlots > MAX_NCOLS (Fixes #355) - #356

Open
cobra91 wants to merge 1 commit into
simplexai-labs:mainfrom
cobra91:fix/expert-gpu-q8-bytes
Open

cobra91 wants to merge 1 commit into
simplexai-labs:mainfrom
cobra91:fix/expert-gpu-q8-bytes

Conversation

@cobra91

@cobra91 cobra91 commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #355.

Problem and result

On v0.2.20-poly.5 (d62dfacbe), passing --expert-gpu 1 on Inkling-2-Mini-UD-Q4_K_XL.gguf immediately threw strata-poly: native MMVQ requires 1 <= ncols <= MAX_NCOLS (exit code 1) inside ExpertCard::ExpertCard() before loading finished.

Computing the single-column Q8_1 byte size (native_q8_1_bytes(n) * kCpuRows / kSlots) fixes the crash: --expert-gpu 1 loads 745 / 745 remaining experts onto GPU 1 (3657 MiB) and decodes cleanly at 61.08 tok/s (99.6% VRAM hits).

Approach

  • engine/src/poly/expert_card.cpp: Replaced kernels::native_q8_1_bytes(n_embd, kCpuRows) and kernels::native_q8_1_bytes(n_ff, kSlots) with kernels::native_q8_1_bytes(n_embd) * (size_t) kCpuRows and kernels::native_q8_1_bytes(n_ff) * (size_t) kSlots, matching iq_slot_lanes_test.cu and engine.cpp so kSlots (16) and kCpuRows do not trip validate_shape(n_in, ncols) (MAX_NCOLS = 8).

Validation

Tested on Windows 11, RTX 5080 16 GB (sm_120) + RTX 4060 Ti 16 GB (sm_89, PCIe Gen4 x2), CUDA 13.4, v0.2.20-poly.5 (d62dfacbe):

  • strata-poly.exe --model Inkling-2-Mini-UD-Q4_K_XL.gguf --expert-gpu 1 --kv fp8 --max-context 32768 --tokens @ids302.txt --max-new 256:
    • Before: exit code 1 (native MMVQ requires 1 <= ncols <= MAX_NCOLS).
    • After: exit code 0, 745 / 745 experts on GPU 1 (3657 MiB), prompt 302 tokens 240.1 tok/s, generated 256 tokens 61.08 tok/s (99.6% VRAM hits).
  • Not tested: Linux, HIP.

Limits

  • Only fixes the ExpertCard scratch allocation crash; --expert-gpu still routes via host (moe_card and DSpark remain off under ecard_).

@github-actions github-actions Bot added the needs-format Title or description does not follow CONTRIBUTING.md yet label Nov 26, 2026
@github-actions

Copy link
Copy Markdown

Thanks for the pull request. To keep the tracker readable, every item needs an area prefix in the title and the parts of the pull request template filled in. This one is missing:

  • Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other], then a short description. Example: "[Engine] fix decode stop on long prompts".

Edit the pull request (title and description) and this note goes away on its own. If it is still missing parts in 5 days it will be closed, which is not a rejection: fix it and comment /reopen.

Details: CONTRIBUTING.md

@cobra91 cobra91 changed the title fix(poly/expert_card): fix --expert-gpu crash when kCpuRows/kSlots > MAX_NCOLS (Fixes #355) [Engine] poly/expert_card: fix --expert-gpu crash when kCpuRows/kSlots > MAX_NCOLS (Fixes #355) Nov 26, 2026
@github-actions github-actions Bot removed the needs-format Title or description does not follow CONTRIBUTING.md yet label Nov 26, 2026
@github-actions

Copy link
Copy Markdown

Thanks, this follows the format now.

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.

[Engine] inkling2: --expert-gpu 1 fails with 'native MMVQ requires 1 <= ncols <= MAX_NCOLS' (v0.2.20-poly.5)

1 participant