Skip to content
Closed
54 changes: 53 additions & 1 deletion projects/amdsmi/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,64 @@ Full documentation for amd_smi_lib is available at [https://rocm.docs.amd.com/pr

***All information listed below is for reference and subject to change.***

## amd_smi_lib for ROCm 7.15.0
## amd_smi_lib for ROCm 10.0

### Added

- **Added accelerator partition memory allocation mode API**.
- New APIs: `amdsmi_get_gpu_accelerator_partition_mem_alloc_mode()`, `amdsmi_set_gpu_accelerator_partition_mem_alloc_mode()`.
- New enum: `amdsmi_accelerator_partition_mem_alloc_mode_t` (`AMDSMI_ACCELERATOR_PARTITION_MEM_ALLOC_CAPPING`, `AMDSMI_ACCELERATOR_PARTITION_MEM_ALLOC_ALL`).
- Supersedes the equivalent `compute_partition` memory allocation mode APIs, which are now deprecated.

### Changed

- **Bumped the library major version to 27.0.0** (breaking).
- The shared library SONAME is now `libamd_smi.so.27`. Consumers linked against `libamd_smi.so.26` must relink; no source changes are required beyond the API changes listed elsewhere in this release.

- **Widened five `amdsmi_gpu_metrics_t` accumulator counters from 32-bit to 64-bit** (breaking).
- `gfx_activity_acc`, `mem_activity_acc`, `pcie_nak_sent_count_acc`, `pcie_nak_rcvd_count_acc`, and `pcie_lc_perf_other_end_recovery` are now `uint64_t` to match the amdgpu pmfw metrics header. Recompile callers that read these fields; the struct layout and field offsets have changed.

- **Aligned the fabric telemetry and NIC firmware API surface with the unified ABI** (breaking).
- `amdsmi_fabric_telem_id_to_string()` now returns `amdsmi_status_t` and writes the name through a `const char**` out-parameter, instead of returning a `const char*` directly.
- Renamed `amdsmi_nic_fw_t` to `amdsmi_nic_fw_entry_t`.
- Added the `amdsmi_fabric_type_t` enumerator `AMDSMI_FABRIC_TYPE_UALINK`; the previous spelling `AMDSMI_FABRIC_TYPE_UALLINK` is retained as a deprecated alias with the same value and is slated for removal in a future ROCm release.

- **Flattened the `amdsmi_fabric_info_t` structure and removed `amdsmi_fabric_info_ver_t`**.
- The intermediate `amdsmi_fabric_info_ver_t` type was removed from the public header. Its payload union is now the `fabric_info` member of `amdsmi_fabric_info_t`, and its version field is exposed directly as the top-level `fabric_version` field.
- Field access simplifies from `fabric_info.fabric_version.v1.<field>` to `fabric_info.v1.<field>`, and `fabric_info.version` becomes `fabric_version`.
- The change is ABI-preserving: field offsets and the overall structure size are unchanged. The Python `amdsmi_get_gpu_fabric_info()` dictionary keys are also unchanged.

- **Prefixed public preprocessor macros with `AMDSMI_` in `amdsmi.h`** (breaking).
- `MAX_SVI3_RAIL_INDEX`, `MAX_SVI3_RAIL_SELECTION`, `POWER_EFFICIENCY_MODE_4`, `POWER_EFFICIENCY_MODE_5`, and `MAX_NUMBER_OF_AFIDS_PER_RECORD` are now `AMDSMI_MAX_SVI3_RAIL_INDEX`, `AMDSMI_MAX_SVI3_RAIL_SELECTION`, `AMDSMI_POWER_EFFICIENCY_MODE_4`, `AMDSMI_POWER_EFFICIENCY_MODE_5`, and `AMDSMI_MAX_NUMBER_OF_AFIDS_PER_RECORD`. The unused `CENTRIGRADE_TO_MILLI_CENTIGRADE` macro was removed. Update references to the new names.

- **Deprecated the `compute_partition` APIs in favor of `accelerator_partition` equivalents**.
- `amdsmi_get_gpu_compute_partition()`, `amdsmi_set_gpu_compute_partition()`, `amdsmi_get_gpu_compute_partition_mem_alloc_mode()`, and `amdsmi_set_gpu_compute_partition_mem_alloc_mode()` are slated for removal in a future ROCm release. They now emit a `DeprecationWarning` from the Python interface and delegate to their `accelerator_partition` counterparts.
- The `amdsmi_compute_partition_type_t` and `amdsmi_compute_partition_mem_alloc_mode_t` enums are deprecated in favor of `amdsmi_accelerator_partition_type_t` and `amdsmi_accelerator_partition_mem_alloc_mode_t`.

- **Deprecated `amdsmi_set_gpu_memory_partition()` in favor of `amdsmi_set_gpu_memory_partition_mode()`**.
- `amdsmi_set_gpu_memory_partition` is slated for removal in a future ROCm release. It now emits a `DeprecationWarning` from the Python interface and functions as a wrapper of `amdsmi_set_gpu_memory_partition_mode()`.

- **Namespaced `amdsmi_clk_limit_type_t` and `amdsmi_io_bw_encoding_t` enumerators with an `AMDSMI_` prefix**.
- Added `AMDSMI_CLK_LIMIT_MIN`/`AMDSMI_CLK_LIMIT_MAX` and `AMDSMI_AGG_BW0`/`AMDSMI_RD_BW0`/`AMDSMI_WR_BW0`.
- The unprefixed names (`CLK_LIMIT_MIN`, `CLK_LIMIT_MAX`, `AGG_BW0`, `RD_BW0`, `WR_BW0`) are retained as deprecated aliases with unchanged values and are slated for removal in a future ROCm release.

- **Removed the `amdsmi_gpu_driver_reload()` API and its Python binding** (breaking).
- Reload the amdgpu driver out of band with `sudo modprobe -r amdgpu && sudo modprobe amdgpu` to apply memory partition changes instead.

- **Removed unused public macros to match the unified ABI** (breaking).
- Dropped the `AMDSMI_MAX_VF_COUNT`, `AMDSMI_MAX_DRIVER_NUM`, `AMDSMI_DFC_FW_NUMBER_OF_ENTRIES`, `AMDSMI_MAX_WHITE_LIST_ELEMENTS`, `AMDSMI_MAX_BLACK_LIST_ELEMENTS`, `AMDSMI_MAX_TA_WHITE_LIST_ELEMENTS`, `AMDSMI_MAX_ERR_RECORDS`, `AMDSMI_MAX_PROFILE_COUNT`, and `AMDSMI_PF_INDEX` defines, which were unreferenced by any API or struct.

- **Deduplicated the `amdsmi_fabric_telemetry_category_t` enumerators**.
- `AMDSMI_FABRIC_TELEMETRY_CATEGORY_INVALID` is now the canonical `0xFFFFFFFF` value; the previous `AMDSMI_FABRIC_TELEMETRY_CATEGORY_UNKNOWN` name (same value) is retained as a deprecated alias and is slated for removal in a future ROCm release.

- **Deprecated `amdsmi_get_gpu_vram_vendor()`**. Use `amdsmi_get_gpu_vram_info()` and read the `vram_vendor` field instead. The function is retained (it now delegates to `amdsmi_get_gpu_vram_info()`, and the Python binding emits a `DeprecationWarning`) and is slated for removal in a future ROCm release.

- **Removed `amdsmi_get_cpusocket_handles()` from the Python interface** (breaking). Use `amdsmi_get_cpu_handles()` instead.

- **Removed the `plpds` key from `amdsmi_get_xgmi_plpd()` Python output** (breaking). Use the `policies` key instead.

- **Removed `amdsmi_set_gpu_clk_range()`** (breaking). Use `amdsmi_set_gpu_clk_limit()` instead.

- **Restructured AMD SMI C++ tests into unit and functional suites**.
- The `amdsmitst` source tree now separates unit tests from hardware-backed functional tests under `tests/amd_smi_test/unit/` and `tests/amd_smi_test/functional/`.
- GTest suite names now follow a `<Component><Type>[<Operation>]` scheme: functional tests are `<Component>FunctionalReadOnly`/`<Component>FunctionalReadWrite` (e.g. `GpuFunctionalReadOnly`) and unit tests are `<Component>Unit` (e.g. `GpuUnit`). This replaces the old `amdsmitstReadOnly`/`amdsmitstReadWrite` and `AmdSmiDynamicMetricTest` names.
Expand Down Expand Up @@ -127,6 +178,7 @@ Full documentation for amd_smi_lib is available at [https://rocm.docs.amd.com/pr
- The module is additionally staged under `share/amd_smi` (its historical location) for consumers that resolve it via `ROCM_PATH/share/amd_smi` rather than `site-packages` (e.g. rocprofiler-compute, omnistat) and for the TheRock artifact layout, whose manifest captures `share/amd_smi` but not the interpreter's `site-packages`. `site-packages` remains the primary importable location.
- Added new CMake option `-DBUILD_PYTHON_WHEEL=ON` (default `OFF`) which builds the standalone Python wheel and an isolated `libamd_smi_python.so` (distinct SONAME) bundled inside it, so the wheel-shipped library can coexist in-process with the system `libamd_smi.so` without symbol collisions. With `-DBUILD_PYTHON_WHEEL=OFF` (the default used by ROCm CI) only the system-package layout is built; no wheel artifact is produced.
- `py-interface/amdsmi_wrapper.py` now loads the shared library in this order: the `AMDSMI_LIB_OVERRIDE` env var (development / ABI-test escape hatch), a `libamd_smi_python.so` bundled next to the wrapper (pip wheel), then the system `libamd_smi.so` via the dynamic linker. A `_MissingLibrary` sentinel defers `OSError` to the first API call when no candidate is loadable, so import-time tooling (docs, lint) still works without a runtime library.

- **Normalized JSON/CSV key casing in `amd-smi metric` clock and temperature sections**.
- The `uclk_aid`, `socclks_mid`, and temperature `xcd` keys are now lowercase (`aid_<N>`, `mid_<N>`, `xcp_<N>`) in JSON and CSV output, matching the existing `xcp_<N>` usage keys; they were previously uppercase (`AID_<N>`, `MID_<N>`, `XCP_<N>`).
- Human-readable output is unchanged, since it uppercases all keys.
Expand Down
22 changes: 12 additions & 10 deletions projects/amdsmi/amdsmi_cli/subcommands/set_value.py
Original file line number Diff line number Diff line change
Expand Up @@ -1254,7 +1254,9 @@ def format_fan_error(message, include_driver_note=False):
memory_partition = amdsmi_interface.AmdSmiMemoryPartitionType[
args.memory_partition
]
amdsmi_interface.amdsmi_set_gpu_memory_partition(args.gpu, memory_partition)
amdsmi_interface.amdsmi_set_gpu_memory_partition_mode(
args.gpu, memory_partition
)
out = f"Successfully set memory partition to {args.memory_partition}, use `sudo modprobe -r amdgpu && sudo modprobe amdgpu` to reload driver"
except amdsmi_exception.AmdSmiLibraryException as e:
out = f"[{e.get_error_info(detailed=False)}] Unable to set memory partition to {args.memory_partition}"
Expand Down Expand Up @@ -1805,34 +1807,34 @@ def format_fan_error(message, include_driver_note=False):

if getattr(args, "compute_partition_mem_alloc_mode", None):
try:
mode = amdsmi_interface.AmdSmiComputePartitionMemAllocModeType[
mode = amdsmi_interface.AmdSmiAcceleratorPartitionMemAllocModeType[
args.compute_partition_mem_alloc_mode
]
amdsmi_interface.amdsmi_set_gpu_compute_partition_mem_alloc_mode(args.gpu, mode)
out = f"Successfully set compute partition memory allocation mode to {args.compute_partition_mem_alloc_mode}"
amdsmi_interface.amdsmi_set_gpu_accelerator_partition_mem_alloc_mode(args.gpu, mode)
out = f"Successfully set accelerator partition memory allocation mode to {args.compute_partition_mem_alloc_mode}"
except KeyError:
out = (
"Invalid compute partition memory allocation mode "
"Invalid accelerator partition memory allocation mode "
f"{args.compute_partition_mem_alloc_mode}"
)
self.logger.store_output(args.gpu, "compute_partition_mem_alloc_mode", out)
self.logger.store_output(args.gpu, "accelerator_partition_mem_alloc_mode", out)
self.logger.print_output()
self.logger.clear_multiple_devices_output()
return
except amdsmi_exception.AmdSmiLibraryException as e:
out = f"[{e.get_error_info(detailed=False)}] Unable to set compute partition memory allocation mode to {args.compute_partition_mem_alloc_mode}"
out = f"[{e.get_error_info(detailed=False)}] Unable to set accelerator partition memory allocation mode to {args.compute_partition_mem_alloc_mode}"
if e.get_error_code() == amdsmi_interface.amdsmi_wrapper.AMDSMI_STATUS_NO_PERM:
out = "[AMDSMI_STATUS_NO_PERM] Command requires elevation"
self.logger.store_output(args.gpu, "compute_partition_mem_alloc_mode", out)
self.logger.store_output(args.gpu, "accelerator_partition_mem_alloc_mode", out)
self.logger.print_output()
self.logger.clear_multiple_devices_output()
raise PermissionError("Command requires elevation") from e
else:
self.logger.store_output(args.gpu, "compute_partition_mem_alloc_mode", out)
self.logger.store_output(args.gpu, "accelerator_partition_mem_alloc_mode", out)
self.logger.print_output()
self.logger.clear_multiple_devices_output()
return
self.logger.store_output(args.gpu, "compute_partition_mem_alloc_mode", out)
self.logger.store_output(args.gpu, "accelerator_partition_mem_alloc_mode", out)
self.logger.print_output()
self.logger.clear_multiple_devices_output()
return
Expand Down
6 changes: 3 additions & 3 deletions projects/amdsmi/amdsmi_cli/subcommands/static.py
Original file line number Diff line number Diff line change
Expand Up @@ -836,13 +836,13 @@ def static_gpu(
e.get_error_info(),
)
try:
mem_alloc_mode = amdsmi_interface.amdsmi_get_gpu_compute_partition_mem_alloc_mode(
args.gpu
mem_alloc_mode = (
amdsmi_interface.amdsmi_get_gpu_accelerator_partition_mem_alloc_mode(args.gpu)
)
except amdsmi_exception.AmdSmiLibraryException as e:
mem_alloc_mode = "N/A"
logging.debug(
"Failed to get compute partition mem alloc mode for gpu %s | %s",
"Failed to get accelerator partition mem alloc mode for gpu %s | %s",
gpu_id,
e.get_error_info(),
)
Expand Down
11 changes: 5 additions & 6 deletions projects/amdsmi/docs/conceptual/partition.md
Original file line number Diff line number Diff line change
Expand Up @@ -460,8 +460,6 @@ Changing partition settings has strict requirements:
sudo modprobe -r amdgpu && sudo modprobe amdgpu
```

Alternatively, call `amdsmi_gpu_driver_reload()` from the library.

- A driver reload affects **all GPUs in the hive** -- every GPU in the system is reconfigured
to the new memory partition configuration at once.

Expand All @@ -475,7 +473,7 @@ set API automatically triggered an immediate driver reload on invocation; the CL
reloaded after the user explicitly requested the partition change. The API-level reload was
separated to give applications control over when the disruptive reload occurs. Additionally,
as of [**ROCm 7.13.0**](https://github.com/ROCm/rocm-systems/blob/develop/projects/amdsmi/CHANGELOG.md#amd_smi_lib-for-rocm-7130), `amd-smi reset -r` is no longer available for driver reloading — use
`sudo modprobe -r amdgpu && sudo modprobe amdgpu` or `amdsmi_gpu_driver_reload()` instead.
`sudo modprobe -r amdgpu && sudo modprobe amdgpu` instead.
```

## Workload isolation and assignment
Expand Down Expand Up @@ -695,7 +693,8 @@ int main() {

// Step 4: Reload the driver -- required to apply the memory partition change.
// Stop all GPU workloads first. The reload may reset the accelerator partition.
amdsmi_gpu_driver_reload();
// The reload needs to occur out of band via calls to `modprobe -r amdgpu` and
// then `modprobe amdgpu`

// Step 5: Re-initialize to pull in the updated topology (new device count/handles)
amdsmi_shut_down();
Expand Down Expand Up @@ -731,7 +730,6 @@ APIs, see
index (obtained from {c:func}`amdsmi_get_gpu_accelerator_partition_profile_config`).
- {c:func}`amdsmi_get_gpu_memory_partition_config` -- Query the current NPS mode and supported NPS modes.
- {c:func}`amdsmi_set_gpu_memory_partition_mode` -- Set the NPS memory partition mode.
- {c:func}`amdsmi_gpu_driver_reload` -- Reload the amdgpu driver to apply memory partition changes.

**Bare metal only:**
- {c:func}`amdsmi_get_gpu_compute_partition` -- Query the current compute partition setting as a string.
Expand Down Expand Up @@ -769,7 +767,8 @@ amdsmi.amdsmi_set_gpu_memory_partition_mode(gpu, amdsmi.AmdSmiMemoryPartitionTyp

# Step 4: Reload the driver -- required to apply the memory partition change.
# Stop all GPU workloads first. The reload may reset the accelerator partition.
amdsmi.amdsmi_gpu_driver_reload()
# The reload needs to occur out of band via calls to `modprobe -r amdgpu` and
# then `modprobe amdgpu`

# Step 5: Re-initialize to pull in the updated topology (new device count/handles)
amdsmi.amdsmi_shut_down()
Expand Down
Loading
Loading