← Back to Pull requests

fix(gpu): read AMD graphics and memory clocks from hwmon #60844

Closed
unknown closed this pull request without merging on Nov 19, 2026 20:19 UTC
View on GitHub
unknown unknown commented on Nov 19, 2026 07:28 UTC
Author

What does this PR do?


  • The amd_gpu check now reads gpu.clock.speed.graphics / gpu.clock.speed.memory from the hwmon freqN_input labeled sclk / mclk (Hz to MHz), and uses the level of pp_dpm_sclk / pp_dpm_mclk only when hwmon has no such clock.

  • On AMD Instinct GPUs, hwmon is the SMU's current clock (of the first XCC for sclk), the same value amd-smi reports as gfx_0 / mem_0 from gpu_metrics; pp_dpm_ only marks the level near it (smu_v13_0_6_get_current_clk_freq_by_table feeds all three). On RDNA1/RDNA2 and APUs, hwmon sclk is the SMU's averaged clock.

  • pp_dpm_* is still read first: during a RAS interrupt it reads unavailable (or fails) while hwmon returns a value the driver did not set, so no clock is reported then, as before.
  • Motivation


    An AMD customer trial reported that only the memory clock came through. Since Linux 7.0 (85b0b7d7a3db, 7380228401c4), AMD Instinct GPUs print these tables with smu_cmn_print_dpm_clk_levels, which marks a level only within 25 MHz of the current clock:
  • Graphics clock: on MI200, MI300 and MI350 the table is {min, max}, so nothing is marked under load. Affects Linux 7.0 to 7.0.9; fixed in 7.1 and 7.0.10 (47a5dfc8add4 for SMU 13.0.6, ccf8932ed8cf for aldebaran).

  • Memory clock: discrete levels, so nothing is marked when UCLK is between two of them. Affects Linux 7.0 and later (still in 7.3) and amdgpu-dkms 6.19.14. Our MI300X VF showed it under load: 1270 MHz between the 1100 and 1300 MHz levels.
  • Reading hwmon first fixes both and reports the clock itself rather than the nearest level.

    Describe how you validated your changes


  • Unit tests cover hwmon over a marked level, unmarked tables, no hwmon clocks, a label without input, an unparsable input, and the RAS interrupt; they fail on main.

  • dda inv test (pkg/gpu/amd, corechecks/gpu/amd) and dda inv linter.go pass.

  • MI300X VF (an earlier revision that used hwmon only for unmarked tables): amd_gpu OK, other metrics unchanged. Under load, gpu.clock.speed.memory 1262 MHz from hwmon (1270 read by hand, amd-smi 1254) and gpu.clock.speed.graphics 1944 MHz with an unmarked pp_dpm_sclk bind-mounted into the Agent container (amd-smi 1955). Both arrived in Datadog.
  • Diff: 278 lines (+208 / -70) across 3 files Reviewer: gjulianm Review duration: 770m
    All Vouch review confidence checks passed
    Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.40 · 278 lines diff across 3 files
    0.40
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.337
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #60844"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 39.6% (MEDIUM) · Higher = larger blast radius
    39.6%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 15.7% · Safe to merge
    15.7%