Repository navigation
fix: close the LOW residuals left by #2787, #2788 and #2789 - #2792
Merged
Merged
Conversation
KV storage report: `kv_cache_storage_modes` returns `Option<Vec<Option<KVCacheMode>>>`, a `None` entry being a layer with no KV. Families describe layers with `LayerKv` from their cache builder's predicate: Llama 4 chunked layers are FP16 (`uses_chunked_cache` is shared with the builder), linear, conv and skipped layers of the hybrid families are stateless, and model-owned families without a mode table (DeepSeek V4, the recurrent and SSM families, their VLM wrappers) report real storage instead of `None`. The server log adds `kv_cache_mode_stateless_layers`; `logit_trace` prints it. Sliding window: the nine `RotatingKVCache` families reject a 0 or over-`i32::MAX` window at load when a layer slides, and Gemma 3 rejects `sliding_window_pattern: 0`. Most store the validated `i32` for their builders. IREE local-task: the C shim builds the device itself with 8 MiB worker stacks instead of the flag-driven factory, whose 128 KiB default cannot hold a CUDA-loaded process's static TLS. `MLXCEL_XLA_LOCAL_TASK_WORKERS` sets the worker count. `XlaPreparedPrefillLogits` is test support (mlxcel-xla `test-support`, root `test-utils`), resets slots per prefill, and backs `Qwen25VlLanguageDiagnosticEngine`. Pipeline gate: only a stage timeout or failed send opens it. A `RunEntry` timeout opens it unattributed until a probe names the stage, and a failed send is logged as "could not be reached". Closes #2790
Gemma4StageModel::from_filtered_weights builds RotatingKVCache from the same sliding_window cast as the single-process model, but only Gemma4TextModel::from_weights ran the #2790 load-time check, so a zero window on a pipeline stage still reached the cache constructor. The stage load now calls the same cache_window check. Also restore the layer_types_list doc comment in gpt_oss.rs, which the new validated_sliding_window had captured. Clippy on the lib and tests is clean. Refs #2790
MLXCEL_XLA_LOCAL_TASK_WORKERS above IREE's IREE_TASK_TOPOLOGY_MAX_GROUP_COUNT (256) was passed through and clamped silently by IREE. parse_local_task_workers now rejects values outside 1..=256 with a load error naming the variable, and docs/environment-variables.md states the range. When a failed availability probe reopened the pipeline gate, the log line always said the stage did not answer within the teardown acknowledgement timeout, even when the probe could not be sent. probe_failure_cause reads the StageUnreachable cause from the error chain, so a failed send logs its reason and only a timeout keeps the timeout wording. The unit test is a pure error-chain check with no wall-clock bound. Validation: - cargo clippy --profile test-fast --features cuda -p mlxcel -p mlxcel-xla --lib --tests -- -D warnings: clean - cargo test -p mlxcel-xla --lib local_task: 6 passed - mlxcel lib distributed::pipeline:: under gpu-lock: 416 passed - cargo fmt --all -- --check, make verify-env-var-docs: clean Refs #2790
inureyes
marked this pull request as ready for review
October 31, 2026 11:10
This was referenced Oct 31, 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.
Closes the five LOW residuals of #2787, #2788 and #2789 listed in #2790, in one PR.
Changes
kv_cache_storage_modesreturnsOption<Vec<Option<KVCacheMode>>>; aNoneentry is a layer with no KV. Families describe layers withLayerKv(Full,Sliding,Fp16Only,None) from the predicate their cache builder uses. Llama 4 reports chunked layers as FP16 (uses_chunked_cachenow drives the builder, the masks and the report). Qwen3-Next, Qwen 3.5, Qwen4-Exp, Bailing linear, LFM2 and NemotronNAS report linear, convolution and skipped layers as stateless. Model-owned families without a mode table report real storage instead ofNone: DeepSeek V4, RecurrentGemma, Muse Glimmer, Mamba, Mamba2 and RWKV7 as listed, plus Nemotron-H, Jamba, Falcon-H1, Plamo2, GraniteMoeHybrid, Kimi Linear, Kimi K3 and Inkling, which had the same gap, and the five VLM wrappers around them. The server log addskv_cache_mode_stateless_layers;logit_traceprints the stateless count.validate_sliding_window(viacache_window, only when a layer slides) fails the load for 0 or values abovei32::MAXin Gemma 3, Gemma 4, GPT-OSS, ExaOne 4, Laguna, Step 3.5, Ministral 3, Mellum and AFMoE; Gemma 3 also rejectssliding_window_pattern: 0. Gemma 3, GPT-OSS, Laguna, Mellum, ExaOne 4, Ministral 3 and AFMoE store the validatedi32for their builders. Gemma 4 validates in both the single-process load and the pipeline-stage load (Gemma4StageModel::from_filtered_weights) and keeps its casts on the sharedTextConfig(dozens of sites), now lossless after the check.csrc/xla_local_task.cbuilds the device without the flag registry: executor with 8 MiB worker stacks overMLXCEL_XLA_LOCAL_TASK_WORKERSworkers (1..=256, IREE's topology limit; anything else fails the load naming the variable) or the physical-core topology, all loaders, heap allocator, task driver, default device with the same proactor pool the runtime uses. Both device-creating entry points use it; other drivers are unchanged. Every IREE symbol used is exported by the pinned CUDA tree and byiree-dist-3.12.0rc20260721-linux-x86_64(the only dist published for that release; there is no aarch64 dist), and the new C file compiles against both header trees.XlaPreparedPrefillLogitsneeds mlxcel-xlatest-support(roottest-utils) ordiagnostics, resets slots before each prefill, andQwen25VlLanguageDiagnosticEnginewraps it.xla_prepared_prefillrequirestest-utils; the CI link step passes it.StageUnreachable(timeout or failed send) opens the gate. ARunEntrytimeout opens it unattributed, so the entry stage keeps its teardown wait and the next probe names the silent stage; a failed send logs "could not be reached", and a probe that reopens the gate logs its real cause (send failure or timeout).PipelineUnavailable.stageisOption<String>.docs/distributed.mddescribes the new rule.Failing first
Each new test fails on
main1a257bc or, where it cannot compile there, under a mutation restoringmain's behaviour:thread creation failed with 22; [runtime-init] failed to open IREE HAL device 'local-task'.local_task_executor_uses_8_mib_stacks_without_iree_flags, stack set back to 128 KiB:xla_local_task_probe failed: ... thread creation failed with 22.llama4_chunked_layers_report_fp16_storage_under_int8:left: Some([Some(Int8) x8])vs expectedInt8only at 3 and 7.qwen3_next_linear_layers_report_no_kv_storage: eightSome(Int8)vs[None, None, None, Some(Int8), ...].recurrent_gemma_reports_...,mamba_reports_every_layer_stateless,deepseek_v4_reports_fp16_storage_for_every_layer(override returningNone):left: None/a storage report.gemma3_rejects_zero_sliding_window_pattern_at_load,sliding_window_zero_is_a_load_error(validation off): the loads succeed.run_entry_timeout_does_not_name_the_entry_stage(main attribution):failed_peerisSome("127.0.0.1:41749"), the entry stage.send_failure_opens_the_gate_with_a_send_reason: the open line readsremote stage 127.0.0.1:40565 did not answer within 1s.Verification (spark-102, GB10)
cargo fmt --all -- --check,make verify-env-var-docs: clean.cargo clippy --profile test-fast --features cuda -p mlxcel -p mlxcel-core -p mlxcel-xla --lib --tests -- -D warningsandcargo clippy --release --features cuda,xla-iree,test-utils -p mlxcel-xla -p mlxcel --lib --test xla_prepared_prefill -- -D warnings: clean.mlxcel+mlxcel-xlalib and tests clean,distributed::pipeline::416 passed,mlxcel-xlalocal_task6 passed.--test-threads=1, gpu-lock):models::+vision::3429 passed;distributed::+server::batch::scheduler1845 passed;mlxcel-corecache::+generate::624 passed;mlxcel-xla --lib370 passed.cuda,test-utils):distributed_integration20,pipeline_e2e30,pipeline_remote_real_models10,pipeline_server_remote_real_models7,pipeline_ci_multi_stage_real_models4 (--include-ignored --skip glm_moe_dsa,MLXCEL_REQUIRE_MODELS=1 MLXCEL_SDPA_DETERMINISTIC=1),disaggregated_serving_e2e2,disaggregated_router_e2e8: all pass.cargo test --release --features cuda,xla-iree,test-utils --test xla_prepared_prefill -- --ignored: 4/4 on the defaultlocal-taskdevice.MLXCEL_XLA_LOCAL_TASK_WORKERS=0andabcfail the load naming the variable;2passes. Unit tests also reject 257 and 1000.use mlxcel_xla::XlaPreparedPrefillLogitsfailscargo check --features cuda,xla-ireewith E0432 and passes withtest-utils.--features cuda,xla-reference-diagnostics --lib --testschecks clean. (Both checks ran in thetest-fastprofile.)--kv-cache-mode int8, releasemlxcel-server:llama-4-scout-17b-16e-instruct-4bitlogsapplied_layers=12 total_layers=48 stateless_layers=0;gemma-3-1b-it-4bitlogsapplied_layers=4 total_layers=26.Not changed: with
MLXCEL_XLA_DEVICE=cuda,local_task_gemma3_vlm_prefill_matches_mlx_maskmisses its 1e-3 tolerance (up to 5.4e-3) under the defaultf16CUDA precision, identically onmain; it passes withMLXCEL_XLA_PRECISION=f32.Closes #2790