feat(abi): explicit device selection through the ONE surface - vllm_model_params.device, ABI v14, --device on server + cli - #136
Closed
localai-bot wants to merge 1 commit into
Closed
Conversation
…odel_params.device, ABI v14, --device on server + cli ONE-SURFACE fold ROW 8 (row/DEVICE-KNOB, task #284), the smallest: an embedder can now ASK for a device instead of inheriting the accelerator-first probe. Mirrors vLLM's DeviceConfig.device names (vllm/config/device.py:13 @ 555967922; an explicit device is assigned VERBATIM and never substituted, device.py:61-66 - upstream's own --device flag was removed in v0.10, bc8a8ce5e, so the field mirrors the surviving config surface). include/vllm.h gains vllm_model_params.device (int32, 0=auto/1=cpu/ 2=cuda; 0 MUST be auto so zero-initialized structs keep the pre-v14 probe byte-identical; cpu-before-cuda follows the shipped v12 vllm_video_model_params.device precedent shifted by the auto slot). VLLM_ABI_VERSION 13 -> 14 on top of #122's vllm_complete_tokens v13 (rebased onto 9f772ca; the changelog now reads v10..v14 chronological - the v12-after-v11 move is the #123-review minor kept through the rebase). Floor pin advanced to >= 14 (the #121 == lesson). New vllm/config/device.h (+.cpp): vllm::Device, DeviceFromString, DeviceName. Plumb: EngineParams::device -> SelectQueue explicit arms via the pure LoadedEngine::ResolveExplicitDeviceType (explicit cpu NEVER probes; explicit cuda requires the registered kCUDA platform and fails LOUD otherwise; explicit-arm queue-creation failures propagate, unlike auto's byte-identical catch-and-fall-back). FromModelDir resolves an explicit device BEFORE any path/config I/O (DeviceConfig resolves at config time, arg_utils.py:1878), so a device error is never masked by a path error. capi validates 0/1/2 and refuses explicit cuda on the CPU-hosted transcription stack. Thin clients: --device auto|cpu|cuda on vllm-cli (ABI field only) and the server (DeviceFromString; --video-device untouched, separate engine). Also folds the #123 review's three MINOR findings (tests/docs only): c_header_compile.c actually references the v11+v12 surface + the v14 field (composed with #122's vllm_complete_tokens reference; its "every entry point" claim went stale at v10); the v12 changelog block moved to chronological position; the H3 fold fixture flag list gained --keep-quant. Gates: full CPU build -Werror clean; test_capi (4 new v14 cases + floor >= 14, #122's v13 cases green alongside), test_loaded_engine_dense (+3 device cases incl. the pure policy matrix that pins "explicit cpu beats a REGISTERED accelerator" CPU-side), test_dlopen, test_openai_api_server (+explicit-cpu serving smoke), test_minimax_h3_video_fold, test_model_loader_gguf, test_platform all green; surface-coverage green, allowlist ratchet UNTOUCHED at 8 (post #122); STATUS ratchet paid by removing a stale back-to-back merge duplicate (279200 -> 279150, measured 279111 post-rebase). Ten mutations killed and reverted (defaults, zero-map, range, both plumb sites, ctor arm, unconditional fallback, policy flip, parse flip, forgotten bump); kills recorded in .agents/state.md. Residual: CUDA-build A/B (no dgx in scope), named in the state entry. FOLLOWING_AGENTS_PROTOCOL Assisted-by: Claude Code:claude-fable-5 [ClaudeCode]
Collaborator
Author
|
Landed on main as bcd9c48 (mudler-authored squash via commit-tree). Fresh mutation review MERGE-CLEAN (zero-contract, no-fallback, never-probes, resolve-before-IO, v14 floor pin all independently re-killed; device.py port verified verbatim at the parity pin; shared model_loader blast radius green incl. the Kimi paged load). Operator landing: merged tree byte-identical to the reviewed head, four row suites 4/4, eleven gates 00000000000. This completes the session's fold arc: ABI v10 (text-only) -> v14 (transcription, video generation, token-level completion, device selection), surface-guard ratchet 12 -> 8, all enforced in agent-preflight.sh + CI. Named residual: CUDA-build A/B of the explicit-device matrix on a GPU box. |
mudler
added a commit
that referenced
this pull request
Aug 8, 2026
…params.device, ABI v14, --device on cli+server (#136) ONE-SURFACE fold ROW 8. vllm_model_params gains an appended device field (0=auto = today's accelerator-first probe, byte-preserving for zero-initialized callers; 1=cpu, 2=cuda), mirrored from vLLM DeviceConfig (config/device.py @ 555967922, ported as include/vllm/config/device.h + device.cpp; upstream removed the --device FLAG in v0.10 while keeping the field surface - disclosed with citation). Plumb: vllm_model_params -> EngineParams::device -> SelectQueue via pure LoadedEngine::ResolveExplicitDeviceType - explicit cpu never probes, explicit cuda on a build without CUDA fails loud with NO fallback, resolution happens before any I/O. --device auto|cpu|cuda on vllm-cli and examples/server (ABI-field-only thin clients; --video-device untouched). VLLM_ABI_VERSION 13->14, floor-pinned >= 14. Also closes the three #123 review minors: c_header_compile.c references the v11+v12+v13+v14 surface, the v12 changelog block moved chronological, the fold fixture flag list gained --keep-quant. Review: implementer 10-kill mutation battery, then a FRESH mutation review MERGE-CLEAN - zero-contract/no-fallback/never-probes/ resolve-before-IO/floor-pin all independently re-killed, the device.py port verified verbatim against the parity pin, blast radius (model_loader shared with the Kimi paged load) green. Disclosed honestly: the 0-vs-explicit-cpu distinction is CPU-tier-invisible by construction - the CUDA-build A/B is a named residual. Operator: merged tree byte-identical to the reviewed head, capi/dlopen/loaded_engine/api_server 4/4 SUCCESS. FOLLOWING_AGENTS_PROTOCOL Assisted-by: Claude Code:claude-fable-5 [ClaudeCode]
mudler
added a commit
that referenced
this pull request
Aug 8, 2026
INCIDENT, disclosed in full: the #136 squash was built by merging its branch against main@9f772cad, but `git commit-tree -p origin/main` resolved the ref at squash time - after another session's fetch in the shared repo had advanced origin/main to 57d546f (PR #135, the H3 device-seam repair). The pushed commit bcd9c48 therefore parented on 57d546f while its tree lacked #135's changes, silently reverting them on main: minimax_h3_video.{h,cpp} device-seam fix, 53 fold-test lines, and #135's record rows. This commit restores #135's full delta on top of #136: exact-restore of the six files #136 never touched, hunk-level re-application of the six shared record files (NOW composed into one Surface-coverage row; the #135 state entry re-inserted at its chronological slot). Verified: diff vs 57d546f now shows only #136's own changes; the restored fold test passes on this tree. Hardening (applied to the landing recipe going forward): pin MAIN_SHA=$(git rev-parse origin/main) at worktree creation, use commit-tree -p "$MAIN_SHA" (never the symbolic ref, which other sessions' fetches move), and push with --force-with-lease=refs/heads/main:"$MAIN_SHA"-derived expectations so a moved remote fails the push instead of absorbing a wrong parent. FOLLOWING_AGENTS_PROTOCOL Assisted-by: Claude Code:claude-fable-5 [ClaudeCode]
Collaborator
Author
This was referenced Aug 8, 2026
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.
ONE-SURFACE fold ROW 8 (
row/DEVICE-KNOB, task #284) — the smallest fold row: an embedder can now ASK for a device instead of inheriting the accelerator-first probe. Mirrors vLLM'sDeviceConfig.devicenames (vllm/config/device.py:13@ 555967922; explicit assignment is VERBATIM, never substituted,device.py:61-66— upstream's own--deviceCLI flag was removed in v0.10,bc8a8ce5e, so the field mirrors the surviving config surface).Rebased onto main @
9f772cad(#122 landed): ABI bump is v13 → v14; changelog reads v10..v14 chronological (the #123-review v12-move minor kept);c_header_compile.ccomposes #122'svllm_complete_tokensreference with the v14 field; allowlist ratchet inherited UNTOUCHED at 8.What
vllm_model_params.deviceappended (int32,0=auto / 1=cpu / 2=cuda; 0 MUST be auto for the zero-value contract; cpu-before-cuda follows the v12vllm_video_model_params.deviceprecedent shifted by the auto slot).VLLM_ABI_VERSION13 → 14; floor pin>= 14(the one-surface(parakeet): fold Parakeet ASR onto the C ABI (ROW 1) #121==lesson). Newinclude/vllm/config/device.h+src/vllm/config/device.cpp(vllm::Device,DeviceFromString,DeviceName).EngineParams::device→SelectQueue(architecture, device); explicit arms route through the pureLoadedEngine::ResolveExplicitDeviceType(device, cuda_platform_registered)so the CPU tier gates the full matrix, including explicit cpu beats a REGISTERED accelerator. Explicit cpu never probes; explicit cuda requires the registered kCUDA platform and THROWS a pinned message otherwise; explicit-arm queue-creation failures PROPAGATE (auto keeps its byte-identical catch-and-fall-back).FromModelDirresolves an explicit device BEFORE any path/config I/O (mirror of DeviceConfig resolving at config time,arg_utils.py:1878) — a device error is never masked by a path error, which is also what makes the capi plumb pinnable with no loadable checkpoint. capi validates 0/1/2 (elseVLLM_ERR_INVALID_ARGUMENT); explicit cuda on the CPU-hosted transcription stack is refused, not silently downgraded.--device auto|cpu|cudaonvllm-cli(pure ABI field consumer) andexamples/server(vllm::DeviceFromString→EngineParams.device;--video-deviceuntouched — separate engine, separate checkpoint).c_header_compile.cnow actually references the v11 transcription + v12 video entry points + the v14 field (and, post-rebase, rides alongside model(kimi_linear): ONE-SURFACE ROW 7 — fold Kimi-Linear onto the shared paged runner #122'svllm_complete_tokensreference); the v12 changelog block moved to chronological position; the H3 fold fixture flag list gained--keep-quant.Gates (all green on the rebased head
3f8de74f)Full CPU build -Werror clean (pre-rebase full tree; rebased head rebuilt + re-run on the gate set) ·
test_capi44 cases / 428 asserts (4 new v14 + floor>= 14; #122's v13 cases green alongside) ·test_loaded_engine_dense65 asserts (+3 device cases incl. the pure policy matrix) ·test_dlopen28 ·test_openai_api_server545 (+explicit-cpu serving smoke) ·test_minimax_h3_video_foldgreen (vllm.h touched) ·test_model_loader_gguf+test_platformgreen ·check-surface-coverageOK — 8 internal-reachers, ratchet UNTOUCHED at 8, capability table 11 reachable / 2 tracked ·scripts/agent-preflight.shEXIT=0 (record checkers + mutation suites,--stagedgreen, gate-chained pushes) · STATUS ratchet paid by removing a stale back-to-back merge duplicate (279200 → 279150, measured 279111 post-rebase).Mutation kills (each RED, then reverted; recorded in
.agents/state.md)M1 default device=2 → zero-contract 3 fails · M2 capi 0→kCUDA → zero-contract bogus-path arm RED · M3 range validation dropped → 6 fails · M4 capi drops the device=2 mapping → plumb pin RED · M5 FromModelDir early resolve removed → capi plumb pin + device-before-path test RED · M6 ctor passes kAuto → EngineParams-seam ctor-throw arm RED · M7 SelectQueue explicit-arm catch-and-fallback → same test RED · M8 policy hands explicit-cpu to a registered accelerator → matrix RED · M9
DeviceFromString("cuda")→kCPU → parse test RED · M10 ABI macro left at pre-bump → floor pin RED. Disclosed not-uniquely-killable: the api_server smoke (same seams as M6-M8),c_header_compile(compile-time reference), the two doc-only minors.Residuals (named)
🤖 Generated with Claude Code
https://claude.ai/code/session_014fZAcg1WcU8V629k6HWKys