Repository navigation
chore: clear the OpenXLA warning backlog and deny all warnings in CI - #1381
Conversation
The `xla-compile` job denied `unused_imports` rather than `warnings` because the `cuda,xla-iree` and `xla-diagnostics` feature sets carried a dead-code and clippy backlog that would have made the job red the day it landed. This clears the backlog and widens the gate. Resolution per item, following the criterion in #1304: cfg-gate to the feature set that has a real consumer where the gate needs no duplicate definition, otherwise allow with a comment naming the caller, and delete only when no consumer exists under any feature combination. In `mlxcel-xla`: `IreeRaggedLlama::decode_ragged_logits` is now `#[cfg(feature = "diagnostics")]`, matching its only callers (`LlavaReferenceDiagnosticEngine::capture` and the Gemma3n diagnostic runners in `batch.rs`); serving calls `decode_ragged_logits_with_modes` directly. `decode_ragged_mrope_logits` is deleted: a repository-wide search over every file type found the definition and one error-message string inside its `_with_modes` sibling, and no caller. The `AuxiliaryWeightDType::Float16` / `Uint32` variants are allowed under `not(feature = "micro-oracle")`, which is the feature behind `numeric_probe.rs`, their only construction site, while `ffi_code` and `size_bytes` must keep mapping them on every build. `load_audio_module` takes a scoped `too_many_arguments` allow rather than a parameter struct, since both call sites are in the same file and pass a different graph/artifact/entry triple. The nested `if let` in `cache_lock_is_stale` collapses to an edition-2024 let chain, and a doc comment stranded by the bucket-context function added in #1302 is reattached to the `create_ctx` it describes. In `mlxcel`: the test-only surface of `xla_audio_preprocess.rs` (`AudioPreprocessStage::spawn` / `recv` / `metrics` / `is_healthy`, the `healthy` field, `AudioPreprocessMetrics::snapshot`, `AudioPreprocessMetricsSnapshot`, and the `Cancelled` checkpoint payload) is allowed under `not(test)` with each site naming `xla_audio_preprocess_tests.rs`, following the in-tree `cfg_attr(not(test), allow(dead_code))` pattern. `MediaRequestMetadata::validate_xla_raw_counts` gains the same `not(test)` arm alongside its existing feature arm. `XlaServeWorker::drain_preprocessed` takes a `while_let_loop` allow because the suggested `while let` head would hold a shared borrow of `self` across a body that mutates it. The two `needless_match` sites in `loading/vlm.rs` and `models/sanitize.rs` take a `not(feature = "surgery")` allow: the match only collapses when the `surgery` arm is compiled out, and applying clippy's suggestion would delete active-pipeline resolution from the default build. `.github/workflows/ci.yml` now sets `RUSTFLAGS: "-D warnings"` for `xla-compile`, and the "Deliberately NOT covered" list records the gap that remains: the job runs `cargo check`, so `-D warnings` denies rustc lints only and clippy's own lints under these feature sets are still gated by nothing in CI. No runtime behavior changes: the diff is attribute additions, cfg additions, comments, a collapsed `if`, a doc-comment move, and one deletion of an uncalled function. Closes #1304
Implementation Review SummaryIntent
Findings AddressedNone requiring a code change. Every Set A and Set B item in #1304 is resolved, each Line-by-line verification of the no-behavior-change claim
|
Review follow-up on the #1304 backlog clearing. No behavior change and no change to which lints are denied; this fixes places where a comment or a message asserted something the tree does not support, which is the failure mode a suppression-heavy PR has to guard against. `iree.rs`: the two arity-check error messages named the thin wrappers rather than the functions that emit them. `decode_ragged_mrope_logits` is deleted by this PR and `decode_ragged_logits` is now `diagnostics`-only, so a production `cuda,xla-iree` build could return a message naming a function that build does not contain. Both now name their `_with_modes` emitter. `xla_audio_preprocess.rs`: `AudioPreprocessStage::spawn` is also called from `xla_worker_tests.rs:247`, not only `xla_audio_preprocess_tests.rs`. The acceptance criterion for #1304 is that every allow names the caller keeping the item alive, so an incomplete list is the specific thing that criterion exists to prevent. `xla_worker_admission.rs`: `drain_preprocessed` contains two drain loops, image and audio, and the function-level `allow(clippy::while_let_loop)` covers both. The comment described only the image one. `ci.yml`: records two things the "Deliberately NOT covered" list did not. First, the path dependencies' test targets are outside this gate: there is no `default-members`, so `cargo check` here resolves to `-p mlxcel` and `--all-targets` expands within that package only, leaving mlxcel-xla's `#[cfg(test)]` modules ungated by every job, since the `clippy` job builds default features where the crate is default-off. The #1304 test plan ran `-p mlxcel-xla --all-targets` by hand, which CI will not. Second, the blast radius and the brittleness bound of `-D warnings`: it reaches every path-built unit, so mlxcel-core, mlxcel-surgery, mlxcel-xla and the build scripts are gated here too, while registry and git dependencies cannot red the job because cargo compiles those with `--cap-lints allow`, and `rust-toolchain.toml` pins the toolchain exactly so a new rustc release cannot turn the job red without a deliberate pin bump. Validated with `cargo clippy -p mlxcel-xla --lib --features iree --all-targets -- -D warnings` under `RUSTFLAGS=-D warnings` (clean), `rustfmt --edition 2024 --check` on all three Rust files, and a YAML parse of the workflow. Refs #1304
Security and maintenance-risk reviewNo CRITICAL or HIGH findings. The ordinary vulnerability surface is genuinely absent here: no new I/O, no new dependencies, no parsing, no trust boundary moved. The review focused on the three risks a suppression PR actually carries. 1. Do the suppressions hide a real defect? No.Every
The On the On On 2. The deletion is safe.
3. The cfg gate is correct.All four 4. CI maintenance risk from
|
…ablup#1381) ## Summary The `xla-compile` job denied `unused_imports` rather than `warnings` because the `cuda,xla-iree` and `xla-diagnostics` feature sets carried a dead-code and clippy backlog that would have made the job red the day it landed. This clears that backlog and widens the gate to `-D warnings`. Resolution followed the criterion in the issue: cfg-gate to the feature set that has a real consumer where the gate needs no duplicate definition, otherwise allow with a comment naming the caller, and delete only when a search finds no consumer under any feature combination. ## What changed ### `mlxcel-xla` - `src/lib/mlxcel-xla/src/iree.rs`: `IreeRaggedLlama::decode_ragged_logits` is now `#[cfg(feature = "diagnostics")]`. Its only callers are `LlavaReferenceDiagnosticEngine::capture` and the Gemma3n diagnostic runners in `batch.rs`, all of which are already `#[cfg(feature = "diagnostics")]`; serving calls `decode_ragged_logits_with_modes` directly. - `src/lib/mlxcel-xla/src/iree.rs`: `decode_ragged_mrope_logits` is deleted. This is the one deletion in the PR. `grep -rn "decode_ragged_mrope_logits" . --exclude-dir=.git --exclude-dir=target` filtered of the `_with_modes` sibling and the `xla_llama_` extern returns exactly two hits: the definition itself, and an error-message string inside `decode_ragged_mrope_logits_with_modes` that stays. There is no caller in any crate, test, bench, or example, under any feature combination. - `src/lib/mlxcel-xla/src/iree.rs`: a doc comment describing `create_ctx` had been stranded above a blank line when lablup#1302 inserted `create_bucket_ctx` and its own doc block between them, which is what `clippy::empty_line_after_doc_comments` was reporting. It is moved back onto `create_ctx`. - `src/lib/mlxcel-xla/src/aux.rs`: `AuxiliaryWeightDType::Float16` and `Uint32` are allowed under `not(feature = "micro-oracle")`. `numeric_probe.rs`, behind that feature, is their only construction site, while `ffi_code` and `size_bytes` have to keep mapping them for the FFI contract on every build. Gating the variants themselves would force a `cfg` onto each arm of those two matches, including the `Float32 | Uint32` arm. - `src/lib/mlxcel-xla/src/phi4_audio.rs`: `load_audio_module` takes a scoped `#[allow(clippy::too_many_arguments)]`. A parameter struct would ripple into both call sites for a private single-file helper, so the allow was preferred per the issue's guidance. - `src/lib/mlxcel-xla/src/aux_manifest.rs`: the nested `if let` in `cache_lock_is_stale` collapses to an edition-2024 let chain. ### `mlxcel` - `src/server/batch/xla_audio_preprocess.rs`: the test-only surface is allowed under `not(test)`, following the `#[cfg_attr(not(test), allow(dead_code))]` pattern already used in `src/model_metadata.rs` and `src/server/startup.rs`. Each site names `xla_audio_preprocess_tests.rs` as the caller: `AudioPreprocessStage::spawn` (serving uses `spawn_with_loader` to keep MLX handles thread-confined), `recv` (serving must not block, so it drains with `try_recv`), `metrics`, `is_healthy`, the `healthy` field it reads, `AudioPreprocessMetrics::snapshot`, and `AudioPreprocessMetricsSnapshot`. The `Cancelled(AudioPreprocessCheckpoint)` payload keeps its field with the same allow: serving matches it as `Cancelled(_)`, and the checkpoint distinction belongs in the type because `Cancelled` is constructed at several checkpoints in that file. - `src/server/media.rs`: `validate_xla_raw_counts` gains a `not(test)` arm alongside its existing `not(feature = "xla-iree")` one. `media_tests.rs` is its only caller; the XLA admission path calls `validate_xla_raw_counts_with_audio` directly because it knows whether the loaded family supports audio. - `src/server/batch/xla_worker_admission.rs`: `drain_preprocessed` takes `#[allow(clippy::while_let_loop)]`. The suggested `while let Some(stage) = self.image_preprocessor.as_ref()` head holds a shared borrow of `self` across a body that calls `&mut self` methods and clears the field, so the `match` shape is load-bearing rather than stylistic. - `src/loading/vlm.rs` and `src/models/sanitize.rs`: the two `needless_match` sites take `#[cfg_attr(not(feature = "surgery"), allow(clippy::needless_match))]`. The match only collapses to `match transform { Some(t) => Some(t), None => None }` when the `surgery` arm is compiled out, which is why the lint fires under `--no-default-features` and not under the default feature set. Applying clippy's suggestion would delete active-pipeline resolution from the default build, so the lint is silenced only for the builds that see the collapsed shape. ### CI - `.github/workflows/ci.yml`: `xla-compile` now sets `RUSTFLAGS: "-D warnings"`, and the paragraph explaining the narrower `-D unused_imports` policy is replaced. - `.github/workflows/ci.yml`: the "Deliberately NOT covered" list records the gap that remains after this change. The job runs `cargo check`, so `-D warnings` denies rustc lints only. `dead_code` and `unused_imports` are gated now, but `collapsible_if`, `needless_match`, `too_many_arguments`, `while_let_loop` and the rest of clippy's own lints are still gated by nothing in CI under these feature sets, because the `clippy` job covers default features only. That half of the backlog can regrow silently; swapping this job's `cargo check` for `cargo clippy` was deliberately left out of scope. ## No runtime behavior change The diff is attribute additions, `cfg` additions, comments, one collapsed `if`, one doc-comment move, and the deletion of one function that has no caller. No executed code path changes. ## Test plan Run on the GB10 host with the IREE runtime provisioned (`bash scripts/iree/setup-cuda.sh`, `eval "$(bash scripts/iree/setup-cuda.sh --env)"`, `MLX_CUDA_ARCHITECTURES=121`), and re-run on the final commit after the review follow-ups landed. Acceptance criteria: - [x] `cargo clippy --features cuda,xla-iree --all-targets -- -D warnings`: exit 0, no warnings. - [x] `cargo clippy --no-default-features --features xla-diagnostics --all-targets -- -D warnings`: exit 0, no warnings. - [x] Default-feature regression, `cargo clippy -p mlxcel --lib --tests -- -D warnings`: exit 0, no warnings. The two commands the job itself runs, under the widened flag, because `cargo clippy -- -D warnings` applies the flag only to the primary package while `RUSTFLAGS` reaches every path-built unit including `mlxcel-core` and `mlxcel-surgery`. Clippy passing is therefore not sufficient evidence that the job will be green: - [x] `RUSTFLAGS="-D warnings" cargo check --features cuda,xla-iree --all-targets`: exit 0. - [x] `RUSTFLAGS="-D warnings" cargo check --no-default-features --features xla-diagnostics --all-targets`: exit 0. Scoped and mechanical checks: - [x] `cargo clippy -p mlxcel-xla --lib --features iree --all-targets -- -D warnings` - [x] `cargo clippy -p mlxcel-xla --lib --features iree,diagnostics --all-targets -- -D warnings` - [x] `cargo clippy -p mlxcel-xla --lib --features iree,micro-oracle --all-targets -- -D warnings`, confirming the `micro-oracle` cfg arm on the `AuxiliaryWeightDType` variants is not narrowed wrongly - [x] `rustfmt --edition 2024 --check` on every changed Rust file - [x] `.github/workflows/ci.yml` parses as YAML End to end, this PR's own CI exercises the change it makes: `OpenXLA feature compile` ran for 7m44s under the new `RUSTFLAGS: "-D warnings"` and passed, so the widened gate is green on arrival rather than red. `OpenXLA feature link`, added by lablup#1305, also ran because `src/lib/mlxcel-xla/**` is in its path filter. Not verified: - [ ] `metal,accelerate`. It cannot be built on this Linux host, so it is unverified by execution rather than confirmed. The static argument that it is unaffected: `make verify-clippy` runs `--features metal,accelerate` without `--no-default-features`, so `surgery` stays on and both `needless_match` attributes expand to nothing; `mlxcel-xla` builds with no features there, so `iree.rs`, `aux.rs`, `aux_manifest.rs` and `phi4_audio.rs` sit behind `#[cfg(feature = "iree")]` and never compile; and on the `mlxcel` side only `media.rs` and `xla_audio_preprocess.rs` compile, where every change is an `allow` attribute that cannot break a build. ## Follow-ups this surfaced, out of scope here - `mlxcel-xla`'s `#[cfg(test)]` modules are gated by no CI job at all. There is no `default-members`, so `cargo check` in this job resolves to `-p mlxcel` and `--all-targets` expands within that package only, while the `clippy` job builds default features where `mlxcel-xla` is default-off. Recorded in the workflow's exclusion list. - Clippy-only lints under these feature sets remain ungated, so that half of the backlog can regrow. Closing it means running clippy in this job, which was left out of scope deliberately. - `media_tests.rs` reaches `validate_xla_raw_counts_with_audio` only through the `supports_audio = false` wrapper, so the `true` branch has no direct unit coverage, and the sign of that flag is the security-relevant bit. Closes lablup#1304
Summary
The
xla-compilejob deniedunused_importsrather thanwarningsbecause thecuda,xla-ireeandxla-diagnosticsfeature sets carried a dead-code and clippy backlog that would have made the job red the day it landed. This clears that backlog and widens the gate to-D warnings.Resolution followed the criterion in the issue: cfg-gate to the feature set that has a real consumer where the gate needs no duplicate definition, otherwise allow with a comment naming the caller, and delete only when a search finds no consumer under any feature combination.
What changed
mlxcel-xlasrc/lib/mlxcel-xla/src/iree.rs:IreeRaggedLlama::decode_ragged_logitsis now#[cfg(feature = "diagnostics")]. Its only callers areLlavaReferenceDiagnosticEngine::captureand the Gemma3n diagnostic runners inbatch.rs, all of which are already#[cfg(feature = "diagnostics")]; serving callsdecode_ragged_logits_with_modesdirectly.src/lib/mlxcel-xla/src/iree.rs:decode_ragged_mrope_logitsis deleted. This is the one deletion in the PR.grep -rn "decode_ragged_mrope_logits" . --exclude-dir=.git --exclude-dir=targetfiltered of the_with_modessibling and thexla_llama_extern returns exactly two hits: the definition itself, and an error-message string insidedecode_ragged_mrope_logits_with_modesthat stays. There is no caller in any crate, test, bench, or example, under any feature combination.src/lib/mlxcel-xla/src/iree.rs: a doc comment describingcreate_ctxhad been stranded above a blank line when feat(xla): compile a set of context capacities and route requests between them #1302 insertedcreate_bucket_ctxand its own doc block between them, which is whatclippy::empty_line_after_doc_commentswas reporting. It is moved back ontocreate_ctx.src/lib/mlxcel-xla/src/aux.rs:AuxiliaryWeightDType::Float16andUint32are allowed undernot(feature = "micro-oracle").numeric_probe.rs, behind that feature, is their only construction site, whileffi_codeandsize_byteshave to keep mapping them for the FFI contract on every build. Gating the variants themselves would force acfgonto each arm of those two matches, including theFloat32 | Uint32arm.src/lib/mlxcel-xla/src/phi4_audio.rs:load_audio_moduletakes a scoped#[allow(clippy::too_many_arguments)]. A parameter struct would ripple into both call sites for a private single-file helper, so the allow was preferred per the issue's guidance.src/lib/mlxcel-xla/src/aux_manifest.rs: the nestedif letincache_lock_is_stalecollapses to an edition-2024 let chain.mlxcelsrc/server/batch/xla_audio_preprocess.rs: the test-only surface is allowed undernot(test), following the#[cfg_attr(not(test), allow(dead_code))]pattern already used insrc/model_metadata.rsandsrc/server/startup.rs. Each site namesxla_audio_preprocess_tests.rsas the caller:AudioPreprocessStage::spawn(serving usesspawn_with_loaderto keep MLX handles thread-confined),recv(serving must not block, so it drains withtry_recv),metrics,is_healthy, thehealthyfield it reads,AudioPreprocessMetrics::snapshot, andAudioPreprocessMetricsSnapshot. TheCancelled(AudioPreprocessCheckpoint)payload keeps its field with the same allow: serving matches it asCancelled(_), and the checkpoint distinction belongs in the type becauseCancelledis constructed at several checkpoints in that file.src/server/media.rs:validate_xla_raw_countsgains anot(test)arm alongside its existingnot(feature = "xla-iree")one.media_tests.rsis its only caller; the XLA admission path callsvalidate_xla_raw_counts_with_audiodirectly because it knows whether the loaded family supports audio.src/server/batch/xla_worker_admission.rs:drain_preprocessedtakes#[allow(clippy::while_let_loop)]. The suggestedwhile let Some(stage) = self.image_preprocessor.as_ref()head holds a shared borrow ofselfacross a body that calls&mut selfmethods and clears the field, so thematchshape is load-bearing rather than stylistic.src/loading/vlm.rsandsrc/models/sanitize.rs: the twoneedless_matchsites take#[cfg_attr(not(feature = "surgery"), allow(clippy::needless_match))]. The match only collapses tomatch transform { Some(t) => Some(t), None => None }when thesurgeryarm is compiled out, which is why the lint fires under--no-default-featuresand not under the default feature set. Applying clippy's suggestion would delete active-pipeline resolution from the default build, so the lint is silenced only for the builds that see the collapsed shape.CI
.github/workflows/ci.yml:xla-compilenow setsRUSTFLAGS: "-D warnings", and the paragraph explaining the narrower-D unused_importspolicy is replaced..github/workflows/ci.yml: the "Deliberately NOT covered" list records the gap that remains after this change. The job runscargo check, so-D warningsdenies rustc lints only.dead_codeandunused_importsare gated now, butcollapsible_if,needless_match,too_many_arguments,while_let_loopand the rest of clippy's own lints are still gated by nothing in CI under these feature sets, because theclippyjob covers default features only. That half of the backlog can regrow silently; swapping this job'scargo checkforcargo clippywas deliberately left out of scope.No runtime behavior change
The diff is attribute additions,
cfgadditions, comments, one collapsedif, one doc-comment move, and the deletion of one function that has no caller. No executed code path changes.Test plan
Run on the GB10 host with the IREE runtime provisioned (
bash scripts/iree/setup-cuda.sh,eval "$(bash scripts/iree/setup-cuda.sh --env)",MLX_CUDA_ARCHITECTURES=121), and re-run on the final commit after the review follow-ups landed.Acceptance criteria:
cargo clippy --features cuda,xla-iree --all-targets -- -D warnings: exit 0, no warnings.cargo clippy --no-default-features --features xla-diagnostics --all-targets -- -D warnings: exit 0, no warnings.cargo clippy -p mlxcel --lib --tests -- -D warnings: exit 0, no warnings.The two commands the job itself runs, under the widened flag, because
cargo clippy -- -D warningsapplies the flag only to the primary package whileRUSTFLAGSreaches every path-built unit includingmlxcel-coreandmlxcel-surgery. Clippy passing is therefore not sufficient evidence that the job will be green:RUSTFLAGS="-D warnings" cargo check --features cuda,xla-iree --all-targets: exit 0.RUSTFLAGS="-D warnings" cargo check --no-default-features --features xla-diagnostics --all-targets: exit 0.Scoped and mechanical checks:
cargo clippy -p mlxcel-xla --lib --features iree --all-targets -- -D warningscargo clippy -p mlxcel-xla --lib --features iree,diagnostics --all-targets -- -D warningscargo clippy -p mlxcel-xla --lib --features iree,micro-oracle --all-targets -- -D warnings, confirming themicro-oraclecfg arm on theAuxiliaryWeightDTypevariants is not narrowed wronglyrustfmt --edition 2024 --checkon every changed Rust file.github/workflows/ci.ymlparses as YAMLEnd to end, this PR's own CI exercises the change it makes:
OpenXLA feature compileran for 7m44s under the newRUSTFLAGS: "-D warnings"and passed, so the widened gate is green on arrival rather than red.OpenXLA feature link, added by #1305, also ran becausesrc/lib/mlxcel-xla/**is in its path filter.Not verified:
metal,accelerate. It cannot be built on this Linux host, so it is unverified by execution rather than confirmed. The static argument that it is unaffected:make verify-clippyruns--features metal,acceleratewithout--no-default-features, sosurgerystays on and bothneedless_matchattributes expand to nothing;mlxcel-xlabuilds with no features there, soiree.rs,aux.rs,aux_manifest.rsandphi4_audio.rssit behind#[cfg(feature = "iree")]and never compile; and on themlxcelside onlymedia.rsandxla_audio_preprocess.rscompile, where every change is anallowattribute that cannot break a build.Follow-ups this surfaced, out of scope here
mlxcel-xla's#[cfg(test)]modules are gated by no CI job at all. There is nodefault-members, socargo checkin this job resolves to-p mlxceland--all-targetsexpands within that package only, while theclippyjob builds default features wheremlxcel-xlais default-off. Recorded in the workflow's exclusion list.media_tests.rsreachesvalidate_xla_raw_counts_with_audioonly through thesupports_audio = falsewrapper, so thetruebranch has no direct unit coverage, and the sign of that flag is the security-relevant bit.Closes #1304