Repository navigation
test(amdsmi): fix APU cleanup - #13412
Draft
koushikbillakanti-amd wants to merge 1 commit into
Draft
koushikbillakanti-amd wants to merge 1 commit into
koushikbillakanti-amd wants to merge 1 commit into
Conversation
✅ All Policy Checks Passed
📖 Need help? See the Policy FAQ for details on every check and how to fix failures. |
|
🚫 Please fix the failed policies before requesting reviews. The following policy checks failed:
The |
1 task done
koushikbillakanti-amd
force-pushed
the
users/kbillaka/ROCM-32093
branch
from
October 16, 2026 16:27
2872dd2 to
50cb8c3
Compare
adam360x
added a commit
that referenced
this pull request
Oct 21, 2026
## Motivation On integrated GPUs with a `gpu_metrics` v2.x table, GPU and multimedia activity read 100 times too high. A GPU at 45% busy read as 4545 in the C API; `amd-smi metric --usage` showed N/A, or up to 100% when the GPU was nearly idle. The APU firmware reports activity in hundredths of a percent (the SMU headers mark `GfxActivity`/`UvdActivity` `[centi]`; amdgpu divides by 100 only for `gpu_busy_percent`), and amd-smi passed the value on as whole percent. #11075 made these tables readable on v2.1-v2.3 APUs; this follows up on its post-merge review. v3.0 tables already report whole percent. Discrete GPUs are not affected. ## Technical Details - **Behavior change:** v2.x GFX and MM activity are whole percent in `amdsmi_gpu_metrics_t` and in its APU sub-struct (was hundredths), so `amdsmi_get_gpu_activity()` follows. The not-applicable value is kept as is. - `readDevInfoBinary()`: passes on only the errnos that name a device state (suspended or resetting, runtime-inactive, access denied, interrupted, firmware without the metrics command); others report a failed read (`EINVAL` was reported as a caller error). - The APU metrics pointer is copied to thread-local storage while the device lock is held (a concurrent call could replace it while the caller read it). - `amdsmi.h`: return statuses of both metrics calls, the activity unit, and the partition call never returning APU metrics. - `amd_smi.cc`: three log statements rewrapped (formatting only). - Tests: `GpuUnit.ApuActivityReachesThePublicFieldsAsWholePercent`, `NotApplicableApuActivityIsStillReportedAsNotApplicable`, `DriverRefusedMetricsReadIsNotReportedAsUnsupported`; the oversized-header test now catches a missing read-size clamp; the Python APU field test spells out the v2.4 layout. - CHANGELOG: one Resolved Issues entry; the #11075 entry no longer names status constants. - Not changed here: per-metric query statuses, which #13412 changes. ## Issue Tracking JIRA ID: ROCM-29548 ## Test Plan - `amdsmitst --gtest_filter='*Unit*'` and the Python unit suite; each new test with its fix reverted. - Hawk Point APU (gfx1103, `gpu_metrics` v2.1) under a GPU load at a measured 45.9% duty. One captured table was bind-mounted over the sysfs node, so develop, the previous push and this branch read the same bytes: C API, Python and `amd-smi metric --usage`. ## Test Result - Unit: 298 passed (18 skipped); Python: 485 passed. Each new test fails with its fix reverted. - Table holding 4545 hundredths (45.45%): | | C API (top / APU) | `GFX_ACTIVITY` | APU GFX row | |---|---|---|---| | develop | 4545 / 4545 | N/A | missing | | previous push | 45 / 4545 | 45 % | missing | | this branch | 45 / 45 | 45 % | 45 % | - Nearly idle table (18 hundredths): develop showed 18 % in both rows; this branch shows 0 %. ## Submission Checklist - [x] Look over the contributing guidelines at https://github.com/ROCm/rocm-systems/blob/develop/CONTRIBUTING.md. --------- Signed-off-by: Adam360x <Adam.pryor@amd.com> Signed-off-by: Maisam Arif <Maisam.Arif@amd.com> Co-authored-by: Maisam Arif <Maisam.Arif@amd.com>
dgaliffiAMD
pushed a commit
that referenced
this pull request
Oct 21, 2026
## Motivation On integrated GPUs with a `gpu_metrics` v2.x table, GPU and multimedia activity read 100 times too high. A GPU at 45% busy read as 4545 in the C API; `amd-smi metric --usage` showed N/A, or up to 100% when the GPU was nearly idle. The APU firmware reports activity in hundredths of a percent (the SMU headers mark `GfxActivity`/`UvdActivity` `[centi]`; amdgpu divides by 100 only for `gpu_busy_percent`), and amd-smi passed the value on as whole percent. #11075 made these tables readable on v2.1-v2.3 APUs; this follows up on its post-merge review. v3.0 tables already report whole percent. Discrete GPUs are not affected. ## Technical Details - **Behavior change:** v2.x GFX and MM activity are whole percent in `amdsmi_gpu_metrics_t` and in its APU sub-struct (was hundredths), so `amdsmi_get_gpu_activity()` follows. The not-applicable value is kept as is. - `readDevInfoBinary()`: passes on only the errnos that name a device state (suspended or resetting, runtime-inactive, access denied, interrupted, firmware without the metrics command); others report a failed read (`EINVAL` was reported as a caller error). - The APU metrics pointer is copied to thread-local storage while the device lock is held (a concurrent call could replace it while the caller read it). - `amdsmi.h`: return statuses of both metrics calls, the activity unit, and the partition call never returning APU metrics. - `amd_smi.cc`: three log statements rewrapped (formatting only). - Tests: `GpuUnit.ApuActivityReachesThePublicFieldsAsWholePercent`, `NotApplicableApuActivityIsStillReportedAsNotApplicable`, `DriverRefusedMetricsReadIsNotReportedAsUnsupported`; the oversized-header test now catches a missing read-size clamp; the Python APU field test spells out the v2.4 layout. - CHANGELOG: one Resolved Issues entry; the #11075 entry no longer names status constants. - Not changed here: per-metric query statuses, which #13412 changes. ## Issue Tracking JIRA ID: ROCM-29548 ## Test Plan - `amdsmitst --gtest_filter='*Unit*'` and the Python unit suite; each new test with its fix reverted. - Hawk Point APU (gfx1103, `gpu_metrics` v2.1) under a GPU load at a measured 45.9% duty. One captured table was bind-mounted over the sysfs node, so develop, the previous push and this branch read the same bytes: C API, Python and `amd-smi metric --usage`. ## Test Result - Unit: 298 passed (18 skipped); Python: 485 passed. Each new test fails with its fix reverted. - Table holding 4545 hundredths (45.45%): | | C API (top / APU) | `GFX_ACTIVITY` | APU GFX row | |---|---|---|---| | develop | 4545 / 4545 | N/A | missing | | previous push | 45 / 4545 | 45 % | missing | | this branch | 45 / 45 | 45 % | 45 % | - Nearly idle table (18 hundredths): develop showed 18 % in both rows; this branch shows 0 %. ## Submission Checklist - [x] Look over the contributing guidelines at https://github.com/ROCm/rocm-systems/blob/develop/CONTRIBUTING.md. --------- Signed-off-by: Adam360x <Adam.pryor@amd.com> Signed-off-by: Maisam Arif <Maisam.Arif@amd.com> Co-authored-by: Maisam Arif <Maisam.Arif@amd.com>
koushikbillakanti-amd
force-pushed
the
users/kbillaka/ROCM-32093
branch
from
October 22, 2026 18:38
1608345 to
1b46cb7
Compare
1 task done
marifamd
marked this pull request as draft
October 26, 2026 17:28
Signed-off-by: Koushik Billakanti <koushik.billakanti@amd.com>
koushikbillakanti-amd
force-pushed
the
users/kbillaka/ROCM-32093
branch
from
November 2, 2026 16:47
5715363 to
f7a6192
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Prevent CLI set-test cleanup from failing when APU metrics omit dGPU-only sections. Public GPU metrics status handling was already fixed by #11075; this PR changes only the test harness.
Technical Details
tests/python/cli/base.py: record the metrics producer's APU flag with the baseline.tests/python/cli/test_set.py: default omitted sections only for confirmed APUs, keep dGPU data strict, require successful power-cap reset when the recorded cap is settable, and validate cleanup before starting the sweep.tests/python/unit/system/test_cli_set_restore.py: add focused cleanup, reset-status and preflight regressions. Existing SOC/PLPD ID handling and fan-reset status handling are already upstream.Issue Tracking
JIRA ID: ROCM-32093
Test Plan
BUILD_TESTS=ON,BUILD_CLI=ON,ENABLE_ESMI_LIB=OFF; staged commit verified.*Unit*tests as non-root.Test Result
KeyError('fan'). All four mutations detected. Build and applicable hooks passed.Submission Checklist