Skip to content

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

Description

@sempervictus

Summary

all-smi 0.20.1 fails to compile against libamdgpu_top 0.11.4 because the upstream crate renamed FdInfoStat::get_all_proc_usage to FdInfoStat::update_proc_usage in a patch release. Cargo's caret semver resolves libamdgpu_top = "0.11.3" to 0.11.4 (released 2026-04-23), breaking all fresh builds on Linux glibc targets that pick up AMD GPU support.

Background

The Cargo.toml declares the AMD-target dependency as:

[target.'cfg(all(target_os = "linux", not(target_env = "musl")))'.dependencies]
libamdgpu_top = "0.11.3"

Cargo treats "0.11.3" as ^0.11.3 (i.e., >=0.11.3, <0.12.0). Once libamdgpu_top 0.11.4 was published on 2026-04-23, fresh resolutions select 0.11.4, and the call at src/device/readers/amd.rs fails to compile:

error[E0599]: no method named `get_all_proc_usage` found for struct `FdInfoStat` in the current scope
   --> src/device/readers/amd.rs:572:20
help: there is a method `update_proc_usage` with a similar name

libamdgpu_top 0.11.4 contains additional internal renames (the pid_map field became pre_proc_usage_map, and get_cpu_time changed signature), but we do not consume those names — only get_all_proc_usage is reachable from our code.

This is upstream's failure to honor semver: the 0.11.x train shipped a public-API rename in a patch bump rather than a 0.12.0 minor bump. We need to both adapt to the rename and harden our version constraint so a future patch surprise does not recur.

Proposed Solution

  1. Adopt the new method name. Update the only call site at src/device/readers/amd.rs:572 from fdinfo.get_all_proc_usage(&proc_index); to fdinfo.update_proc_usage(&proc_index);.
  2. Pin the dependency exactly. Change libamdgpu_top = "0.11.3" to libamdgpu_top = "=0.11.4" in Cargo.toml. The exact-version requirement prevents Cargo from silently picking up a future patch that breaks the API again. Re-evaluate the pin when upstream restores semver discipline or when we are willing to verify each new release.
  3. Regenerate Cargo.lock and run cargo build --release on a Linux glibc target to confirm AMD GPU support compiles.

Implementation Notes

  • Affected file: src/device/readers/amd.rs (one call site).
  • Affected manifest: Cargo.toml (single dependency line under the Linux-glibc target table).
  • The fields we read after the call (fdinfo.proc_usage, proc_usage.usage.vram_usage, proc_usage.usage.gtt_usage) remain public and unchanged in 0.11.4 — no further code changes required.
  • musl and non-Linux targets are unaffected: the dependency block is gated on cfg(all(target_os = "linux", not(target_env = "musl"))).
  • After this fix, library consumers (e.g., all-smi = { version = "0.20", default-features = false, optional = true }) will resolve cleanly because the exact pin removes the version-resolution surprise.
  • A patch release (e.g., 0.20.2) should follow the merge so downstream crates pick up the fix without needing to wait for the next minor.

Acceptance Criteria

  • Cargo.toml pins libamdgpu_top to =0.11.4 under the Linux-glibc target table.
  • src/device/readers/amd.rs calls update_proc_usage instead of get_all_proc_usage.
  • cargo build --release succeeds on a Linux glibc target with the AMD reader compiled in.
  • cargo clippy passes with no new warnings on the AMD reader.
  • cargo build --release continues to succeed on macOS, musl, and Windows targets (where this dependency is not pulled in).
  • A patch release is cut so downstream consumers receive the fix.

Original Suggestion

Title: Build fails on get_all_proc_usage in amd.rs

error[E0599]: no method named `get_all_proc_usage` found for struct `FdInfoStat` in the current scope
   --> /.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/all-smi-0.20.1/src/device/readers/amd.rs:556:20
    |
556 |             fdinfo.get_all_proc_usage(&proc_index);
    |                    ^^^^^^^^^^^^^^^^^^
    |
help: there is a method `update_proc_usage` with a similar name
    |
556 -             fdinfo.get_all_proc_usage(&proc_index);
556 +             fdinfo.update_proc_usage(&proc_index);
    |

For more information about this error, try `rustc --explain E0599`.

with

all-smi = { version = "0.20", default-features = false, optional = true }

in the Cargo.toml of the library trying to use this code

Metadata

Metadata

Assignees

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions