Repository navigation
Conversation
|
The first 5 commits are actually this PR: #1946 |
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for GPU metrics versions 2.0-2.4 and 3.0, enabling functionality on newer APUs such as Strix Halo. The implementation includes new data structures, metric types, and supporting functions for the expanded metrics capabilities.
Key Changes:
- Added support for GPU Metrics v2.0-2.4 and v3.0 with corresponding data structures
- Implemented new metric types for NPU, core temperatures, L3 cache, throttle residency, and power measurements
- Extended power info structure with additional power fields (NPU, APU, dGPU, system, etc.)
Reviewed Changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| projects/amdsmi/src/amd_smi/amd_smi.cc | Added init_max_uint_types template, expanded power info initialization for new fields |
| projects/amdsmi/src/amd_smi/amd_smi_utils.cc | Changed error code from API_FAILED to NOT_SUPPORTED for missing power cap |
| projects/amdsmi/rocm_smi/src/rocm_smi_gpu_metrics.cc | Added v2.0-v3.0 metric structures, populate functions, and translation tables |
| projects/amdsmi/rocm_smi/include/rocm_smi/rocm_smi_gpu_metrics.h | Defined new metric structures (v20-v30), enum values, and class declarations |
| projects/amdsmi/rocm_smi/include/rocm_smi/rocm_smi.h | Extended rsmi_gpu_metrics_t with v2.x and v3.0 fields |
| projects/amdsmi/py-interface/amdsmi_interface.py | Updated power info dict with new fields and improved max value checking |
| projects/amdsmi/py-interface/amdsmi_wrapper.py | Updated Python bindings for new power info structure fields |
| projects/amdsmi/amdsmi_cli/amdsmi_logger.py | Improved power usage formatting to handle zero power limits |
| projects/amdsmi/example/amd_smi_drm_example.cc | Fixed printf format specifier from %ld to %d |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
4d1ecc0 to
edda5ff
Compare
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 11 out of 12 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
OK, I've got the right data feeding in. Now I just need to fix the policy for showing GTT vs VRAM to be accurate for an APU like Strix Halo. |
5faca4c to
1909a0b
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 9 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| uint32_t dGPU_power; //!< Average dGPU power in mW, A+A only */ | ||
| uint32_t all_core_power; //!< Average power of all cores in mW, APU only */ | ||
| uint32_t system_power; //!< Average system power in mW, APU only */ | ||
| uint64_t reserved[20]; |
There was a problem hiding this comment.
Just as a note:
The size of this struct is now 232 bytes (where the expected would be 228) , with an alignment of 8. But due to potential padding, sizes may differ:
- Different default packing rules between C and C++ compilers
- Different ABI (Application Binary Interface) requirements
- Different struct packing on 32-bit vs 64-bit systems
For that (reserved[]) to really make a difference, we would need to force 1-byte packing, no padding and still static assert size checking, for example: ((14 member fields + 20 reserved) * alignment) + versioning.
As we don't do that, it will not help much due to our C header and C++ implementation.
There was a problem hiding this comment.
FWIW I was running into data that didn't make sense and it turned out to be caused by padding sizes which is how I got here. Are you suggesting totally dropping the uint64_t reserved[20]??
| @@ -154,6 +153,12 @@ const AMDGpuMetricVersionTranslationTbl_t amdgpu_metric_version_translation_tabl | |||
| {join_metrics_version(1, 7), AMDGpuMetricVersionFlags_t::kGpuMetricV17}, | |||
| {join_metrics_version(1, 8), AMDGpuMetricVersionFlags_t::kGpuMetricV18}, | |||
| {join_metrics_version(1, 9), AMDGpuMetricVersionFlags_t::kGpuMetricDynV19Plus}, // Dynamic GPU Metrics | |||
| {join_metrics_version(2, 0), AMDGpuMetricVersionFlags_t::kGpuMetricV20}, | |||
There was a problem hiding this comment.
I don't think metrics 2.0 and newer are using the "dynamic metrics" format yet. We will need to double-check on this as we consider anything with gpu metrics >= 1.9 or xcp metrics >= 1.1 to be dynamic metrics, which, if that is not the case, will break the readings.
There was a problem hiding this comment.
Can you explain what dynamic metrics actually means? I'm guessing it's structs that are not fixed and can have variable sizes. And thus yes - these are fixed size structs and not dynamic so there will be some places that could break I'll have to look for.
There was a problem hiding this comment.
This is a large set of changes, and some things need to be double and triple checked.
Where are these metric versions (2.0...3.0) coming from? Are they using dynamic metrics format?
Which system has gpu_metric files which these versions in the header?
If all that checks, we need to review a few more points, and then:
- Update
unit testsforgpu metrics, andpartition metrics - Update examples
- Make sure
GolangandRustshims/bindings will work properly - Then check for changes:
- py-interface/amdsmi_interface.py
- py-interface/init.py
- amdsmi_cli/amdsmi_parser.py
- py-interface/README.md
- docs/how-to/using-amdsmi-for-python.md
- py-interface/amdsmi_wrapper.py
- ./CHANGELOG.md
Let's chat about the initial questions, before we get to #4.
The structs come from amdgpu headers.
I don't believe so.
OK, will hold off on getting started for any of this until we're clear on the other review points. |
Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
|
re-opened as #4596 |
This enables output on some newer APUs such as Strix Halo.