Skip to content

fix: pin libamdgpu_top to =0.11.4 and rename get_all_proc_usage call (#205)#207

Merged
inureyes merged 1 commit into
mainfrom
fix/issue-205-libamdgpu-top-rename
Apr 28, 2026
Merged

fix: pin libamdgpu_top to =0.11.4 and rename get_all_proc_usage call (#205)#207
inureyes merged 1 commit into
mainfrom
fix/issue-205-libamdgpu-top-rename

Conversation

@inureyes

Copy link
Copy Markdown
Member

Summary

Fixes build failure caused by libamdgpu_top 0.11.4 renaming
FdInfoStat::get_all_proc_usageFdInfoStat::update_proc_usage in a
patch release. Cargo's caret resolution for "0.11.3" silently picks up
0.11.4, breaking all Linux glibc fresh builds.

Closes #205

Changes

  1. Cargo.toml: Changed libamdgpu_top = "0.11.3" to
    libamdgpu_top = "=0.11.4" (exact pin) under the Linux-glibc target
    table, with a comment explaining the reason for pinning.
  2. src/device/readers/amd.rs line 572: Renamed
    fdinfo.get_all_proc_usage(&proc_index)
    fdinfo.update_proc_usage(&proc_index) — the only call site.
  3. Cargo.lock: Regenerated via
    cargo update -p libamdgpu_top --precise 0.11.4.

Verification Results

Check Result
cargo build --release PASSED (macOS)
cargo fmt --check PASSED
cargo clippy --all-targets -- -D warnings Pre-existing failures in src/doctor/checks/{amd,furiosa,gaudi,privileges}.rs — 7 unused-import warnings exist identically on main before this PR; not introduced by this change.
cargo test PASSED (21 passed, 14 ignored)
grep -rn get_all_proc_usage src/ Returns zero matches — call site fully renamed
Linux cargo check (AMD target) Requires CI — AMD reader is gated by cfg(all(target_os = "linux", not(target_env = "musl"))) and cannot compile on macOS. Final AMD-target verification depends on CI.

Notes

  • The exact-pin (=0.11.4) prevents future upstream patch surprises from
    silently breaking the build again. Re-evaluate the pin when bumping to a
    new libamdgpu_top minor and verifying the API surface.
  • A patch release (e.g., 0.20.2) should follow merge so downstream
    library consumers can pick up the fix without waiting for the next minor
    release.

Upstream shipped a breaking API rename (get_all_proc_usage →
update_proc_usage) in a patch release (0.11.4), violating semver.
Cargo's caret resolution for "0.11.3" picks up 0.11.4 on fresh
installs, breaking all Linux glibc builds.

Two changes:
- Cargo.toml: exact-pin libamdgpu_top to =0.11.4 to prevent future
  silent patch breaks; comment explains the rationale.
- src/device/readers/amd.rs:572: rename call site to update_proc_usage.

Lockfile regenerated via `cargo update -p libamdgpu_top --precise 0.11.4`.

Closes #205
@inureyes inureyes added type:bug Something isn't working priority:high High priority issue device:amd-gpu AMD GPU related status:review Under review labels Apr 28, 2026
@inureyes

Copy link
Copy Markdown
Member Author

Implementation Review Summary

Intent

Fix the Linux glibc build failure introduced when libamdgpu_top 0.11.4 renamed FdInfoStat::get_all_proc_usage to update_proc_usage in a patch release, and harden the version constraint so a future patch surprise cannot recur.

Findings Addressed

  • No findings. The PR is a minimal, surgical fix that matches the issue scope exactly.

Remaining Items

  • None. The known pre-existing clippy warnings in src/doctor/checks/{privileges,amd,furiosa,gaudi}.rs were verified to exist on main before this PR and are out of scope (separate cleanup issue territory).

Verification

  • All stated requirements implemented
    • Cargo.toml line 76: libamdgpu_top = "=0.11.4" (exact pin) under cfg(all(target_os = "linux", not(target_env = "musl"))).
    • src/device/readers/amd.rs:572: fdinfo.update_proc_usage(&proc_index); — call site renamed.
    • Cargo.lock: libamdgpu_top 0.11.3 → 0.11.4 with the expected transitive libdrm_amdgpu_sys 0.8.12 → 0.8.13 bump and nothing else.
  • No placeholder/mock code remaining — pure rename + version bump; no stubs.
  • Integrated into project code flow
    • src/device/readers/mod.rs:48 (cfg-gated pub mod amd)
    • src/device/reader_factory.rs:48 (cfg-gated use ... amd)
    • src/device/reader_factory.rs:100 (readers.push(Box::new(amd::AmdGpuReader::new())) inside the linux arm guarded by has_amd())
    • The renamed call lives inside impl GpuReader for AmdGpuReader (get_processes), which is the live runtime path, not feature-gated dead code.
  • No other call sites remaingrep -rn 'get_all_proc_usage' src/ returns zero matches; the surrounding usage of FdInfoStat::default(), fdinfo.proc_usage, proc_usage.usage.vram_usage, and proc_usage.usage.gtt_usage is unchanged and remains valid against 0.11.4.
  • Project conventions followed
    • Inline comment style on the dependency matches existing patterns (cf. russh lines 57–60, zstd/flate2 lines 49–53), references the issue number, explains rationale concisely, and notes "Re-evaluate when bumping."
    • Branch name fix/issue-205-libamdgpu-top-rename follows branch-conventions.
    • Commit message fix: pin libamdgpu_top to =0.11.4 and rename update_proc_usage call follows commit-conventions (proper fix: prefix, imperative mood, references Fix build failure with libamdgpu_top 0.11.4 — method renamed (get_all_proc_usage → update_proc_usage) #205 in body, English).
  • Existing modules reused where applicable — N/A; mechanical rename to upstream's new name.
  • No unintended structural changes — diff touches exactly three files (Cargo.toml, Cargo.lock, src/device/readers/amd.rs), 8 additions / 6 deletions total. No moves, renames, or refactors outside scope.
  • Tests passcargo test --release: 21 passed, 14 ignored. cargo fmt --check passes. cargo build --release succeeds on macOS host.

Notes on AMD-target verification

The AMD reader is gated by cfg(all(target_os = "linux", not(target_env = "musl"))), so the macOS build host cannot exercise the renamed call directly. CI on a Linux glibc target is the source of truth for compile verification of that path; this is a known limitation, not a defect of this PR.

@inureyes

Copy link
Copy Markdown
Member Author

PR Finalization Complete

Summary

  • Tests: Skipped per scope — the renamed method is upstream library code; no AMD hardware available in CI to exercise the integration path. No fake tests added.
  • Documentation: Zero matches for get_all_proc_usage in any .md file. No CHANGELOG file exists in the project, so no entry was needed. No docs changes required.
  • Lint/Format: cargo fmt --check passes with no diff. cargo clippy --all-targets shows 7 pre-existing unused-import warnings in src/doctor/checks/{amd,furiosa,gaudi,privileges}.rs — these exist identically on main and none are in the three files touched by this PR (Cargo.toml, Cargo.lock, src/device/readers/amd.rs). Out of scope, not touched.

Final gate results

Check Result
cargo fmt --check PASSED
cargo clippy --all-targets PASSED (7 pre-existing warnings, none in PR files)
cargo build --release PASSED
cargo test PASSED (21 passed, 0 failed, 14 ignored)

No changes were needed. The PR is ready for merge.

@inureyes inureyes added status:done Completed and removed status:review Under review labels Apr 28, 2026
@inureyes inureyes merged commit 9419c9b into main Apr 28, 2026
4 checks passed
@inureyes inureyes deleted the fix/issue-205-libamdgpu-top-rename branch April 28, 2026 18:06
inureyes pushed a commit that referenced this pull request May 24, 2026
…eak (#219)

libamdgpu_top <= 0.11.4 leaked a file descriptor on every AmdGpuReader
instantiation: DevicePath opened the DRM device via into_raw_fd(), so the
handle was never closed. Repeated/library callers (AllSmi::new,
get_gpu_readers, AmdGpuReader) exhausted the per-process fd limit and crashed.
0.11.5 caches an Arc<OwnedFd> and closes the handle on drop.

Kept the dependency exact-pinned (=0.11.5) to preserve the semver-break
protection from #207: this crate has renamed public APIs in patch releases.

Closes #218
@inureyes inureyes self-assigned this May 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

device:amd-gpu AMD GPU related priority:high High priority issue status:done Completed type:bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix build failure with libamdgpu_top 0.11.4 — method renamed (get_all_proc_usage → update_proc_usage)

1 participant