Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .squad/decisions/inbox/cohaagen-cuda-clippy-hotfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# CI hotfix — make `DeviceOffloadPolicy` `Default` derivable (clippy `-D warnings`)

- Date: 2026-08-01
- By: Cohaagen
- Branch: `squad/fix-cuda-clippy-derivable-default`
- Lineage: unblocks origin/main "CUDA compile (Linux+Windows)"; regression introduced by #572

## Root cause

#572 flipped `DeviceOffloadPolicy::async_pagein`'s default to `false`. That made
the hand-written `impl Default` fully equal to a derivable default (all three
fields = their type default: `bool` → `false`, `Option` → `None`), so
`clippy::derivable_impls` fires under the CI's `-D warnings`, turning every PR's
CUDA-compile job RED (weight_paging.rs:117).

## Fix (behavior-identical)

Replaced the hand-written `impl Default for DeviceOffloadPolicy` with
`#[derive(Default)]` on the struct. Verified byte-identical: the three field
defaults are exactly `enabled: false`, `device_budget_bytes: None`,
`async_pagein: false` — which is precisely what the derive produces. Doc comments
on fields preserved. `from_env()` and all runtime behavior unchanged. Net diff:
1 insertion, 11 deletions (one file).

## Green confirmation

- `cargo clippy -p onnx-runtime-ep-cuda --features cuda -- -D warnings` → **exit 0**
(was the failing gate; no other `derivable_impls`/`-D warnings` hits in the crate).
- CI first step `cargo check --locked -p onnx-runtime-ep-cuda -p onnx-runtime-python
--features onnx-runtime-python/cuda` → **exit 0**.
- `cargo fmt --all --check` → clean.
- Guard test `weight_paging::tests::device_policy_defaults_to_disabled` (already
present, :678) asserts `enabled=false`, `device_budget_bytes=None`,
`async_pagein=false` → **passes**, locking the derived defaults against field
default-drift. No new test needed.

## Verdict

Trivial, provably behavior-identical lint hotfix. Unblocks main (and #574).
12 changes: 1 addition & 11 deletions crates/onnx-runtime-ep-cuda/src/weight_paging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ pub(crate) fn async_pagein_from_env_value(value: Option<&str>) -> bool {
/// Whether/how the CUDA EP should page offloaded weights into a bounded VRAM
/// residency cache. Disabled by default so the resident fast path is untouched
/// and byte-identical.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Default)]
pub struct DeviceOffloadPolicy {
pub enabled: bool,
/// Explicit VRAM budget in bytes, if the operator pinned one.
Expand All @@ -114,16 +114,6 @@ pub struct DeviceOffloadPolicy {
pub async_pagein: bool,
}

impl Default for DeviceOffloadPolicy {
fn default() -> Self {
Self {
enabled: false,
device_budget_bytes: None,
async_pagein: false,
}
}
}

impl DeviceOffloadPolicy {
/// Read the policy from the process environment.
pub fn from_env() -> Self {
Expand Down
Loading