Merge amd-dev into amd-master 20240531

Signed-off-by: Maisam Arif <Maisam.Arif@amd.com>
Change-Id: Ib9a365c295671771d3c806f4042482ee8875107d


[ROCm/amdsmi commit: c72b239dce]
This commit is contained in:
Maisam Arif
2024-05-31 03:06:49 -05:00
42 zmienionych plików z 1859 dodań i 1548 usunięć
+89 -28
Wyświetl plik
@@ -4,16 +4,104 @@ 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 6.1.2
## amd_smi_lib for ROCm 6.2.0
### Additions
- **Added Handling to detect VMs with passthrough configurations in CLI Tool**.
CLI Tool had only allowed a restricted set of options for Virtual Machines with passthrough GPUs. Now we offer an expanded set of functions availble to passthrough configured GPUs.
- **Added Process Isolation and Clear SRAM functionality to the CLI Tool for VMs**.
VMs now have the ability to set the process isolation and clear the sram from the CLI tool. Using the following commands
```shell
amd-smi set --process-isolation <0 or 1>
amd-smi reset --clear-sram-data
```
- **Added macros that were in `amdsmi.h` to the amdsmi Python library `amdsmi_interface.py`**.
Added macros to reference max size limitations for certain amdsmi functions such as max dpm policies and max fanspeed.
- **Added Ring Hang event**.
Added `AMDSMI_EVT_NOTIF_RING_HANG` to the possible events in the `amdsmi_evt_notification_type_t` enum.
### Optimizations
- **Updated `amdsmi_clk_info_t` struct in amdsmi.h and amdsmi_interface.py to align with host/guest**.
Changed cur_clk to clk, changed sleep_clk to clk_deep_sleep, and added clk_locked value. New struct will be in the following format:
```shell
typedef struct {
+ uint32_t clk;
uint32_t min_clk;
uint32_t max_clk;
+ uint8_t clk_locked;
+ uint8_t clk_deep_sleep;
uint32_t reserved[4];
} amdsmi_clk_info_t;
```
- **Multiple structure updates in amdsmi.h and amdsmi_interface.py to align with host/guest**.
Multiple structures used by APIs were changed for alignment unification:
- Changed `amdsmi_vram_info_t` `vram_size_mb` field changed to to `vram_size`
- Updated `amdsmi_vram_type_t` struct updated to include new enums and added `AMDSMI` prefix
- Updated `amdsmi_status_t` some enums were missing the `AMDSMI_STATUS` prefix
- Added `AMDSMI_PROCESSOR_TYPE` prefix to `processor_type_t` enums
- Removed the fields structure definition in favor for an anonymous definition in `amdsmi_bdf_t`
- **Added `AMDSMI` prefix in amdsmi.h and amdsmi_interface.py to align with host/guest**.
Multiple structures used by APIs were changed for alignment unification. `AMDSMI` prefix was added to the following structures:
- Added AMDSMI prefix to `amdsmi_container_types_t` enums
- Added AMDSMI prefix to `amdsmi_clk_type_t` enums
- Added AMDSMI prefix to `amdsmi_compute_partition_type_t` enums
- Added AMDSMI prefix to `amdsmi_memory_partition_type_t` enums
- Added AMDSMI prefix to `amdsmi_clk_type_t` enums
- Added AMDSMI prefix to `amdsmi_temperature_type_t` enums
- Added AMDSMI prefix to `amdsmi_fw_block_t` enums
- **Changed dpm_policy references to soc_pstate**.
The file structure referenced to dpm_policy changed to soc_pstate and we have changed the APIs and CLI tool to be inline with the current structure. `amdsmi_get_dpm_policy()` and `amdsmi_set_dpm_policy()` is no longer valid with the new API being `amdsmi_get_soc_pstate()` and `amdsmi_set_soc_pstate()`. The CLI tool has been changed from `--policy` to `--soc-pstate`
- **Updated `amdsmi_get_gpu_board_info()` product_name to fallback to pciids**.
Previously on devices without a FRU we would not populate the product name in the `amdsmi_board_info_t` structure, now we will fallback to using the name listed according to the pciids file if available.
- **Updated CLI voltage curve command output**.
The output for `amd-smi metric --voltage-curve` now splits the frequency and voltage output by curve point or outputs N/A if not applicable
```shell
GPU: 0
VOLTAGE_CURVE:
POINT_0_FREQUENCY: 872 Mhz
POINT_0_VOLTAGE: 736 mV
POINT_1_FREQUENCY: 1354 Mhz
POINT_1_VOLTAGE: 860 mV
POINT_2_FREQUENCY: 1837 Mhz
POINT_2_VOLTAGE: 1186 mV
```
- **Updated `amdsmi_get_gpu_board_info()` now has larger structure sizes for `amdsmi_board_info_t`**.
Updated sizes that work for retreiving relavant board information across AMD's
ASIC products. This requires users to update any ABIs using this structure.
### Fixes
- **`amdsmi_get_gpu_board_info()` no longer returns junk char strings**.
Previously if there was a partial failure to retrieve character strings, we would return
garbage output to users using the API. This fix intends to populate as many values as possible.
Then any failure(s) found along the way, `\0` is provided to `amdsmi_board_info_t`
structures data members which cannot be populated. Ensuring empty char string values.
- **Fixed parsing of `pp_od_clk_voltage` within `amdsmi_get_gpu_od_volt_info`**.
The parsing of `pp_od_clk_voltage` was not dynamic enough to work with the dropping of voltage curve support on MI series cards. This propagates down to correcting the CLI's output `amd-smi metric --voltage-curve` to N/A if voltage curve is not enabled.
### Known Issues
- N/A
## amd_smi_lib for ROCm 6.1.2
### Additions
- **Added process isolation and clean shader APIs and CLI commands**.
Added APIs CLI and APIs to address LeftoverLocals security issues. Allowing clearing the sram data and setting process isolation on a per GPU basis. New APIs:
- `amdsmi_get_gpu_process_isolation()`
@@ -61,24 +149,6 @@ GPU PCIE_BW
0 26 Mb/s
```
- **Updated CLI voltage curve command output**.
The output for `amd-smi metric --voltage-curve` now splits the frequency and voltage output by curve point or outputs N/A if not applicable
```shell
GPU: 0
VOLTAGE_CURVE:
POINT_0_FREQUENCY: 872 Mhz
POINT_0_VOLTAGE: 736 mV
POINT_1_FREQUENCY: 1354 Mhz
POINT_1_VOLTAGE: 860 mV
POINT_2_FREQUENCY: 1837 Mhz
POINT_2_VOLTAGE: 1186 mV
```
- **Updated `amdsmi_get_gpu_board_info()` now has larger structure sizes for `amdsmi_board_info_t`**.
Updated sizes that work for retreiving relavant board information across AMD's
ASIC products. This requires users to update any ABIs using this structure.
- **`amdsmi_get_power_cap_info` now returns values in uW instead of W**.
`amdsmi_get_power_cap_info` will return in uW as originally reflected by driver. Previously `amdsmi_get_power_cap_info` returned W values, this conflicts with our sets and modifies values retrieved from driver. We decided to keep the values returned from driver untouched (in original units, uW). Then in CLI we will convert to watts (as previously done - no changes here). Additionally, driver made updates to min power cap displayed for devices when overdrive is disabled which prompted for this change (in this case min_power_cap and max_power_cap are the same).
@@ -127,15 +197,6 @@ amdsmi_get_gpu_process_info was removed from the C library in an earlier build,
### Fixes
- **`amdsmi_get_gpu_board_info()` no longer returns junk char strings**.
Previously if there was a partial failure to retrieve character strings, we would return
garbage output to users using the API. This fix intends to populate as many values as possible.
Then any failure(s) found along the way, `\0` is provided to `amdsmi_board_info_t`
structures data members which cannot be populated. Ensuring empty char string values.
- **Fixed parsing of `pp_od_clk_voltage` within `amdsmi_get_gpu_od_volt_info`**.
The parsing of `pp_od_clk_voltage` was not dynamic enough to work with the dropping of voltage curve support on MI series cards. This propagates down to correcting the CLI's output `amd-smi metric --voltage-curve` to N/A if voltage curve is not enabled.
- **Fixed `amd-smi metric --power` now provides power output for Navi2x/Navi3x/MI1x**.
These systems use an older version of gpu_metrics in amdgpu. This fix only updates what CLI outputs.
No change in any of our APIs.
+1 -1
Wyświetl plik
@@ -28,7 +28,7 @@ find_program(GIT NAMES git)
## Setup the package version based on git tags.
set(PKG_VERSION_GIT_TAG_PREFIX "amdsmi_pkg_ver")
get_package_version_number("24.5.3" ${PKG_VERSION_GIT_TAG_PREFIX} GIT)
get_package_version_number("24.6.0" ${PKG_VERSION_GIT_TAG_PREFIX} GIT)
message("Package version: ${PKG_VERSION_STR}")
set(${AMD_SMI_LIBS_TARGET}_VERSION_MAJOR "${CPACK_PACKAGE_VERSION_MAJOR}")
set(${AMD_SMI_LIBS_TARGET}_VERSION_MINOR "${CPACK_PACKAGE_VERSION_MINOR}")
+6 -6
Wyświetl plik
@@ -154,11 +154,11 @@ int main() {
// For each device of the socket, get name and temperature.
for (uint32_t j=0; j < device_count; j++) {
// Get device type. Since the amdsmi is initialized with
// AMD_SMI_INIT_AMD_GPUS, the processor_type must be AMD_GPU.
// AMD_SMI_INIT_AMD_GPUS, the processor_type must be AMDSMI_PROCESSOR_TYPE_AMD_GPU.
processor_type_t processor_type;
ret = amdsmi_get_processor_type(processor_handles[j], &processor_type);
if (processor_type != AMD_GPU) {
std::cout << "Expect AMD_GPU device type!\n";
if (processor_type != AMDSMI_PROCESSOR_TYPE_AMD_GPU) {
std::cout << "Expect AMDSMI_PROCESSOR_TYPE_AMD_GPU device type!\n";
return 1;
}
@@ -170,7 +170,7 @@ int main() {
// Get temperature
int64_t val_i64 = 0;
ret = amdsmi_get_temp_metric(processor_handles[j], TEMPERATURE_TYPE_EDGE,
ret = amdsmi_get_temp_metric(processor_handles[j], AMDSMI_TEMPERATURE_TYPE_EDGE,
AMDSMI_TEMP_CURRENT, &val_i64);
std::cout << "\t\tTemperature: " << val_i64 << "C" << std::endl;
}
@@ -212,8 +212,8 @@ int main(int argc, char **argv) {
for (uint32_t i = 0; i < socket_count; i++) {
uint32_t cpu_count = 0;
// Set processor type as AMD_CPU
processor_type_t processor_type = AMD_CPU;
// Set processor type as AMDSMI_PROCESSOR_TYPE_AMD_CPU
processor_type_t processor_type = AMDSMI_PROCESSOR_TYPE_AMD_CPU;
ret = amdsmi_get_processor_handles_by_type(sockets[i], processor_type, nullptr, &cpu_count);
// Allocate the memory for the cpus
+327 -210
Wyświetl plik
@@ -79,7 +79,7 @@ amd-smi will report the version and current platform detected when running the c
~$ amd-smi
usage: amd-smi [-h] ...
AMD System Management Interface | Version: 24.5.3.0 | ROCm version: 6.1.2 | Platform: Linux Baremetal
AMD System Management Interface | Version: 24.6.0.0 | ROCm version: 6.2.0 | Platform: Linux Baremetal
options:
-h, --help show this help message and exit
@@ -109,7 +109,7 @@ Each command will have detailed information via `amd-smi [command] --help`
For convenience, here is the help output for each command
``` bash
```bash
~$ amd-smi list --help
usage: amd-smi list [-h] [--json | --csv] [--file FILE] [--loglevel LEVEL]
[-g GPU [GPU ...] | -U CPU [CPU ...] | -O CORE [CORE ...]]
@@ -123,10 +123,10 @@ GPU with some basic information for each VF.
options:
-h, --help show this help message and exit
-g, --gpu GPU [GPU ...] Select a GPU ID, BDF, or UUID from the possible choices:
ID: 0 | BDF: 0000:01:00.0 | UUID: 71ff74a0-0000-1000-8066-0a3c71d5f817
ID: 1 | BDF: 0001:01:00.0 | UUID: b4ff74a0-0000-1000-80b2-fa0be8628b1a
ID: 2 | BDF: 0002:01:00.0 | UUID: a9ff74a0-0000-1000-8007-3066a98ba4a6
ID: 3 | BDF: 0003:01:00.0 | UUID: 53ff74a0-0000-1000-80a0-a1ff3830f499
ID: 0 | BDF: 0000:01:00.0 | UUID: 7eff74a0-0000-1000-808f-7e20764e2714
ID: 1 | BDF: 0001:01:00.0 | UUID: b6ff74a0-0000-1000-80ae-7c8cefe1f084
ID: 2 | BDF: 0002:01:00.0 | UUID: 36ff74a0-0000-1000-8071-25d815189854
ID: 3 | BDF: 0003:01:00.0 | UUID: f4ff74a0-0000-1000-80c4-4c2be5e66537
all | Selects all devices
-U, --cpu CPU [CPU ...] Select a CPU ID from the possible choices:
ID: 0
@@ -148,9 +148,9 @@ Command Modifiers:
```bash
~$ amd-smi static --help
usage: amd-smi static [-h] [-g GPU [GPU ...]] [-a] [-b] [-V] [-d] [-v] [-c] [-B] [-r] [-p]
[-l] [-P] [-x] [-s] [-u] [--json | --csv] [--file FILE]
[--loglevel LEVEL]
usage: amd-smi static [-h] [-g GPU [GPU ...] | -U CPU [CPU ...]] [-a] [-b] [-V] [-d] [-v]
[-c] [-B] [-R] [-r] [-p] [-l] [-P] [-x] [-u] [-s] [-i]
[--json | --csv] [--file FILE] [--loglevel LEVEL]
If no GPU is specified, returns static information for all GPUs on the system.
If no static argument is provided, all static information will be displayed.
@@ -158,10 +158,10 @@ If no static argument is provided, all static information will be displayed.
Static Arguments:
-h, --help show this help message and exit
-g, --gpu GPU [GPU ...] Select a GPU ID, BDF, or UUID from the possible choices:
ID: 0 | BDF: 0000:01:00.0 | UUID: 71ff74a0-0000-1000-8066-0a3c71d5f817
ID: 1 | BDF: 0001:01:00.0 | UUID: b4ff74a0-0000-1000-80b2-fa0be8628b1a
ID: 2 | BDF: 0002:01:00.0 | UUID: a9ff74a0-0000-1000-8007-3066a98ba4a6
ID: 3 | BDF: 0003:01:00.0 | UUID: 53ff74a0-0000-1000-80a0-a1ff3830f499
ID: 0 | BDF: 0000:01:00.0 | UUID: 7eff74a0-0000-1000-808f-7e20764e2714
ID: 1 | BDF: 0001:01:00.0 | UUID: b6ff74a0-0000-1000-80ae-7c8cefe1f084
ID: 2 | BDF: 0002:01:00.0 | UUID: 36ff74a0-0000-1000-8071-25d815189854
ID: 3 | BDF: 0003:01:00.0 | UUID: f4ff74a0-0000-1000-80c4-4c2be5e66537
all | Selects all devices
-U, --cpu CPU [CPU ...] Select a CPU ID from the possible choices:
ID: 0
@@ -176,10 +176,12 @@ Static Arguments:
-v, --vram All vram information
-c, --cache All cache information
-B, --board All board information
-R, --process-isolation The process isolation status
-r, --ras Displays RAS features information
-p, --partition Partition information
-l, --limit All limit metric values (i.e. power and thermal limits)
-s, --process-isolation The process isolation status
-P, --policy The available DPM policy
-x, --xgmi-plpd The available XGMI per-link power down policy
-u, --numa All numa node information
CPU Arguments:
@@ -194,7 +196,7 @@ Command Modifiers:
DEBUG, INFO, WARNING, ERROR, CRITICAL
```
``` bash
```bash
~$ amd-smi firmware --help
usage: amd-smi firmware [-h] [--json | --csv] [--file FILE] [--loglevel LEVEL]
[-g GPU [GPU ...] | -U CPU [CPU ...] | -O CORE [CORE ...]] [-f]
@@ -204,10 +206,10 @@ If no GPU is specified, return firmware information for all GPUs on the system.
Firmware Arguments:
-h, --help show this help message and exit
-g, --gpu GPU [GPU ...] Select a GPU ID, BDF, or UUID from the possible choices:
ID: 0 | BDF: 0000:01:00.0 | UUID: 71ff74a0-0000-1000-8066-0a3c71d5f817
ID: 1 | BDF: 0001:01:00.0 | UUID: b4ff74a0-0000-1000-80b2-fa0be8628b1a
ID: 2 | BDF: 0002:01:00.0 | UUID: a9ff74a0-0000-1000-8007-3066a98ba4a6
ID: 3 | BDF: 0003:01:00.0 | UUID: 53ff74a0-0000-1000-80a0-a1ff3830f499
ID: 0 | BDF: 0000:01:00.0 | UUID: 7eff74a0-0000-1000-808f-7e20764e2714
ID: 1 | BDF: 0001:01:00.0 | UUID: b6ff74a0-0000-1000-80ae-7c8cefe1f084
ID: 2 | BDF: 0002:01:00.0 | UUID: 36ff74a0-0000-1000-8071-25d815189854
ID: 3 | BDF: 0003:01:00.0 | UUID: f4ff74a0-0000-1000-80c4-4c2be5e66537
all | Selects all devices
-U, --cpu CPU [CPU ...] Select a CPU ID from the possible choices:
ID: 0
@@ -239,10 +241,10 @@ If no GPU is specified, return bad page information for all GPUs on the system.
Bad Pages Arguments:
-h, --help show this help message and exit
-g, --gpu GPU [GPU ...] Select a GPU ID, BDF, or UUID from the possible choices:
ID: 0 | BDF: 0000:01:00.0 | UUID: 71ff74a0-0000-1000-8066-0a3c71d5f817
ID: 1 | BDF: 0001:01:00.0 | UUID: b4ff74a0-0000-1000-80b2-fa0be8628b1a
ID: 2 | BDF: 0002:01:00.0 | UUID: a9ff74a0-0000-1000-8007-3066a98ba4a6
ID: 3 | BDF: 0003:01:00.0 | UUID: 53ff74a0-0000-1000-80a0-a1ff3830f499
ID: 0 | BDF: 0000:01:00.0 | UUID: 7eff74a0-0000-1000-808f-7e20764e2714
ID: 1 | BDF: 0001:01:00.0 | UUID: b6ff74a0-0000-1000-80ae-7c8cefe1f084
ID: 2 | BDF: 0002:01:00.0 | UUID: 36ff74a0-0000-1000-8071-25d815189854
ID: 3 | BDF: 0003:01:00.0 | UUID: f4ff74a0-0000-1000-80c4-4c2be5e66537
all | Selects all devices
-U, --cpu CPU [CPU ...] Select a CPU ID from the possible choices:
ID: 0
@@ -287,12 +289,12 @@ If no metric argument is provided all metric information will be displayed.
Metric arguments:
-h, --help show this help message and exit
-g, --gpu GPU [GPU ...] Select a GPU ID, BDF, or UUID from the possible choices:
ID: 0 | BDF: 0000:01:00.0 | UUID: 71ff74a0-0000-1000-8066-0a3c71d5f817
ID: 1 | BDF: 0001:01:00.0 | UUID: b4ff74a0-0000-1000-80b2-fa0be8628b1a
ID: 2 | BDF: 0002:01:00.0 | UUID: a9ff74a0-0000-1000-8007-3066a98ba4a6
ID: 3 | BDF: 0003:01:00.0 | UUID: 53ff74a0-0000-1000-80a0-a1ff3830f499
ID: 0 | BDF: 0000:01:00.0 | UUID: 7eff74a0-0000-1000-808f-7e20764e2714
ID: 1 | BDF: 0001:01:00.0 | UUID: b6ff74a0-0000-1000-80ae-7c8cefe1f084
ID: 2 | BDF: 0002:01:00.0 | UUID: 36ff74a0-0000-1000-8071-25d815189854
ID: 3 | BDF: 0003:01:00.0 | UUID: f4ff74a0-0000-1000-80c4-4c2be5e66537
all | Selects all devices
-U, --cpu CPU [CPU ...] Select a CPU ID from the possible choices:
-U, --cpu CPU [CPU ...] Select a CPU ID from the possible choices:
ID: 0
ID: 1
ID: 2
@@ -368,10 +370,10 @@ If no process argument is provided all process information will be displayed.
Process arguments:
-h, --help show this help message and exit
-g, --gpu GPU [GPU ...] Select a GPU ID, BDF, or UUID from the possible choices:
ID: 0 | BDF: 0000:01:00.0 | UUID: 71ff74a0-0000-1000-8066-0a3c71d5f817
ID: 1 | BDF: 0001:01:00.0 | UUID: b4ff74a0-0000-1000-80b2-fa0be8628b1a
ID: 2 | BDF: 0002:01:00.0 | UUID: a9ff74a0-0000-1000-8007-3066a98ba4a6
ID: 3 | BDF: 0003:01:00.0 | UUID: 53ff74a0-0000-1000-80a0-a1ff3830f499
ID: 0 | BDF: 0000:01:00.0 | UUID: 7eff74a0-0000-1000-808f-7e20764e2714
ID: 1 | BDF: 0001:01:00.0 | UUID: b6ff74a0-0000-1000-80ae-7c8cefe1f084
ID: 2 | BDF: 0002:01:00.0 | UUID: 36ff74a0-0000-1000-8071-25d815189854
ID: 3 | BDF: 0003:01:00.0 | UUID: f4ff74a0-0000-1000-80c4-4c2be5e66537
all | Selects all devices
-U, --cpu CPU [CPU ...] Select a CPU ID from the possible choices:
ID: 0
@@ -409,10 +411,10 @@ If no GPU is specified, returns event information for all GPUs on the system.
Event Arguments:
-h, --help show this help message and exit
-g, --gpu GPU [GPU ...] Select a GPU ID, BDF, or UUID from the possible choices:
ID: 0 | BDF: 0000:01:00.0 | UUID: 71ff74a0-0000-1000-8066-0a3c71d5f817
ID: 1 | BDF: 0001:01:00.0 | UUID: b4ff74a0-0000-1000-80b2-fa0be8628b1a
ID: 2 | BDF: 0002:01:00.0 | UUID: a9ff74a0-0000-1000-8007-3066a98ba4a6
ID: 3 | BDF: 0003:01:00.0 | UUID: 53ff74a0-0000-1000-80a0-a1ff3830f499
ID: 0 | BDF: 0000:01:00.0 | UUID: 7eff74a0-0000-1000-808f-7e20764e2714
ID: 1 | BDF: 0001:01:00.0 | UUID: b6ff74a0-0000-1000-80ae-7c8cefe1f084
ID: 2 | BDF: 0002:01:00.0 | UUID: 36ff74a0-0000-1000-8071-25d815189854
ID: 3 | BDF: 0003:01:00.0 | UUID: f4ff74a0-0000-1000-80c4-4c2be5e66537
all | Selects all devices
-U, --cpu CPU [CPU ...] Select a CPU ID from the possible choices:
ID: 0
@@ -444,10 +446,10 @@ If no topology argument is provided all topology information will be displayed.
Topology arguments:
-h, --help show this help message and exit
-g, --gpu GPU [GPU ...] Select a GPU ID, BDF, or UUID from the possible choices:
ID: 0 | BDF: 0000:01:00.0 | UUID: 71ff74a0-0000-1000-8066-0a3c71d5f817
ID: 1 | BDF: 0001:01:00.0 | UUID: b4ff74a0-0000-1000-80b2-fa0be8628b1a
ID: 2 | BDF: 0002:01:00.0 | UUID: a9ff74a0-0000-1000-8007-3066a98ba4a6
ID: 3 | BDF: 0003:01:00.0 | UUID: 53ff74a0-0000-1000-80a0-a1ff3830f499
ID: 0 | BDF: 0000:01:00.0 | UUID: 7eff74a0-0000-1000-808f-7e20764e2714
ID: 1 | BDF: 0001:01:00.0 | UUID: b6ff74a0-0000-1000-80ae-7c8cefe1f084
ID: 2 | BDF: 0002:01:00.0 | UUID: 36ff74a0-0000-1000-8071-25d815189854
ID: 3 | BDF: 0003:01:00.0 | UUID: f4ff74a0-0000-1000-80c4-4c2be5e66537
all | Selects all devices
-U, --cpu CPU [CPU ...] Select a CPU ID from the possible choices:
ID: 0
@@ -473,15 +475,16 @@ Command Modifiers:
```
```bash
~$ amd-smi set --help
usage: amd-smi set [-h] (-g GPU [GPU ...] | -U CPU [CPU ...] | -O CORE [CORE ...]) [-f %]
[-l LEVEL] [-P SETPROFILE] [-d SCLKMAX] [-C PARTITION] [-M PARTITION]
[-o WATTS] [-p POLICY] [-i STATUS] [--cpu-pwr-limit PWR_LIMIT]
[--cpu-xgmi-link-width MIN_WIDTH MAX_WIDTH]
[-o WATTS] [-p POLICY_ID] [-x POLICY_ID] [-R STATUS]
[--cpu-pwr-limit PWR_LIMIT] [--cpu-xgmi-link-width MIN_WIDTH MAX_WIDTH]
[--cpu-lclk-dpm-level NBIOID MIN_DPM MAX_DPM] [--cpu-pwr-eff-mode MODE]
[--cpu-gmi3-link-width MIN_LW MAX_LW] [--cpu-pcie-link-rate LINK_RATE]
[--cpu-df-pstate-range MAX_PSTATE MIN_PSTATE] [--cpu-enable-apb]
[--cpu-disable-apb DF_PSTATE] [--soc-boost-limit BOOST_LIMIT]
[--core-boost-limit BOOST_LIMIT] [-c] [--json | --csv] [--file FILE]
[--core-boost-limit BOOST_LIMIT] [--json | --csv] [--file FILE]
[--loglevel LEVEL]
A GPU must be specified to set a configuration.
@@ -490,10 +493,10 @@ A set argument must be provided; Multiple set arguments are accepted
Set Arguments:
-h, --help show this help message and exit
-g, --gpu GPU [GPU ...] Select a GPU ID, BDF, or UUID from the possible choices:
ID: 0 | BDF: 0000:01:00.0 | UUID: 71ff74a0-0000-1000-8066-0a3c71d5f817
ID: 1 | BDF: 0001:01:00.0 | UUID: b4ff74a0-0000-1000-80b2-fa0be8628b1a
ID: 2 | BDF: 0002:01:00.0 | UUID: a9ff74a0-0000-1000-8007-3066a98ba4a6
ID: 3 | BDF: 0003:01:00.0 | UUID: 53ff74a0-0000-1000-80a0-a1ff3830f499
ID: 0 | BDF: 0000:01:00.0 | UUID: 7eff74a0-0000-1000-808f-7e20764e2714
ID: 1 | BDF: 0001:01:00.0 | UUID: b6ff74a0-0000-1000-80ae-7c8cefe1f084
ID: 2 | BDF: 0002:01:00.0 | UUID: 36ff74a0-0000-1000-8071-25d815189854
ID: 3 | BDF: 0003:01:00.0 | UUID: f4ff74a0-0000-1000-80c4-4c2be5e66537
all | Selects all devices
-U, --cpu CPU [CPU ...] Select a CPU ID from the possible choices:
ID: 0
@@ -515,8 +518,7 @@ Set Arguments:
-o, --power-cap WATTS Set power capacity limit
-p, --dpm-policy POLICY_ID Set the GPU DPM policy using policy id
-x, --xgmi-plpd POLICY_ID Set the GPU XGMI per-link power down policy using policy id
-i, --process-isolation STATUS Enable or disable the GPU process isolation: 0 for disable and 1 for enable.
-c, --clear-sram-data Clear the GPU SRAM data
-R, --process-isolation STATUS Enable or disable the GPU process isolation: 0 for disable and 1 for enable.
CPU Arguments:
--cpu-pwr-limit PWR_LIMIT Set power limit for the given socket. Input parameter is power limit value.
@@ -546,7 +548,7 @@ Command Modifiers:
~$ amd-smi reset --help
usage: amd-smi reset [-h] [--json | --csv] [--file FILE] [--loglevel LEVEL]
(-g GPU [GPU ...] | -U CPU [CPU ...] | -O CORE [CORE ...]) [-G] [-c]
[-f] [-p] [-x] [-d] [-C] [-M] [-o]
[-f] [-p] [-x] [-d] [-C] [-M] [-o] [-l]
A GPU must be specified to reset a configuration.
A reset argument must be provided; Multiple reset arguments are accepted
@@ -554,10 +556,10 @@ A reset argument must be provided; Multiple reset arguments are accepted
Reset Arguments:
-h, --help show this help message and exit
-g, --gpu GPU [GPU ...] Select a GPU ID, BDF, or UUID from the possible choices:
ID: 0 | BDF: 0000:01:00.0 | UUID: 71ff74a0-0000-1000-8066-0a3c71d5f817
ID: 1 | BDF: 0001:01:00.0 | UUID: b4ff74a0-0000-1000-80b2-fa0be8628b1a
ID: 2 | BDF: 0002:01:00.0 | UUID: a9ff74a0-0000-1000-8007-3066a98ba4a6
ID: 3 | BDF: 0003:01:00.0 | UUID: 53ff74a0-0000-1000-80a0-a1ff3830f499
ID: 0 | BDF: 0000:01:00.0 | UUID: 7eff74a0-0000-1000-808f-7e20764e2714
ID: 1 | BDF: 0001:01:00.0 | UUID: b6ff74a0-0000-1000-80ae-7c8cefe1f084
ID: 2 | BDF: 0002:01:00.0 | UUID: 36ff74a0-0000-1000-8071-25d815189854
ID: 3 | BDF: 0003:01:00.0 | UUID: f4ff74a0-0000-1000-80c4-4c2be5e66537
all | Selects all devices
-U, --cpu CPU [CPU ...] Select a CPU ID from the possible choices:
ID: 0
@@ -577,6 +579,92 @@ Reset Arguments:
-C, --compute-partition Reset compute partitions on the specified GPU
-M, --memory-partition Reset memory partitions on the specified GPU
-o, --power-cap Reset power capacity limit to max capable
-l, --clear-sram-data Clear the GPU SRAM data
Command Modifiers:
--json Displays output in JSON format (human readable by default).
--csv Displays output in CSV format (human readable by default).
--file FILE Saves output into a file on the provided path (stdout by default).
--loglevel LEVEL Set the logging level from the possible choices:
DEBUG, INFO, WARNING, ERROR, CRITICAL
```
```bash
~$ amd-smi monitor --help
usage: amd-smi monitor [-h] [--json | --csv] [--file FILE] [--loglevel LEVEL]
[-g GPU [GPU ...] | -U CPU [CPU ...] | -O CORE [CORE ...]]
[-w INTERVAL] [-W TIME] [-i ITERATIONS] [-p] [-t] [-u] [-m] [-n]
[-d] [-s] [-e] [-v] [-r]
Monitor a target device for the specified arguments.
If no arguments are provided, all arguments will be enabled.
Use the watch arguments to run continuously
Monitor Arguments:
-h, --help show this help message and exit
-g, --gpu GPU [GPU ...] Select a GPU ID, BDF, or UUID from the possible choices:
ID: 0 | BDF: 0000:01:00.0 | UUID: 7eff74a0-0000-1000-808f-7e20764e2714
ID: 1 | BDF: 0001:01:00.0 | UUID: b6ff74a0-0000-1000-80ae-7c8cefe1f084
ID: 2 | BDF: 0002:01:00.0 | UUID: 36ff74a0-0000-1000-8071-25d815189854
ID: 3 | BDF: 0003:01:00.0 | UUID: f4ff74a0-0000-1000-80c4-4c2be5e66537
all | Selects all devices
-U, --cpu CPU [CPU ...] Select a CPU ID from the possible choices:
ID: 0
ID: 1
ID: 2
ID: 3
all | Selects all devices
-O, --core CORE [CORE ...] Select a Core ID from the possible choices:
ID: 0 - 95
all | Selects all devices
-w, --watch INTERVAL Reprint the command in a loop of INTERVAL seconds
-W, --watch_time TIME The total TIME to watch the given command
-i, --iterations ITERATIONS Total number of ITERATIONS to loop on the given command
-p, --power-usage Monitor power usage in Watts
-t, --temperature Monitor temperature in Celsius
-u, --gfx Monitor graphics utilization (%) and clock (MHz)
-m, --mem Monitor memory utilization (%) and clock (MHz)
-n, --encoder Monitor encoder utilization (%) and clock (MHz)
-d, --decoder Monitor decoder utilization (%) and clock (MHz)
-s, --throttle-status Monitor thermal throttle status
-e, --ecc Monitor ECC single bit, ECC double bit, and PCIe replay error counts
-v, --vram-usage Monitor memory usage in MB
-r, --pcie Monitor PCIe bandwidth in Mb/s
Command Modifiers:
--json Displays output in JSON format (human readable by default).
--csv Displays output in CSV format (human readable by default).
--file FILE Saves output into a file on the provided path (stdout by default).
--loglevel LEVEL Set the logging level from the possible choices:
DEBUG, INFO, WARNING, ERROR, CRITICAL
```
```bash
~$ amd-smi xgmi --help
usage: amd-smi xgmi [-h] [--json | --csv] [--file FILE] [--loglevel LEVEL]
[-g GPU [GPU ...] | -U CPU [CPU ...] | -O CORE [CORE ...]] [-m]
If no GPU is specified, returns information for all GPUs on the system.
If no xgmi argument is provided all xgmi information will be displayed.
XGMI arguments:
-h, --help show this help message and exit
-g, --gpu GPU [GPU ...] Select a GPU ID, BDF, or UUID from the possible choices:
ID: 0 | BDF: 0000:01:00.0 | UUID: 7eff74a0-0000-1000-808f-7e20764e2714
ID: 1 | BDF: 0001:01:00.0 | UUID: b6ff74a0-0000-1000-80ae-7c8cefe1f084
ID: 2 | BDF: 0002:01:00.0 | UUID: 36ff74a0-0000-1000-8071-25d815189854
ID: 3 | BDF: 0003:01:00.0 | UUID: f4ff74a0-0000-1000-80c4-4c2be5e66537
all | Selects all devices
-U, --cpu CPU [CPU ...] Select a CPU ID from the possible choices:
ID: 0
ID: 1
ID: 2
ID: 3
all | Selects all devices
-O, --core CORE [CORE ...] Select a Core ID from the possible choices:
ID: 0 - 95
all | Selects all devices
-m, --metric Metric XGMI information
Command Modifiers:
--json Displays output in JSON format (human readable by default).
@@ -593,28 +681,29 @@ Here is some example output from the tool:
```bash
~$ amd-smi static
CPU: 0
SMU:
FW_VERSION: 85:81:0
INTERFACE_VERSION:
PROTO VERSION: 6
SMU:
FW_VERSION: 85.90.0
INTERFACE_VERSION:
PROTO VERSION: 6
CPU: 1
SMU:
FW_VERSION: 85:81:0
INTERFACE_VERSION:
PROTO VERSION: 6
SMU:
FW_VERSION: 85.90.0
INTERFACE_VERSION:
PROTO VERSION: 6
CPU: 2
SMU:
FW_VERSION: 85:81:0
INTERFACE_VERSION:
PROTO VERSION: 6
SMU:
FW_VERSION: 85.90.0
INTERFACE_VERSION:
PROTO VERSION: 6
CPU: 3
SMU:
FW_VERSION: 85:81:0
INTERFACE_VERSION:
PROTO VERSION: 6
SMU:
FW_VERSION: 85.90.0
INTERFACE_VERSION:
PROTO VERSION: 6
GPU: 0
ASIC:
@@ -623,8 +712,8 @@ GPU: 0
VENDOR_NAME: Advanced Micro Devices Inc. [AMD/ATI]
SUBVENDOR_ID: 0x1002
DEVICE_ID: 0x74a0
REV_ID: 0x0
ASIC_SERIAL: 0x71660A3C71D5F817
REV_ID: 0x00
ASIC_SERIAL: 0x7E8F7E20764E2714
OAM_ID: 0
BUS:
BDF: 0000:01:00.0
@@ -636,25 +725,26 @@ GPU: 0
NAME: N/A
BUILD_DATE: N/A
PART_NUMBER: N/A
VERSION: N/A
VERSION: N/A
LIMIT:
MAX_POWER: 550 W
MIN_POWER: 0 W
SOCKET_POWER: 550 W
SLOWDOWN_EDGE_TEMPERATURE: N/A
SLOWDOWN_HOTSPOT_TEMPERATURE: 100 °C
SLOWDOWN_VRAM_TEMPERATURE: 95 °C
SLOWDOWN_VRAM_TEMPERATURE: 105 °C
SHUTDOWN_EDGE_TEMPERATURE: N/A
SHUTDOWN_HOTSPOT_TEMPERATURE: 110 °C
SHUTDOWN_VRAM_TEMPERATURE: 105 °C
SHUTDOWN_VRAM_TEMPERATURE: 115 °C
DRIVER:
NAME: amdgpu
VERSION: 6.7.0
VERSION: 6.9.0-rc5+
BOARD:
MODEL_NUMBER: N/A
PRODUCT_SERIAL: N/A
FRU_ID: N/A
PRODUCT_NAME: N/A
MANUFACTURER_NAME: N/A
PRODUCT_NAME: Aqua Vanjaram [Instinct MI300A]
MANUFACTURER_NAME: Advanced Micro Devices, Inc. [AMD/ATI]
RAS:
EEPROM_VERSION: 0x0
PARITY_SCHEMA: DISABLED
@@ -676,10 +766,15 @@ GPU: 0
MP0: DISABLED
MP1: DISABLED
FUSE: DISABLED
MCA: DISABLED
VCN: DISABLED
JPEG: DISABLED
IH: DISABLED
MPIO: DISABLED
PARTITION:
COMPUTE_PARTITION: SPX
MEMORY_PARTITION: NPS1
DPM_POLICY:
SOC_PSTATE:
NUM_SUPPORTED: 4
CURRENT_ID: 1
POLICIES:
@@ -701,38 +796,39 @@ GPU: 0
POLICY_DESCRIPTION: plpd_default
POLICY_ID: 2
POLICY_DESCRIPTION: plpd_optimized
PROCESS_ISOLATION: N/A
NUMA:
NODE: 0
AFFINITY: 0
VRAM:
TYPE: HBM
VENDOR: N/A
SIZE: 96432 MB
CACHE_INFO:
CACHE_0:
CACHE_PROPERTIES: DATA_CACHE, SIMD_CACHE
CACHE_SIZE: 32 KB
CACHE_LEVEL: 1
MAX_NUM_CU_SHARED: 2
NUM_CACHE_INSTANCE: 464
CACHE_1:
CACHE_PROPERTIES: INST_CACHE, SIMD_CACHE
CACHE_SIZE: 64 KB
CACHE_LEVEL: 1
MAX_NUM_CU_SHARED: 2
NUM_CACHE_INSTANCE: 160
CACHE_2:
CACHE_PROPERTIES: DATA_CACHE, SIMD_CACHE
CACHE_SIZE: 32768 KB
CACHE_LEVEL: 2
MAX_NUM_CU_SHARED: 304
NUM_CACHE_INSTANCE: 1
CACHE_3:
CACHE_PROPERTIES: DATA_CACHE, SIMD_CACHE
CACHE_SIZE: 262144 KB
CACHE_LEVEL: 3
MAX_NUM_CU_SHARED: 304
NUM_CACHE_INSTANCE: 1
SIZE: 64289 MB
CACHE_INFO:
CACHE_0:
CACHE_PROPERTIES: DATA_CACHE, SIMD_CACHE
CACHE_SIZE: 32 KB
CACHE_LEVEL: 1
MAX_NUM_CU_SHARED: 2
NUM_CACHE_INSTANCE: 348
CACHE_1:
CACHE_PROPERTIES: INST_CACHE, SIMD_CACHE
CACHE_SIZE: 64 KB
CACHE_LEVEL: 1
MAX_NUM_CU_SHARED: 2
NUM_CACHE_INSTANCE: 120
CACHE_2:
CACHE_PROPERTIES: DATA_CACHE, SIMD_CACHE
CACHE_SIZE: 4096 KB
CACHE_LEVEL: 2
MAX_NUM_CU_SHARED: 228
NUM_CACHE_INSTANCE: 1
CACHE_3:
CACHE_PROPERTIES: DATA_CACHE, SIMD_CACHE
CACHE_SIZE: 262144 KB
CACHE_LEVEL: 3
MAX_NUM_CU_SHARED: 228
NUM_CACHE_INSTANCE: 1
GPU: 1
ASIC:
@@ -741,8 +837,8 @@ GPU: 1
VENDOR_NAME: Advanced Micro Devices Inc. [AMD/ATI]
SUBVENDOR_ID: 0x1002
DEVICE_ID: 0x74a0
REV_ID: 0x0
ASIC_SERIAL: 0xB4B2FA0BE8628B1A
REV_ID: 0x00
ASIC_SERIAL: 0xB6AE7C8CEFE1F084
OAM_ID: 1
BUS:
BDF: 0001:01:00.0
@@ -754,25 +850,26 @@ GPU: 1
NAME: N/A
BUILD_DATE: N/A
PART_NUMBER: N/A
VERSION: N/A
VERSION: N/A
LIMIT:
MAX_POWER: 550 W
MIN_POWER: 0 W
SOCKET_POWER: 550 W
SLOWDOWN_EDGE_TEMPERATURE: N/A
SLOWDOWN_HOTSPOT_TEMPERATURE: 100 °C
SLOWDOWN_VRAM_TEMPERATURE: 95 °C
SLOWDOWN_VRAM_TEMPERATURE: 105 °C
SHUTDOWN_EDGE_TEMPERATURE: N/A
SHUTDOWN_HOTSPOT_TEMPERATURE: 110 °C
SHUTDOWN_VRAM_TEMPERATURE: 105 °C
SHUTDOWN_VRAM_TEMPERATURE: 115 °C
DRIVER:
NAME: amdgpu
VERSION: 6.7.0
VERSION: 6.9.0-rc5+
BOARD:
MODEL_NUMBER: N/A
PRODUCT_SERIAL: N/A
FRU_ID: N/A
PRODUCT_NAME: N/A
MANUFACTURER_NAME: N/A
PRODUCT_NAME: Aqua Vanjaram [Instinct MI300A]
MANUFACTURER_NAME: Advanced Micro Devices, Inc. [AMD/ATI]
RAS:
EEPROM_VERSION: 0x0
PARITY_SCHEMA: DISABLED
@@ -794,10 +891,15 @@ GPU: 1
MP0: DISABLED
MP1: DISABLED
FUSE: DISABLED
MCA: DISABLED
VCN: DISABLED
JPEG: DISABLED
IH: DISABLED
MPIO: DISABLED
PARTITION:
COMPUTE_PARTITION: SPX
MEMORY_PARTITION: NPS1
DPM_POLICY:
SOC_PSTATE:
NUM_SUPPORTED: 4
CURRENT_ID: 1
POLICIES:
@@ -819,38 +921,39 @@ GPU: 1
POLICY_DESCRIPTION: plpd_default
POLICY_ID: 2
POLICY_DESCRIPTION: plpd_optimized
PROCESS_ISOLATION: N/A
NUMA:
NODE: 1
AFFINITY: 1
VRAM:
TYPE: HBM
VENDOR: N/A
SIZE: 96432 MB
CACHE_INFO:
CACHE_0:
CACHE_PROPERTIES: DATA_CACHE, SIMD_CACHE
CACHE_SIZE: 32 KB
CACHE_LEVEL: 1
MAX_NUM_CU_SHARED: 2
NUM_CACHE_INSTANCE: 464
CACHE_1:
CACHE_PROPERTIES: INST_CACHE, SIMD_CACHE
CACHE_SIZE: 64 KB
CACHE_LEVEL: 1
MAX_NUM_CU_SHARED: 2
NUM_CACHE_INSTANCE: 160
CACHE_2:
CACHE_PROPERTIES: DATA_CACHE, SIMD_CACHE
CACHE_SIZE: 32768 KB
CACHE_LEVEL: 2
MAX_NUM_CU_SHARED: 304
NUM_CACHE_INSTANCE: 1
CACHE_3:
CACHE_PROPERTIES: DATA_CACHE, SIMD_CACHE
CACHE_SIZE: 262144 KB
CACHE_LEVEL: 3
MAX_NUM_CU_SHARED: 304
NUM_CACHE_INSTANCE: 1
SIZE: 64289 MB
CACHE_INFO:
CACHE_0:
CACHE_PROPERTIES: DATA_CACHE, SIMD_CACHE
CACHE_SIZE: 32 KB
CACHE_LEVEL: 1
MAX_NUM_CU_SHARED: 2
NUM_CACHE_INSTANCE: 348
CACHE_1:
CACHE_PROPERTIES: INST_CACHE, SIMD_CACHE
CACHE_SIZE: 64 KB
CACHE_LEVEL: 1
MAX_NUM_CU_SHARED: 2
NUM_CACHE_INSTANCE: 120
CACHE_2:
CACHE_PROPERTIES: DATA_CACHE, SIMD_CACHE
CACHE_SIZE: 4096 KB
CACHE_LEVEL: 2
MAX_NUM_CU_SHARED: 228
NUM_CACHE_INSTANCE: 1
CACHE_3:
CACHE_PROPERTIES: DATA_CACHE, SIMD_CACHE
CACHE_SIZE: 262144 KB
CACHE_LEVEL: 3
MAX_NUM_CU_SHARED: 228
NUM_CACHE_INSTANCE: 1
GPU: 2
ASIC:
@@ -859,8 +962,8 @@ GPU: 2
VENDOR_NAME: Advanced Micro Devices Inc. [AMD/ATI]
SUBVENDOR_ID: 0x1002
DEVICE_ID: 0x74a0
REV_ID: 0x0
ASIC_SERIAL: 0xA9073066A98BA4A6
REV_ID: 0x00
ASIC_SERIAL: 0x367125D815189854
OAM_ID: 2
BUS:
BDF: 0002:01:00.0
@@ -872,25 +975,26 @@ GPU: 2
NAME: N/A
BUILD_DATE: N/A
PART_NUMBER: N/A
VERSION: N/A
VERSION: N/A
LIMIT:
MAX_POWER: 550 W
MIN_POWER: 0 W
SOCKET_POWER: 550 W
SLOWDOWN_EDGE_TEMPERATURE: N/A
SLOWDOWN_HOTSPOT_TEMPERATURE: 100 °C
SLOWDOWN_VRAM_TEMPERATURE: 95 °C
SLOWDOWN_VRAM_TEMPERATURE: 105 °C
SHUTDOWN_EDGE_TEMPERATURE: N/A
SHUTDOWN_HOTSPOT_TEMPERATURE: 110 °C
SHUTDOWN_VRAM_TEMPERATURE: 105 °C
SHUTDOWN_VRAM_TEMPERATURE: 115 °C
DRIVER:
NAME: amdgpu
VERSION: 6.7.0
VERSION: 6.9.0-rc5+
BOARD:
MODEL_NUMBER: N/A
PRODUCT_SERIAL: N/A
FRU_ID: N/A
PRODUCT_NAME: N/A
MANUFACTURER_NAME: N/A
PRODUCT_NAME: Aqua Vanjaram [Instinct MI300A]
MANUFACTURER_NAME: Advanced Micro Devices, Inc. [AMD/ATI]
RAS:
EEPROM_VERSION: 0x0
PARITY_SCHEMA: DISABLED
@@ -912,10 +1016,15 @@ GPU: 2
MP0: DISABLED
MP1: DISABLED
FUSE: DISABLED
MCA: DISABLED
VCN: DISABLED
JPEG: DISABLED
IH: DISABLED
MPIO: DISABLED
PARTITION:
COMPUTE_PARTITION: SPX
MEMORY_PARTITION: NPS1
DPM_POLICY:
SOC_PSTATE:
NUM_SUPPORTED: 4
CURRENT_ID: 1
POLICIES:
@@ -937,38 +1046,39 @@ GPU: 2
POLICY_DESCRIPTION: plpd_default
POLICY_ID: 2
POLICY_DESCRIPTION: plpd_optimized
PROCESS_ISOLATION: N/A
NUMA:
NODE: 2
AFFINITY: 2
VRAM:
TYPE: HBM
VENDOR: N/A
SIZE: 96432 MB
CACHE_INFO:
CACHE_0:
CACHE_PROPERTIES: DATA_CACHE, SIMD_CACHE
CACHE_SIZE: 32 KB
CACHE_LEVEL: 1
MAX_NUM_CU_SHARED: 2
NUM_CACHE_INSTANCE: 464
CACHE_1:
CACHE_PROPERTIES: INST_CACHE, SIMD_CACHE
CACHE_SIZE: 64 KB
CACHE_LEVEL: 1
MAX_NUM_CU_SHARED: 2
NUM_CACHE_INSTANCE: 160
CACHE_2:
CACHE_PROPERTIES: DATA_CACHE, SIMD_CACHE
CACHE_SIZE: 32768 KB
CACHE_LEVEL: 2
MAX_NUM_CU_SHARED: 304
NUM_CACHE_INSTANCE: 1
CACHE_3:
CACHE_PROPERTIES: DATA_CACHE, SIMD_CACHE
CACHE_SIZE: 262144 KB
CACHE_LEVEL: 3
MAX_NUM_CU_SHARED: 304
NUM_CACHE_INSTANCE: 1
SIZE: 64289 MB
CACHE_INFO:
CACHE_0:
CACHE_PROPERTIES: DATA_CACHE, SIMD_CACHE
CACHE_SIZE: 32 KB
CACHE_LEVEL: 1
MAX_NUM_CU_SHARED: 2
NUM_CACHE_INSTANCE: 348
CACHE_1:
CACHE_PROPERTIES: INST_CACHE, SIMD_CACHE
CACHE_SIZE: 64 KB
CACHE_LEVEL: 1
MAX_NUM_CU_SHARED: 2
NUM_CACHE_INSTANCE: 120
CACHE_2:
CACHE_PROPERTIES: DATA_CACHE, SIMD_CACHE
CACHE_SIZE: 4096 KB
CACHE_LEVEL: 2
MAX_NUM_CU_SHARED: 228
NUM_CACHE_INSTANCE: 1
CACHE_3:
CACHE_PROPERTIES: DATA_CACHE, SIMD_CACHE
CACHE_SIZE: 262144 KB
CACHE_LEVEL: 3
MAX_NUM_CU_SHARED: 228
NUM_CACHE_INSTANCE: 1
GPU: 3
ASIC:
@@ -977,8 +1087,8 @@ GPU: 3
VENDOR_NAME: Advanced Micro Devices Inc. [AMD/ATI]
SUBVENDOR_ID: 0x1002
DEVICE_ID: 0x74a0
REV_ID: 0x0
ASIC_SERIAL: 0x53A0A1FF3830F499
REV_ID: 0x00
ASIC_SERIAL: 0xF4C44C2BE5E66537
OAM_ID: 3
BUS:
BDF: 0003:01:00.0
@@ -990,25 +1100,26 @@ GPU: 3
NAME: N/A
BUILD_DATE: N/A
PART_NUMBER: N/A
VERSION: N/A
VERSION: N/A
LIMIT:
MAX_POWER: 550 W
MIN_POWER: 0 W
SOCKET_POWER: 550 W
SLOWDOWN_EDGE_TEMPERATURE: N/A
SLOWDOWN_HOTSPOT_TEMPERATURE: 100 °C
SLOWDOWN_VRAM_TEMPERATURE: 95 °C
SLOWDOWN_VRAM_TEMPERATURE: 105 °C
SHUTDOWN_EDGE_TEMPERATURE: N/A
SHUTDOWN_HOTSPOT_TEMPERATURE: 110 °C
SHUTDOWN_VRAM_TEMPERATURE: 105 °C
SHUTDOWN_VRAM_TEMPERATURE: 115 °C
DRIVER:
NAME: amdgpu
VERSION: 6.7.0
VERSION: 6.9.0-rc5+
BOARD:
MODEL_NUMBER: N/A
PRODUCT_SERIAL: N/A
FRU_ID: N/A
PRODUCT_NAME: N/A
MANUFACTURER_NAME: N/A
PRODUCT_NAME: Aqua Vanjaram [Instinct MI300A]
MANUFACTURER_NAME: Advanced Micro Devices, Inc. [AMD/ATI]
RAS:
EEPROM_VERSION: 0x0
PARITY_SCHEMA: DISABLED
@@ -1030,10 +1141,15 @@ GPU: 3
MP0: DISABLED
MP1: DISABLED
FUSE: DISABLED
MCA: DISABLED
VCN: DISABLED
JPEG: DISABLED
IH: DISABLED
MPIO: DISABLED
PARTITION:
COMPUTE_PARTITION: SPX
MEMORY_PARTITION: NPS1
DPM_POLICY:
SOC_PSTATE:
NUM_SUPPORTED: 4
CURRENT_ID: 1
POLICIES:
@@ -1055,38 +1171,39 @@ GPU: 3
POLICY_DESCRIPTION: plpd_default
POLICY_ID: 2
POLICY_DESCRIPTION: plpd_optimized
PROCESS_ISOLATION: N/A
NUMA:
NODE: 3
AFFINITY: 3
VRAM:
TYPE: HBM
VENDOR: N/A
SIZE: 96432 MB
CACHE_INFO:
CACHE_0:
CACHE_PROPERTIES: DATA_CACHE, SIMD_CACHE
CACHE_SIZE: 32 KB
CACHE_LEVEL: 1
MAX_NUM_CU_SHARED: 2
NUM_CACHE_INSTANCE: 464
CACHE_1:
CACHE_PROPERTIES: INST_CACHE, SIMD_CACHE
CACHE_SIZE: 64 KB
CACHE_LEVEL: 1
MAX_NUM_CU_SHARED: 2
NUM_CACHE_INSTANCE: 160
CACHE_2:
CACHE_PROPERTIES: DATA_CACHE, SIMD_CACHE
CACHE_SIZE: 32768 KB
CACHE_LEVEL: 2
MAX_NUM_CU_SHARED: 304
NUM_CACHE_INSTANCE: 1
CACHE_3:
CACHE_PROPERTIES: DATA_CACHE, SIMD_CACHE
CACHE_SIZE: 262144 KB
CACHE_LEVEL: 3
MAX_NUM_CU_SHARED: 304
NUM_CACHE_INSTANCE: 1
SIZE: 64289 MB
CACHE_INFO:
CACHE_0:
CACHE_PROPERTIES: DATA_CACHE, SIMD_CACHE
CACHE_SIZE: 32 KB
CACHE_LEVEL: 1
MAX_NUM_CU_SHARED: 2
NUM_CACHE_INSTANCE: 348
CACHE_1:
CACHE_PROPERTIES: INST_CACHE, SIMD_CACHE
CACHE_SIZE: 64 KB
CACHE_LEVEL: 1
MAX_NUM_CU_SHARED: 2
NUM_CACHE_INSTANCE: 120
CACHE_2:
CACHE_PROPERTIES: DATA_CACHE, SIMD_CACHE
CACHE_SIZE: 4096 KB
CACHE_LEVEL: 2
MAX_NUM_CU_SHARED: 228
NUM_CACHE_INSTANCE: 1
CACHE_3:
CACHE_PROPERTIES: DATA_CACHE, SIMD_CACHE
CACHE_SIZE: 262144 KB
CACHE_LEVEL: 3
MAX_NUM_CU_SHARED: 228
NUM_CACHE_INSTANCE: 1
```
@@ -72,7 +72,7 @@ class AMDSMICommands():
self.cpu_handles = amdsmi_interface.amdsmi_get_cpusocket_handles()
except amdsmi_exception.AmdSmiLibraryException as e:
if e.err_code in (amdsmi_interface.amdsmi_wrapper.AMDSMI_STATUS_NOT_INIT,
amdsmi_interface.amdsmi_wrapper.AMDSMI_NO_DRV):
amdsmi_interface.amdsmi_wrapper.AMDSMI_STATUS_NO_DRV):
logging.info('Unable to get CPU devices, amd_hsmp driver not loaded')
else:
raise e
@@ -82,7 +82,7 @@ class AMDSMICommands():
self.core_handles = amdsmi_interface.amdsmi_get_cpucore_handles()
except amdsmi_exception.AmdSmiLibraryException as e:
if e.err_code in (amdsmi_interface.amdsmi_wrapper.AMDSMI_STATUS_NOT_INIT,
amdsmi_interface.amdsmi_wrapper.AMDSMI_NO_DRV):
amdsmi_interface.amdsmi_wrapper.AMDSMI_STATUS_NO_DRV):
logging.info('Unable to get CORE devices, amd_hsmp driver not loaded')
else:
raise e
@@ -245,7 +245,7 @@ class AMDSMICommands():
def static_gpu(self, args, multiple_devices=False, gpu=None, asic=None, bus=None, vbios=None,
limit=None, driver=None, ras=None, board=None, numa=None, vram=None,
cache=None, partition=None, dfc_ucode=None, fb_info=None, num_vf=None,
policy=None, xgmi_plpd=None, process_isolation=None):
soc_pstate=None, xgmi_plpd=None, process_isolation=None):
"""Get Static information for target gpu
Args:
@@ -268,7 +268,7 @@ class AMDSMICommands():
dfc_ucode (bool, optional): Value override for args.dfc_ucode. Defaults to None.
fb_info (bool, optional): Value override for args.fb_info. Defaults to None.
num_vf (bool, optional): Value override for args.num_vf. Defaults to None.
policy (bool, optional): Value override for args.policy. Defaults to None.
soc_pstate (bool, optional): Value override for args.soc_pstate. Defaults to None.
xgmi_plpd (bool, optional): Value override for args.xgmi_plpd. Defaults to None.
process_isolation (bool, optional): Value override for args.process_isolation. Defaults to None.
Returns:
@@ -291,10 +291,14 @@ class AMDSMICommands():
args.vram = vram
if cache:
args.cache = cache
if process_isolation:
args.process_isolation = process_isolation
# Store args that are applicable to the current platform
current_platform_args = ["asic", "bus", "vbios", "driver", "vram", "cache", "board"]
current_platform_values = [args.asic, args.bus, args.vbios, args.driver, args.vram, args.cache, args.board]
current_platform_args = ["asic", "bus", "vbios", "driver", "vram", "cache",
"board", "process_isolation"]
current_platform_values = [args.asic, args.bus, args.vbios, args.driver, args.vram, args.cache,
args.board, args.process_isolation]
if self.helpers.is_linux() and self.helpers.is_baremetal():
if ras:
@@ -303,14 +307,12 @@ class AMDSMICommands():
args.partition = partition
if limit:
args.limit = limit
if policy:
args.policy = policy
if soc_pstate:
args.soc_pstate = soc_pstate
if xgmi_plpd:
args.xgmi_plpd = xgmi_plpd
if process_isolation:
args.process_isolation = process_isolation
current_platform_args += ["ras", "limit", "partition", "policy", "xgmi_plpd", "process_isolation"]
current_platform_values += [args.ras, args.limit, args.partition, args.policy, args.xgmi_plpd, args.process_isolation]
current_platform_args += ["ras", "limit", "partition", "soc_pstate", "xgmi_plpd"]
current_platform_values += [args.ras, args.limit, args.partition, args.soc_pstate, args.xgmi_plpd]
if self.helpers.is_linux() and not self.helpers.is_virtual_os():
if numa:
@@ -635,15 +637,15 @@ class AMDSMICommands():
static_dict['partition'] = {"compute_partition": compute_partition,
"memory_partition": memory_partition}
if 'policy' in current_platform_args:
if args.policy:
if 'soc_pstate' in current_platform_args:
if args.soc_pstate:
try:
policy_info = amdsmi_interface.amdsmi_get_dpm_policy(args.gpu)
policy_info = amdsmi_interface.amdsmi_get_soc_pstate(args.gpu)
except amdsmi_exception.AmdSmiLibraryException as e:
policy_info = "N/A"
logging.debug("Failed to get policy info for gpu %s | %s", gpu_id, e.get_error_info())
logging.debug("Failed to get soc pstate policy info for gpu %s | %s", gpu_id, e.get_error_info())
static_dict['dpm_policy'] = policy_info
static_dict['soc_pstate'] = policy_info
if 'xgmi_plpd' in current_platform_args:
if args.xgmi_plpd:
try:
@@ -691,12 +693,12 @@ class AMDSMICommands():
# Get vram type string
vram_type_enum = vram_info['vram_type']
if vram_type_enum == amdsmi_interface.amdsmi_wrapper.VRAM_TYPE_GDDR6:
vram_type = "GDDR6"
if vram_type_enum == amdsmi_interface.amdsmi_wrapper.AMDSMI_VRAM_TYPE__MAX:
vram_type = "GDDR7"
else:
vram_type = amdsmi_interface.amdsmi_wrapper.amdsmi_vram_type_t__enumvalues[vram_type_enum]
# Remove amdsmi enum prefix
vram_type = vram_type.replace('VRAM_TYPE_', '').replace('_', '')
vram_type = vram_type.replace('AMDSMI_VRAM_TYPE_', '').replace('_', '')
# Get vram vendor string
vram_vendor_enum = vram_info['vram_vendor']
@@ -712,13 +714,13 @@ class AMDSMICommands():
vram_info_dict['vendor'] = vram_vendor
# Populate vram size with unit
vram_info_dict['size'] = vram_info['vram_size_mb']
vram_info_dict['size'] = vram_info['vram_size']
vram_size_unit = "MB"
if self.logger.is_human_readable_format():
vram_info_dict['size'] = f"{vram_info['vram_size_mb']} {vram_size_unit}"
vram_info_dict['size'] = f"{vram_info['vram_size']} {vram_size_unit}"
if self.logger.is_json_format():
vram_info_dict['size'] = {"value" : vram_info['vram_size_mb'],
vram_info_dict['size'] = {"value" : vram_info['vram_size'],
"unit" : vram_size_unit}
except amdsmi_exception.AmdSmiLibraryException as e:
@@ -799,7 +801,7 @@ class AMDSMICommands():
bus=None, vbios=None, limit=None, driver=None, ras=None,
board=None, numa=None, vram=None, cache=None, partition=None,
dfc_ucode=None, fb_info=None, num_vf=None, cpu=None,
interface_ver=None, policy=None, xgmi_plpd = None, process_isolation=None):
interface_ver=None, soc_pstate=None, xgmi_plpd = None, process_isolation=None):
"""Get Static information for target gpu and cpu
Args:
@@ -822,7 +824,7 @@ class AMDSMICommands():
num_vf (bool, optional): Value override for args.num_vf. Defaults to None.
cpu (cpu_handle, optional): cpu_handle for target device. Defaults to None.
interface_ver (bool, optional): Value override for args.interface_ver. Defaults to None
policy (bool, optional): Value override for args.policy. Defaults to None.
soc_pstate (bool, optional): Value override for args.soc_pstate. Defaults to None.
xgmi_plpd (bool, optional): Value override for args.xgmi_plpd. Defaults to None.
process_isolation (bool, optional): Value override for args.process_isolation. Defaults to None.
Raises:
@@ -850,7 +852,7 @@ class AMDSMICommands():
gpu_args_enabled = False
gpu_attributes = ["asic", "bus", "vbios", "limit", "driver", "ras",
"board", "numa", "vram", "cache", "partition",
"dfc_ucode", "fb_info", "num_vf", "policy", "xgmi_plpd",
"dfc_ucode", "fb_info", "num_vf", "soc_pstate", "xgmi_plpd",
"process_isolation"]
for attr in gpu_attributes:
if hasattr(args, attr):
@@ -881,7 +883,7 @@ class AMDSMICommands():
self.static_gpu(args, multiple_devices, gpu, asic,
bus, vbios, limit, driver, ras,
board, numa, vram, cache, partition,
dfc_ucode, fb_info, num_vf, policy,
dfc_ucode, fb_info, num_vf, soc_pstate,
process_isolation)
elif self.helpers.is_amd_hsmp_initialized(): # Only CPU is initialized
if args.cpu == None:
@@ -896,7 +898,7 @@ class AMDSMICommands():
self.static_gpu(args, multiple_devices, gpu, asic,
bus, vbios, limit, driver, ras,
board, numa, vram, cache, partition,
dfc_ucode, fb_info, num_vf, policy, xgmi_plpd,
dfc_ucode, fb_info, num_vf, soc_pstate, xgmi_plpd,
process_isolation)
@@ -941,7 +943,7 @@ class AMDSMICommands():
for fw_index, fw_entry in enumerate(fw_info['fw_list']):
# Change fw_name to fw_id
fw_entry['fw_id'] = fw_entry.pop('fw_name').name.replace("FW_ID_", "")
fw_entry['fw_id'] = fw_entry.pop('fw_name').name.replace("AMDSMI_FW_ID_", "")
fw_entry['fw_version'] = fw_entry.pop('fw_version') # popping to ensure order
# Add custom human readable formatting
@@ -3384,8 +3386,8 @@ class AMDSMICommands():
def set_gpu(self, args, multiple_devices=False, gpu=None, fan=None, perf_level=None,
profile=None, perf_determinism=None, compute_partition=None,
memory_partition=None, power_cap=None, dpm_policy=None, xgmi_plpd = None,
process_isolation=None, clear_sram_data = None):
memory_partition=None, power_cap=None, soc_pstate=None, xgmi_plpd = None,
process_isolation=None):
"""Issue reset commands to target gpu(s)
Args:
@@ -3399,10 +3401,9 @@ class AMDSMICommands():
compute_partition (amdsmi_interface.AmdSmiComputePartitionType, optional): Value override for args.compute_partition. Defaults to None.
memory_partition (amdsmi_interface.AmdSmiMemoryPartitionType, optional): Value override for args.memory_partition. Defaults to None.
power_cap (int, optional): Value override for args.power_cap. Defaults to None.
dpm_policy (int, optional): Value override for args.dpm_policy. Defaults to None.
soc_pstate (int, optional): Value override for args.soc_pstate. Defaults to None.
xgmi_plpd (int, optional): Value override for args.xgmi_plpd. Defaults to None.
process_isolation (int, optional): Value override for args.process_isolation. Defaults to None.
clear_sram_data (int, optional): Value override for args.clear_sram_data. Defaults to None.
Raises:
ValueError: Value error if no gpu value is provided
IndexError: Index error if gpu list is empty
@@ -3427,14 +3428,13 @@ class AMDSMICommands():
args.memory_partition = memory_partition
if power_cap:
args.power_cap = power_cap
if dpm_policy:
args.dpm_policy = dpm_policy
if soc_pstate:
args.soc_pstate = soc_pstate
if xgmi_plpd:
args.xgmi_plpd = xgmi_plpd
if process_isolation:
args.process_isolation = process_isolation
if clear_sram_data:
args.clear_sram_data = clear_sram_data
# Handle No GPU passed
if args.gpu == None:
raise ValueError('No GPU provided, specific GPU target(s) are needed')
@@ -3454,10 +3454,9 @@ class AMDSMICommands():
args.memory_partition,
args.perf_determinism is not None,
args.power_cap is not None,
args.dpm_policy is not None,
args.soc_pstate is not None,
args.xgmi_plpd is not None,
args.process_isolation is not None,
args.clear_sram_data]):
args.process_isolation is not None]):
command = " ".join(sys.argv[1:])
raise AmdSmiRequiredCommandException(command, self.logger.format)
@@ -3551,14 +3550,14 @@ class AMDSMICommands():
if min_power_cap == 0:
min_power_cap = 1
self.logger.store_output(args.gpu, 'powercap', f"Power cap must be between {min_power_cap} and {max_power_cap}")
if isinstance(args.dpm_policy, int):
if isinstance(args.soc_pstate, int):
try:
amdsmi_interface.amdsmi_set_dpm_policy(args.gpu, args.dpm_policy)
amdsmi_interface.amdsmi_set_soc_pstate(args.gpu, args.soc_pstate)
except amdsmi_exception.AmdSmiLibraryException as e:
if e.get_error_code() == amdsmi_interface.amdsmi_wrapper.AMDSMI_STATUS_NO_PERM:
raise PermissionError('Command requires elevation') from e
raise ValueError(f"Unable to set dpm policy to {args.dpm_policy} on {gpu_string}") from e
self.logger.store_output(args.gpu, 'dpmpolicy', f"Successfully set dpm policy to id {args.dpm_policy}")
raise ValueError(f"Unable to set dpm soc pstate policy to {args.soc_pstate} on {gpu_string}") from e
self.logger.store_output(args.gpu, 'socpstate', f"Successfully soc pstate dpm policy to id {args.soc_pstate}")
if isinstance(args.xgmi_plpd, int):
try:
amdsmi_interface.amdsmi_set_xgmi_plpd(args.gpu, args.xgmi_plpd)
@@ -3566,7 +3565,7 @@ class AMDSMICommands():
if e.get_error_code() == amdsmi_interface.amdsmi_wrapper.AMDSMI_STATUS_NO_PERM:
raise PermissionError('Command requires elevation') from e
raise ValueError(f"Unable to set XGMI policy to {args.xgmi_plpd} on {gpu_string}") from e
self.logger.store_output(args.gpu, 'xgmiplpd', f"Successfully set per-link power down policy to id {args.dpm_policy}")
self.logger.store_output(args.gpu, 'xgmiplpd', f"Successfully set per-link power down policy to id {args.xgmi_plpd}")
if isinstance(args.process_isolation, int):
status_string = "Enabled" if args.process_isolation else "Disabled"
result = f"Requested process isolation to {status_string}" # This should not print out
@@ -3583,16 +3582,6 @@ class AMDSMICommands():
raise ValueError(f"Unable to set process isolation to {status_string} on {gpu_string}") from e
self.logger.store_output(args.gpu, 'process_isolation', result)
if args.clear_sram_data:
try:
# Only 1 can be used for now.
amdsmi_interface.amdsmi_set_gpu_clear_sram_data(args.gpu, 1)
result = 'Successfully clear GPU SRAM data'
except amdsmi_exception.AmdSmiLibraryException as e:
if e.get_error_code() == amdsmi_interface.amdsmi_wrapper.AMDSMI_STATUS_NO_PERM:
raise PermissionError('Command requires elevation') from e
raise ValueError(f"Unable to clear SRAM data on GPU {gpu_id}") from e
self.logger.store_output(args.gpu, 'clear_sram_data', result)
if multiple_devices:
self.logger.store_multiple_device_output()
@@ -3607,8 +3596,8 @@ class AMDSMICommands():
cpu=None, cpu_pwr_limit=None, cpu_xgmi_link_width=None, cpu_lclk_dpm_level=None,
cpu_pwr_eff_mode=None, cpu_gmi3_link_width=None, cpu_pcie_link_rate=None,
cpu_df_pstate_range=None, cpu_enable_apb=None, cpu_disable_apb=None,
soc_boost_limit=None, core=None, core_boost_limit=None, dpm_policy=None, xgmi_plpd=None,
process_isolation=None, clear_sram_data=None):
soc_boost_limit=None, core=None, core_boost_limit=None, soc_pstate=None, xgmi_plpd=None,
process_isolation=None):
"""Issue reset commands to target gpu(s)
Args:
@@ -3637,10 +3626,9 @@ class AMDSMICommands():
core (device_handle, optional): device_handle for target core. Defaults to None.
core_boost_limit (int, optional): Value override for args.core_boost_limit. Defaults to None
dpm_policy (int, optional): Value override for args.dpm_policy. Defaults to None.
soc_pstate (int, optional): Value override for args.soc_pstate. Defaults to None.
xgmi_plpd (int, optional): Value override for args.xgmi_plpd. Defaults to None.
process_isolation (int, optional): Value override for args.process_isolation. Defaults to None.
clear_sram_data (int, optional): Value override for args.clear_sram_data. Defaults to None.
Raises:
ValueError: Value error if no gpu value is provided
IndexError: Index error if gpu list is empty
@@ -3660,8 +3648,8 @@ class AMDSMICommands():
# Check if a GPU argument has been set
gpu_args_enabled = False
gpu_attributes = ["fan", "perf_level", "profile", "perf_determinism", "compute_partition",
"memory_partition", "power_cap", "dpm_policy", "xgmi_plpd", "process_isolation",
"clear_sram_data"]
"memory_partition", "power_cap", "soc_pstate", "xgmi_plpd", "process_isolation",
]
for attr in gpu_attributes:
if hasattr(args, attr):
if getattr(args, attr) is not None:
@@ -3716,8 +3704,8 @@ class AMDSMICommands():
self.logger.clear_multiple_devices_ouput()
self.set_gpu(args, multiple_devices, gpu, fan, perf_level,
profile, perf_determinism, compute_partition,
memory_partition, power_cap, dpm_policy, xgmi_plpd,
process_isolation, clear_sram_data)
memory_partition, power_cap, soc_pstate, xgmi_plpd,
process_isolation)
elif self.helpers.is_amd_hsmp_initialized(): # Only CPU is initialized
if args.cpu == None and args.core == None:
raise ValueError('No CPU or CORE provided, specific target(s) are needed')
@@ -3736,13 +3724,13 @@ class AMDSMICommands():
self.logger.clear_multiple_devices_ouput()
self.set_gpu(args, multiple_devices, gpu, fan, perf_level,
profile, perf_determinism, compute_partition,
memory_partition, power_cap, dpm_policy, xgmi_plpd,
process_isolation, clear_sram_data)
memory_partition, power_cap, soc_pstate, xgmi_plpd,
process_isolation)
def reset(self, args, multiple_devices=False, gpu=None, gpureset=None,
clocks=None, fans=None, profile=None, xgmierr=None, perf_determinism=None,
compute_partition=None, memory_partition=None, power_cap=None):
compute_partition=None, memory_partition=None, power_cap=None, clear_sram_data=None):
"""Issue reset commands to target gpu(s)
Args:
@@ -3757,7 +3745,9 @@ class AMDSMICommands():
perf_determinism (bool, optional): Value override for args.perf_determinism. Defaults to None.
compute_partition (bool, optional): Value override for args.compute_partition. Defaults to None.
memory_partition (bool, optional): Value override for args.memory_partition. Defaults to None.
power_cap (int, optional): Value override for args.power_cap. Defaults to None.
power_cap (bool, optional): Value override for args.power_cap. Defaults to None.
clear_sram_data (bool, optional): Value override for args.clear_sram_data. Defaults to None.
Raises:
ValueError: Value error if no gpu value is provided
IndexError: Index error if gpu list is empty
@@ -3786,6 +3776,8 @@ class AMDSMICommands():
args.memory_partition = memory_partition
if power_cap:
args.power_cap = power_cap
if clear_sram_data:
args.clear_sram_data = clear_sram_data
# Handle No GPU passed
if args.gpu == None:
@@ -3804,7 +3796,7 @@ class AMDSMICommands():
# Error if no subcommand args are passed
if not any([args.gpureset, args.clocks, args.fans, args.profile, args.xgmierr, \
args.perf_determinism, args.compute_partition, args.memory_partition, \
args.power_cap]):
args.power_cap, args.clear_sram_data]):
command = " ".join(sys.argv[1:])
raise AmdSmiRequiredCommandException(command, self.logger.format)
@@ -3955,6 +3947,16 @@ class AMDSMICommands():
raise PermissionError('Command requires elevation') from e
raise ValueError(f"Unable to reset power cap to {default_power_cap_in_w} on GPU {gpu_id}") from e
self.logger.store_output(args.gpu, 'powercap', f"Successfully set power cap to {default_power_cap_in_w}")
if args.clear_sram_data:
try:
# Only 1 can be used for now.
amdsmi_interface.amdsmi_set_gpu_clear_sram_data(args.gpu, 1)
result = 'Successfully clear GPU SRAM data'
except amdsmi_exception.AmdSmiLibraryException as e:
if e.get_error_code() == amdsmi_interface.amdsmi_wrapper.AMDSMI_STATUS_NO_PERM:
raise PermissionError('Command requires elevation') from e
raise ValueError(f"Unable to clear SRAM data on GPU {gpu_id}") from e
self.logger.store_output(args.gpu, 'clear_sram_data', result)
if multiple_devices:
self.logger.store_multiple_device_output()
@@ -49,6 +49,7 @@ class AMDSMIHelpers():
self._is_hypervisor = False
self._is_virtual_os = False
self._is_baremetal = False
self._is_passthrough = False
self._is_linux = False
self._is_windows = False
@@ -63,6 +64,14 @@ class AMDSMIHelpers():
else:
self._is_virtual_os = True
# Check for passthrough system filtering by device id
output = run(["lspci", "-nn"], stdout=PIPE, stderr=STDOUT, encoding="UTF-8").stdout
passthrough_device_ids = ["7460", "73c8", "74a0", "74a1", "74a2"]
if any(device_id in output for device_id in passthrough_device_ids):
self._is_baremetal = True
self._is_virtual_os = False
self._is_passthrough = True
def os_info(self, string_format=True):
"""Return operating_system and type information ex. (Linux, Baremetal)
@@ -89,6 +98,10 @@ class AMDSMIHelpers():
else:
operating_system_type = "Unknown"
# Passthrough Override
if self._is_passthrough:
operating_system_type = "Guest (Passthrough)"
if string_format:
return f"{operating_system} {operating_system_type}"
else:
@@ -543,7 +543,7 @@ class AMDSMIParser(argparse.ArgumentParser):
vram_help = "All vram information"
cache_help = "All cache information"
board_help = "All board information"
dpm_policy_help = "The available DPM policy"
soc_pstate_help = "The available soc pstate policy"
xgmi_plpd_help = "The available XGMI per-link power down policy"
process_isolation_help = "The process isolation status"
@@ -579,15 +579,15 @@ class AMDSMIParser(argparse.ArgumentParser):
static_parser.add_argument('-v', '--vram', action='store_true', required=False, help=vram_help)
static_parser.add_argument('-c', '--cache', action='store_true', required=False, help=cache_help)
static_parser.add_argument('-B', '--board', action='store_true', required=False, help=board_help)
static_parser.add_argument('-R', '--process-isolation', action='store_true', required=False, help=process_isolation_help)
# Options to display on Hypervisors and Baremetal
if self.helpers.is_hypervisor() or self.helpers.is_baremetal():
static_parser.add_argument('-r', '--ras', action='store_true', required=False, help=ras_help)
static_parser.add_argument('-p', '--partition', action='store_true', required=False, help=partition_help)
static_parser.add_argument('-l', '--limit', action='store_true', required=False, help=limit_help)
static_parser.add_argument('-P', '--policy', action='store_true', required=False, help=dpm_policy_help)
static_parser.add_argument('-P', '--soc-pstate', action='store_true', required=False, help=soc_pstate_help)
static_parser.add_argument('-x', '--xgmi-plpd', action='store_true', required=False, help=xgmi_plpd_help)
static_parser.add_argument('-R', '--process-isolation', action='store_true', required=False, help=process_isolation_help)
if self.helpers.is_linux() and not self.helpers.is_virtual_os():
static_parser.add_argument('-u', '--numa', action='store_true', required=False, help=numa_help)
@@ -949,8 +949,8 @@ class AMDSMIParser(argparse.ArgumentParser):
def _add_set_value_parser(self, subparsers, func):
if not(self.helpers.is_baremetal() and self.helpers.is_linux()):
# This subparser is only applicable to Baremetal Linux
if not self.helpers.is_linux():
# This subparser is only applicable to Linux
return
# Subparser help text
@@ -969,7 +969,7 @@ class AMDSMIParser(argparse.ArgumentParser):
set_compute_partition_help = f"Set one of the following the compute partition modes:\n\t{compute_partition_choices_str}"
set_memory_partition_help = f"Set one of the following the memory partition modes:\n\t{memory_partition_choices_str}"
set_power_cap_help = "Set power capacity limit"
set_dpm_policy_help = "Set the GPU DPM policy using policy id\n"
set_soc_pstate_help = "Set the GPU soc pstate policy using policy id\n"
set_xgmi_plpd_help = "Set the GPU XGMI per-link power down policy using policy id\n"
set_process_isolation_help = "Enable or disable the GPU process isolation: 0 for disable and 1 for enable.\n"
@@ -985,7 +985,6 @@ class AMDSMIParser(argparse.ArgumentParser):
set_cpu_enable_apb_help = "Enables the DF p-state performance boost algorithm"
set_cpu_disable_apb_help = "Disables the DF p-state performance boost algorithm. Input parameter is DFPstate (0-3)"
set_soc_boost_limit_help = "Sets the boost limit for the given socket. Input parameter is socket BOOST_LIMIT value"
run_gpu_clear_sram_data_help = f"Clear the GPU SRAM data\n"
# Help text for CPU Core set options
set_core_boost_limit_help = "Sets the boost limit for the given core. Input parameter is core BOOST_LIMIT value"
@@ -1000,44 +999,46 @@ class AMDSMIParser(argparse.ArgumentParser):
self._add_device_arguments(set_value_parser, required=True)
if self.helpers.is_amdgpu_initialized():
# Optional GPU Args
set_value_parser.add_argument('-f', '--fan', action=self._validate_fan_speed(), required=False, help=set_fan_help, metavar='%')
set_value_parser.add_argument('-l', '--perf-level', action='store', choices=self.helpers.get_perf_levels()[0], type=str.upper, required=False, help=set_perf_level_help, metavar='LEVEL')
set_value_parser.add_argument('-P', '--profile', action='store', required=False, help=set_profile_help, metavar='SETPROFILE')
set_value_parser.add_argument('-d', '--perf-determinism', action='store', type=self._not_negative_int, required=False, help=set_perf_det_help, metavar='SCLKMAX')
set_value_parser.add_argument('-C', '--compute-partition', action='store', choices=self.helpers.get_compute_partition_types(), type=str.upper, required=False, help=set_compute_partition_help, metavar='PARTITION')
set_value_parser.add_argument('-M', '--memory-partition', action='store', choices=self.helpers.get_memory_partition_types(), type=str.upper, required=False, help=set_memory_partition_help, metavar='PARTITION')
set_value_parser.add_argument('-o', '--power-cap', action='store', type=self._positive_int, required=False, help=set_power_cap_help, metavar='WATTS')
set_value_parser.add_argument('-p', '--dpm-policy', action='store', required=False, type=self._not_negative_int, help=set_dpm_policy_help, metavar='POLICY_ID')
set_value_parser.add_argument('-x', '--xgmi-plpd', action='store', required=False, type=self._not_negative_int, help=set_xgmi_plpd_help, metavar='POLICY_ID')
if self.helpers.is_baremetal():
# Optional GPU Args
set_value_parser.add_argument('-f', '--fan', action=self._validate_fan_speed(), required=False, help=set_fan_help, metavar='%')
set_value_parser.add_argument('-l', '--perf-level', action='store', choices=self.helpers.get_perf_levels()[0], type=str.upper, required=False, help=set_perf_level_help, metavar='LEVEL')
set_value_parser.add_argument('-P', '--profile', action='store', required=False, help=set_profile_help, metavar='SETPROFILE')
set_value_parser.add_argument('-d', '--perf-determinism', action='store', type=self._not_negative_int, required=False, help=set_perf_det_help, metavar='SCLKMAX')
set_value_parser.add_argument('-C', '--compute-partition', action='store', choices=self.helpers.get_compute_partition_types(), type=str.upper, required=False, help=set_compute_partition_help, metavar='PARTITION')
set_value_parser.add_argument('-M', '--memory-partition', action='store', choices=self.helpers.get_memory_partition_types(), type=str.upper, required=False, help=set_memory_partition_help, metavar='PARTITION')
set_value_parser.add_argument('-o', '--power-cap', action='store', type=self._positive_int, required=False, help=set_power_cap_help, metavar='WATTS')
set_value_parser.add_argument('-p', '--soc-pstate', action='store', required=False, type=self._not_negative_int, help=set_soc_pstate_help, metavar='POLICY_ID')
set_value_parser.add_argument('-x', '--xgmi-plpd', action='store', required=False, type=self._not_negative_int, help=set_xgmi_plpd_help, metavar='POLICY_ID')
set_value_parser.add_argument('-R', '--process-isolation', action='store', choices=[0,1], type=self._not_negative_int, required=False, help=set_process_isolation_help, metavar='STATUS')
set_value_parser.add_argument('-c', '--clear-sram-data', action='store_true', required=False, help=run_gpu_clear_sram_data_help)
if self.helpers.is_amd_hsmp_initialized():
# Optional CPU Args
cpu_group = set_value_parser.add_argument_group("CPU Arguments")
cpu_group.add_argument('--cpu-pwr-limit', action='append', required=False, type=self._validate_positive, nargs=1, metavar=("PWR_LIMIT"), help=set_cpu_pwr_limit_help)
cpu_group.add_argument('--cpu-xgmi-link-width', action='append', required=False, type=self._validate_positive, nargs=2, metavar=("MIN_WIDTH", "MAX_WIDTH"), help=set_cpu_xgmi_link_width_help)
cpu_group.add_argument('--cpu-lclk-dpm-level', action='append', required=False, type=self._validate_positive, nargs=3, metavar=("NBIOID", "MIN_DPM", "MAX_DPM"), help=set_cpu_lclk_dpm_level_help)
cpu_group.add_argument('--cpu-pwr-eff-mode', action='append', required=False, type=self._validate_positive, nargs=1, metavar=("MODE"), help=set_cpu_pwr_eff_mode_help)
cpu_group.add_argument('--cpu-gmi3-link-width', action='append', required=False, type=self._validate_positive, nargs=2, metavar=("MIN_LW", "MAX_LW"), help=set_cpu_gmi3_link_width_help)
cpu_group.add_argument('--cpu-pcie-link-rate', action='append', required=False, type=self._validate_positive, nargs=1, metavar=("LINK_RATE"), help=set_cpu_pcie_link_rate_help)
cpu_group.add_argument('--cpu-df-pstate-range', action='append', required=False, type=self._validate_positive, nargs=2, metavar=("MAX_PSTATE", "MIN_PSTATE"), help=set_cpu_df_pstate_range_help)
cpu_group.add_argument('--cpu-enable-apb', action='store_true', required=False, help=set_cpu_enable_apb_help)
cpu_group.add_argument('--cpu-disable-apb', action='append', required=False, type=self._validate_positive, nargs=1, metavar=("DF_PSTATE"), help=set_cpu_disable_apb_help)
cpu_group.add_argument('--soc-boost-limit', action='append', required=False, type=self._validate_positive, nargs=1, metavar=("BOOST_LIMIT"), help=set_soc_boost_limit_help)
if self.helpers.is_baremetal():
# Optional CPU Args
cpu_group = set_value_parser.add_argument_group("CPU Arguments")
cpu_group.add_argument('--cpu-pwr-limit', action='append', required=False, type=self._validate_positive, nargs=1, metavar=("PWR_LIMIT"), help=set_cpu_pwr_limit_help)
cpu_group.add_argument('--cpu-xgmi-link-width', action='append', required=False, type=self._validate_positive, nargs=2, metavar=("MIN_WIDTH", "MAX_WIDTH"), help=set_cpu_xgmi_link_width_help)
cpu_group.add_argument('--cpu-lclk-dpm-level', action='append', required=False, type=self._validate_positive, nargs=3, metavar=("NBIOID", "MIN_DPM", "MAX_DPM"), help=set_cpu_lclk_dpm_level_help)
cpu_group.add_argument('--cpu-pwr-eff-mode', action='append', required=False, type=self._validate_positive, nargs=1, metavar=("MODE"), help=set_cpu_pwr_eff_mode_help)
cpu_group.add_argument('--cpu-gmi3-link-width', action='append', required=False, type=self._validate_positive, nargs=2, metavar=("MIN_LW", "MAX_LW"), help=set_cpu_gmi3_link_width_help)
cpu_group.add_argument('--cpu-pcie-link-rate', action='append', required=False, type=self._validate_positive, nargs=1, metavar=("LINK_RATE"), help=set_cpu_pcie_link_rate_help)
cpu_group.add_argument('--cpu-df-pstate-range', action='append', required=False, type=self._validate_positive, nargs=2, metavar=("MAX_PSTATE", "MIN_PSTATE"), help=set_cpu_df_pstate_range_help)
cpu_group.add_argument('--cpu-enable-apb', action='store_true', required=False, help=set_cpu_enable_apb_help)
cpu_group.add_argument('--cpu-disable-apb', action='append', required=False, type=self._validate_positive, nargs=1, metavar=("DF_PSTATE"), help=set_cpu_disable_apb_help)
cpu_group.add_argument('--soc-boost-limit', action='append', required=False, type=self._validate_positive, nargs=1, metavar=("BOOST_LIMIT"), help=set_soc_boost_limit_help)
# Optional CPU Core Args
core_group = set_value_parser.add_argument_group("CPU Core Arguments")
core_group.add_argument('--core-boost-limit', action='append', required=False, type=self._validate_positive, nargs=1, metavar=("BOOST_LIMIT"), help=set_core_boost_limit_help)
# Optional CPU Core Args
core_group = set_value_parser.add_argument_group("CPU Core Arguments")
core_group.add_argument('--core-boost-limit', action='append', required=False, type=self._validate_positive, nargs=1, metavar=("BOOST_LIMIT"), help=set_core_boost_limit_help)
# Add command modifiers to the bottom
self._add_command_modifiers(set_value_parser)
def _add_reset_parser(self, subparsers, func):
if not(self.helpers.is_baremetal() and self.helpers.is_linux()):
# This subparser is only applicable to Baremetal Linux
if not self.helpers.is_linux():
# This subparser is only applicable to Linux
return
if not self.helpers.is_amdgpu_initialized():
@@ -1060,6 +1061,7 @@ class AMDSMIParser(argparse.ArgumentParser):
reset_compute_help = "Reset compute partitions on the specified GPU"
reset_memory_help = "Reset memory partitions on the specified GPU"
reset_power_cap_help = "Reset power capacity limit to max capable"
reset_gpu_clear_sram_data_help = "Clear the GPU SRAM data\n"
# Create reset subparser
reset_parser = subparsers.add_parser('reset', help=reset_help, description=reset_subcommand_help)
@@ -1072,20 +1074,24 @@ class AMDSMIParser(argparse.ArgumentParser):
# Device args are required as safeguard from the user applying the operation to all gpus unintentionally
self._add_device_arguments(reset_parser, required=True)
# Add reset arguments
reset_parser.add_argument('-G', '--gpureset', action='store_true', required=False, help=gpureset_help)
reset_parser.add_argument('-c', '--clocks', action='store_true', required=False, help=reset_clocks_help)
reset_parser.add_argument('-f', '--fans', action='store_true', required=False, help=reset_fans_help)
reset_parser.add_argument('-p', '--profile', action='store_true', required=False, help=reset_profile_help)
reset_parser.add_argument('-x', '--xgmierr', action='store_true', required=False, help=reset_xgmierr_help)
reset_parser.add_argument('-d', '--perf-determinism', action='store_true', required=False, help=reset_perf_det_help)
reset_parser.add_argument('-C', '--compute-partition', action='store_true', required=False, help=reset_compute_help)
reset_parser.add_argument('-M', '--memory-partition', action='store_true', required=False, help=reset_memory_help)
reset_parser.add_argument('-o', '--power-cap', action='store_true', required=False, help=reset_power_cap_help)
if self.helpers.is_baremetal():
# Add Baremetal reset arguments
reset_parser.add_argument('-G', '--gpureset', action='store_true', required=False, help=gpureset_help)
reset_parser.add_argument('-c', '--clocks', action='store_true', required=False, help=reset_clocks_help)
reset_parser.add_argument('-f', '--fans', action='store_true', required=False, help=reset_fans_help)
reset_parser.add_argument('-p', '--profile', action='store_true', required=False, help=reset_profile_help)
reset_parser.add_argument('-x', '--xgmierr', action='store_true', required=False, help=reset_xgmierr_help)
reset_parser.add_argument('-d', '--perf-determinism', action='store_true', required=False, help=reset_perf_det_help)
reset_parser.add_argument('-C', '--compute-partition', action='store_true', required=False, help=reset_compute_help)
reset_parser.add_argument('-M', '--memory-partition', action='store_true', required=False, help=reset_memory_help)
reset_parser.add_argument('-o', '--power-cap', action='store_true', required=False, help=reset_power_cap_help)
# Add Baremetal and Virtual OS reset arguments
reset_parser.add_argument('-l', '--clear-sram-data', action='store_true', required=False, help=reset_gpu_clear_sram_data_help)
def _add_monitor_parser(self, subparsers, func):
if not(self.helpers.is_linux()):
if not self.helpers.is_linux():
# This subparser is only applicable to Linux
return
+1 -1
Wyświetl plik
@@ -48,7 +48,7 @@ PROJECT_NAME = AMD SMI
# could be handy for archiving the generated documentation or if some version
# control system is used.
PROJECT_NUMBER = "24.5.3.0"
PROJECT_NUMBER = "24.6.0.0"
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
@@ -6,7 +6,7 @@ AMD-SMI reports the version and current platform detected when running the comma
~$ amd-smi
usage: amd-smi [-h] ...
AMD System Management Interface | Version: 24.5.2.0 | ROCm version: 6.1.2 | Platform: Linux Baremetal
AMD System Management Interface | Version: 24.6.0.0 | ROCm version: 6.2.0 | Platform: Linux Baremetal
options:
-h, --help show this help message and exit
@@ -607,7 +607,7 @@ GPU: 0
PARTITION:
COMPUTE_PARTITION: SPX
MEMORY_PARTITION: NPS1
DPM_POLICY:
SOC_PSTATE:
NUM_SUPPORTED: 4
CURRENT_ID: 1
POLICIES:
@@ -725,7 +725,7 @@ GPU: 1
PARTITION:
COMPUTE_PARTITION: SPX
MEMORY_PARTITION: NPS1
DPM_POLICY:
SOC_PSTATE:
NUM_SUPPORTED: 4
CURRENT_ID: 1
POLICIES:
@@ -843,7 +843,7 @@ GPU: 2
PARTITION:
COMPUTE_PARTITION: SPX
MEMORY_PARTITION: NPS1
DPM_POLICY:
SOC_PSTATE:
NUM_SUPPORTED: 4
CURRENT_ID: 1
POLICIES:
@@ -961,7 +961,7 @@ GPU: 3
PARTITION:
COMPUTE_PARTITION: SPX
MEMORY_PARTITION: NPS1
DPM_POLICY:
SOC_PSTATE:
NUM_SUPPORTED: 4
CURRENT_ID: 1
POLICIES:
@@ -86,7 +86,7 @@ When AMD SMI is no longer used, `amdsmi_shut_down()` should be called. This prov
// Get temperature
int64_t val_i64 = 0;
ret = amdsmi_get_temp_metric(processor_handles[j], TEMPERATURE_TYPE_EDGE,
ret = amdsmi_get_temp_metric(processor_handles[j], AMDSMI_TEMPERATURE_TYPE_EDGE,
AMDSMI_TEMP_CURRENT, &val_i64);
std::cout << "\t\tTemperature: " << val_i64 << "C" << std::endl;
}
@@ -470,7 +470,7 @@ Field | Description
---|---
`vram_type` | vram type
`vram_vendor` | vram vendor
`vram_size_mb` | vram size in mb
`vram_size` | vram size in mb
Exceptions that can be thrown by `amdsmi_get_gpu_vram_info` function:
@@ -490,7 +490,7 @@ try:
vram_info = amdsmi_get_gpu_vram_info(device)
print(vram_info['vram_type'])
print(vram_info['vram_vendor'])
print(vram_info['vram_size_mb'])
print(vram_info['vram_size'])
except AmdSmiException as e:
print(e)
```
@@ -2705,7 +2705,7 @@ except AmdSmiException as e:
print(e)
```
### amdsmi_get_dpm_policy
### amdsmi_get_soc_pstate
Description: Get dpm policy information.
@@ -2722,7 +2722,7 @@ Field | Description
`current_id` | current policy id
`policies` | list of dictionaries containing possible policies
Exceptions that can be thrown by `amdsmi_get_dpm_policy` function:
Exceptions that can be thrown by `amdsmi_get_soc_pstate` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
@@ -2737,13 +2737,13 @@ try:
print("No GPUs on machine")
else:
for device in devices:
dpm_policies = amdsmi_get_dpm_policy(device)
dpm_policies = amdsmi_get_soc_pstate(device)
print(dpm_policies)
except AmdSmiException as e:
print(e)
```
### amdsmi_set_dpm_policy
### amdsmi_set_soc_pstate
Description: Set the dpm policy to corresponding policy_id. Typically following: 0(default),1,2,3
@@ -2754,7 +2754,7 @@ Input parameters:
Output: None
Exceptions that can be thrown by `amdsmi_set_dpm_policy` function:
Exceptions that can be thrown by `amdsmi_set_soc_pstate` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
@@ -2769,7 +2769,7 @@ try:
print("No GPUs on machine")
else:
for device in devices:
amdsmi_set_dpm_policy(device, 0)
amdsmi_set_soc_pstate(device, 0)
except AmdSmiException as e:
print(e)
```
@@ -71,146 +71,146 @@
void getFWNameFromId(int id, char *name)
{
switch (id) {
case FW_ID_SMU:
strcpy(name, "SMU");
break;
case FW_ID_CP_CE:
strcpy(name, "CP_CE");
break;
case FW_ID_CP_PFP:
strcpy(name, "CP_PFP");
break;
case FW_ID_CP_ME:
strcpy(name, "CP_ME");
break;
case FW_ID_CP_MEC_JT1:
strcpy(name, "CP_MEC_JT1");
break;
case FW_ID_CP_MEC_JT2:
strcpy(name, "CP_MEC_JT2");
break;
case FW_ID_CP_MEC1:
strcpy(name, "CP_MEC1");
break;
case FW_ID_CP_MEC2:
strcpy(name, "CP_MEC2");
break;
case FW_ID_RLC:
strcpy(name, "RLC");
break;
case FW_ID_SDMA0:
strcpy(name, "SDMA0");
break;
case FW_ID_SDMA1:
strcpy(name, "SDMA1");
break;
case FW_ID_SDMA2:
strcpy(name, "SDMA2");
break;
case FW_ID_SDMA3:
strcpy(name, "SDMA3");
break;
case FW_ID_SDMA4:
strcpy(name, "SDMA4");
break;
case FW_ID_SDMA5:
strcpy(name, "SDMA5");
break;
case FW_ID_SDMA6:
strcpy(name, "SDMA6");
break;
case FW_ID_SDMA7:
strcpy(name, "SDMA7");
break;
case FW_ID_VCN:
strcpy(name, "VCN");
break;
case FW_ID_UVD:
strcpy(name, "UVD");
break;
case FW_ID_VCE:
strcpy(name, "VCE");
break;
case FW_ID_ISP:
strcpy(name, "ISP");
break;
case FW_ID_DMCU_ERAM:
strcpy(name, "DMCU_ERAM");
break;
case FW_ID_DMCU_ISR:
strcpy(name, "DMCU_ISR");
break;
case FW_ID_RLC_RESTORE_LIST_GPM_MEM:
strcpy(name, "RLC_RESTORE_LIST_GPM_MEM");
break;
case FW_ID_RLC_RESTORE_LIST_SRM_MEM:
strcpy(name, "RLC_RESTORE_LIST_SRM_MEM");
break;
case FW_ID_RLC_RESTORE_LIST_CNTL:
strcpy(name, "RLC_RESTORE_LIST_CNTL");
break;
case FW_ID_RLC_V:
strcpy(name, "RLC_V");
break;
case FW_ID_MMSCH:
strcpy(name, "MMSCH");
break;
case FW_ID_PSP_SYSDRV:
strcpy(name, "PSP_SYSDRV");
break;
case FW_ID_PSP_SOSDRV:
strcpy(name, "PSP_SOSDRV");
break;
case FW_ID_PSP_TOC:
strcpy(name, "PSP_TOC");
break;
case FW_ID_PSP_KEYDB:
strcpy(name, "PSP_KEYDB");
break;
case FW_ID_DFC:
strcpy(name, "DFC");
break;
case FW_ID_PSP_SPL:
strcpy(name, "PSP_SPL");
break;
case FW_ID_DRV_CAP:
strcpy(name, "DRV_CAP");
break;
case FW_ID_MC:
strcpy(name, "MC");
break;
case FW_ID_PSP_BL:
strcpy(name, "PSP_BL");
break;
case FW_ID_CP_PM4:
strcpy(name, "CP_PM4");
break;
case FW_ID_ASD:
strcpy(name, "ID_ASD");
break;
case FW_ID_TA_RAS:
strcpy(name, "ID_TA_RAS");
break;
case FW_ID_TA_XGMI:
strcpy(name, "ID_TA_XGMI");
break;
case FW_ID_RLC_SRLG:
strcpy(name, "ID_RLC_SRLG");
break;
case FW_ID_RLC_SRLS:
strcpy(name, "ID_RLC_SRLS");
break;
case FW_ID_PM:
strcpy(name, "ID_PM");
break;
case FW_ID_DMCU:
strcpy(name, "ID_DMCU");
break;
default:
strcpy(name, "");
break;
}
switch (id) {
case AMDSMI_FW_ID_SMU:
strcpy(name, "SMU");
break;
case AMDSMI_FW_ID_CP_CE:
strcpy(name, "CP_CE");
break;
case AMDSMI_FW_ID_CP_PFP:
strcpy(name, "CP_PFP");
break;
case AMDSMI_FW_ID_CP_ME:
strcpy(name, "CP_ME");
break;
case AMDSMI_FW_ID_CP_MEC_JT1:
strcpy(name, "CP_MEC_JT1");
break;
case AMDSMI_FW_ID_CP_MEC_JT2:
strcpy(name, "CP_MEC_JT2");
break;
case AMDSMI_FW_ID_CP_MEC1:
strcpy(name, "CP_MEC1");
break;
case AMDSMI_FW_ID_CP_MEC2:
strcpy(name, "CP_MEC2");
break;
case AMDSMI_FW_ID_RLC:
strcpy(name, "RLC");
break;
case AMDSMI_FW_ID_SDMA0:
strcpy(name, "SDMA0");
break;
case AMDSMI_FW_ID_SDMA1:
strcpy(name, "SDMA1");
break;
case AMDSMI_FW_ID_SDMA2:
strcpy(name, "SDMA2");
break;
case AMDSMI_FW_ID_SDMA3:
strcpy(name, "SDMA3");
break;
case AMDSMI_FW_ID_SDMA4:
strcpy(name, "SDMA4");
break;
case AMDSMI_FW_ID_SDMA5:
strcpy(name, "SDMA5");
break;
case AMDSMI_FW_ID_SDMA6:
strcpy(name, "SDMA6");
break;
case AMDSMI_FW_ID_SDMA7:
strcpy(name, "SDMA7");
break;
case AMDSMI_FW_ID_VCN:
strcpy(name, "VCN");
break;
case AMDSMI_FW_ID_UVD:
strcpy(name, "UVD");
break;
case AMDSMI_FW_ID_VCE:
strcpy(name, "VCE");
break;
case AMDSMI_FW_ID_ISP:
strcpy(name, "ISP");
break;
case AMDSMI_FW_ID_DMCU_ERAM:
strcpy(name, "DMCU_ERAM");
break;
case AMDSMI_FW_ID_DMCU_ISR:
strcpy(name, "DMCU_ISR");
break;
case AMDSMI_FW_ID_RLC_RESTORE_LIST_GPM_MEM:
strcpy(name, "RLC_RESTORE_LIST_GPM_MEM");
break;
case AMDSMI_FW_ID_RLC_RESTORE_LIST_SRM_MEM:
strcpy(name, "RLC_RESTORE_LIST_SRM_MEM");
break;
case AMDSMI_FW_ID_RLC_RESTORE_LIST_CNTL:
strcpy(name, "RLC_RESTORE_LIST_CNTL");
break;
case AMDSMI_FW_ID_RLC_V:
strcpy(name, "RLC_V");
break;
case AMDSMI_FW_ID_MMSCH:
strcpy(name, "MMSCH");
break;
case AMDSMI_FW_ID_PSP_SYSDRV:
strcpy(name, "PSP_SYSDRV");
break;
case AMDSMI_FW_ID_PSP_SOSDRV:
strcpy(name, "PSP_SOSDRV");
break;
case AMDSMI_FW_ID_PSP_TOC:
strcpy(name, "PSP_TOC");
break;
case AMDSMI_FW_ID_PSP_KEYDB:
strcpy(name, "PSP_KEYDB");
break;
case AMDSMI_FW_ID_DFC:
strcpy(name, "DFC");
break;
case AMDSMI_FW_ID_PSP_SPL:
strcpy(name, "PSP_SPL");
break;
case AMDSMI_FW_ID_DRV_CAP:
strcpy(name, "DRV_CAP");
break;
case AMDSMI_FW_ID_MC:
strcpy(name, "MC");
break;
case AMDSMI_FW_ID_PSP_BL:
strcpy(name, "PSP_BL");
break;
case AMDSMI_FW_ID_CP_PM4:
strcpy(name, "CP_PM4");
break;
case AMDSMI_FW_ID_ASD:
strcpy(name, "ID_ASD");
break;
case AMDSMI_FW_ID_TA_RAS:
strcpy(name, "ID_TA_RAS");
break;
case AMDSMI_FW_ID_TA_XGMI:
strcpy(name, "ID_TA_XGMI");
break;
case AMDSMI_FW_ID_RLC_SRLG:
strcpy(name, "ID_RLC_SRLG");
break;
case AMDSMI_FW_ID_RLC_SRLS:
strcpy(name, "ID_RLC_SRLS");
break;
case AMDSMI_FW_ID_PM:
strcpy(name, "ID_PM");
break;
case AMDSMI_FW_ID_DMCU:
strcpy(name, "ID_DMCU");
break;
default:
strcpy(name, "");
break;
}
}
template <typename T>
@@ -267,12 +267,12 @@ int main() {
// For each device of the socket, get name and temperature.
for (uint32_t j = 0; j < device_count; j++) {
// Get device type. Since the amdsmi is initialized with
// AMD_SMI_INIT_AMD_GPUS, the processor_type must be AMD_GPU.
// AMD_SMI_INIT_AMD_GPUS, the processor_type must be AMDSMI_PROCESSOR_TYPE_AMD_GPU.
processor_type_t processor_type = {};
ret = amdsmi_get_processor_type(processor_handles[j], &processor_type);
CHK_AMDSMI_RET(ret)
if (processor_type != AMD_GPU) {
std::cout << "Expect AMD_GPU device type!\n";
if (processor_type != AMDSMI_PROCESSOR_TYPE_AMD_GPU) {
std::cout << "Expect AMDSMI_PROCESSOR_TYPE_AMD_GPU device type!\n";
return AMDSMI_STATUS_NOT_SUPPORTED;
}
@@ -282,10 +282,10 @@ int main() {
CHK_AMDSMI_RET(ret)
printf(" Output of amdsmi_get_gpu_device_bdf:\n");
printf("\tDevice[%d] BDF %04lx:%02x:%02x.%d\n\n", i,
bdf.fields.domain_number,
bdf.fields.bus_number,
bdf.fields.device_number,
bdf.fields.function_number);
bdf.domain_number,
bdf.bus_number,
bdf.device_number,
bdf.function_number);
// Get handle from BDF
amdsmi_processor_handle dev_handle;
@@ -383,20 +383,20 @@ int main() {
// Get GFX clock measurements
amdsmi_clk_info_t gfx_clk_values = {};
ret = amdsmi_get_clock_info(processor_handles[j], CLK_TYPE_GFX,
ret = amdsmi_get_clock_info(processor_handles[j], AMDSMI_CLK_TYPE_GFX,
&gfx_clk_values);
CHK_AMDSMI_RET(ret)
printf(" Output of amdsmi_get_clock_info:\n");
printf("\tGPU GFX Max Clock: %d\n", gfx_clk_values.max_clk);
printf("\tGPU GFX Current Clock: %d\n", gfx_clk_values.cur_clk);
printf("\tGPU GFX Current Clock: %d\n", gfx_clk_values.clk);
// Get MEM clock measurements
amdsmi_clk_info_t mem_clk_values = {};
ret = amdsmi_get_clock_info(processor_handles[j], CLK_TYPE_MEM,
ret = amdsmi_get_clock_info(processor_handles[j], AMDSMI_CLK_TYPE_MEM,
&mem_clk_values);
CHK_AMDSMI_RET(ret)
printf("\tGPU MEM Max Clock: %d\n", mem_clk_values.max_clk);
printf("\tGPU MEM Current Clock: %d\n\n", mem_clk_values.cur_clk);
printf("\tGPU MEM Current Clock: %d\n\n", mem_clk_values.clk);
// Get PCIe status
amdsmi_pcie_info_t pcie_info = {};
@@ -422,7 +422,7 @@ int main() {
// Get VRAM temperature limit
int64_t temperature = 0;
ret = amdsmi_get_temp_metric(
processor_handles[j], TEMPERATURE_TYPE_VRAM,
processor_handles[j], AMDSMI_TEMPERATURE_TYPE_VRAM,
AMDSMI_TEMP_CRITICAL, &temperature);
CHK_AMDSMI_RET(ret)
printf(" Output of amdsmi_get_temp_metric:\n");
@@ -430,7 +430,7 @@ int main() {
// Get GFX temperature limit
ret = amdsmi_get_temp_metric(
processor_handles[j], TEMPERATURE_TYPE_EDGE,
processor_handles[j], AMDSMI_TEMPERATURE_TYPE_EDGE,
AMDSMI_TEMP_CRITICAL, &temperature);
if (ret != amdsmi_status_t::AMDSMI_STATUS_NOT_SUPPORTED) {
CHK_AMDSMI_RET(ret)
@@ -440,10 +440,10 @@ int main() {
// Get temperature measurements
// amdsmi_temperature_t edge_temp, hotspot_temp, vram_temp,
// plx_temp;
int64_t temp_measurements[TEMPERATURE_TYPE__MAX + 1];
int64_t temp_measurements[AMDSMI_TEMPERATURE_TYPE__MAX + 1];
amdsmi_temperature_type_t temp_types[4] = {
TEMPERATURE_TYPE_EDGE, TEMPERATURE_TYPE_HOTSPOT,
TEMPERATURE_TYPE_VRAM, TEMPERATURE_TYPE_PLX};
AMDSMI_TEMPERATURE_TYPE_EDGE, AMDSMI_TEMPERATURE_TYPE_HOTSPOT,
AMDSMI_TEMPERATURE_TYPE_VRAM, AMDSMI_TEMPERATURE_TYPE_PLX};
for (const auto &temp_type : temp_types) {
ret = amdsmi_get_temp_metric(
processor_handles[j], temp_type,
@@ -455,13 +455,13 @@ int main() {
}
printf(" Output of amdsmi_get_temp_metric:\n");
printf("\tGPU Edge temp measurement: %ld\n",
temp_measurements[TEMPERATURE_TYPE_EDGE]);
temp_measurements[AMDSMI_TEMPERATURE_TYPE_EDGE]);
printf("\tGPU Hotspot temp measurement: %ld\n",
temp_measurements[TEMPERATURE_TYPE_HOTSPOT]);
temp_measurements[AMDSMI_TEMPERATURE_TYPE_HOTSPOT]);
printf("\tGPU VRAM temp measurement: %ld\n",
temp_measurements[TEMPERATURE_TYPE_VRAM]);
temp_measurements[AMDSMI_TEMPERATURE_TYPE_VRAM]);
printf("\tGPU PLX temp measurement: %ld\n\n",
temp_measurements[TEMPERATURE_TYPE_PLX]);
temp_measurements[AMDSMI_TEMPERATURE_TYPE_PLX]);
// Get RAS features enabled
char block_names[14][10] = {"UMC", "SDMA", "GFX", "MMHUB",
@@ -542,10 +542,10 @@ int main() {
uint64_t gfx = 0, enc = 0;
char bdf_str[20];
sprintf(bdf_str, "%04lx:%02x:%02x.%d",
bdf.fields.domain_number,
bdf.fields.bus_number,
bdf.fields.device_number,
bdf.fields.function_number);
bdf.domain_number,
bdf.bus_number,
bdf.device_number,
bdf.function_number);
int num = 0;
ret = amdsmi_get_gpu_process_list(processor_handles[j], &num_process, process_info_list);
std::cout << "Allocation size for process list: " << num_process << "\n";
@@ -635,7 +635,7 @@ int main() {
// Get temperature
int64_t val_i64 = 0;
ret = amdsmi_get_temp_metric(processor_handles[j], TEMPERATURE_TYPE_EDGE,
ret = amdsmi_get_temp_metric(processor_handles[j], AMDSMI_TEMPERATURE_TYPE_EDGE,
AMDSMI_TEMP_CURRENT, &val_i64);
if (ret != amdsmi_status_t::AMDSMI_STATUS_NOT_SUPPORTED) {
CHK_AMDSMI_RET(ret)
@@ -674,10 +674,10 @@ int main() {
CHK_AMDSMI_RET(ret)
printf(" Output of amdsmi_get_gpu_metrics_info:\n");
printf("\tDevice[%d] BDF %04lx:%02x:%02x.%d\n\n", i,
bdf.fields.domain_number,
bdf.fields.bus_number,
bdf.fields.device_number,
bdf.fields.function_number);
bdf.domain_number,
bdf.bus_number,
bdf.device_number,
bdf.function_number);
std::cout << "\t**.common_header.format_revision : "
<< print_unsigned_int(gpu_metrics.common_header.format_revision) << "\n";
@@ -113,12 +113,12 @@ int main() {
// For each device of the socket, get name and temperature.
for (uint32_t j = 0; j < device_count; j++) {
// Get device type. Since the amdsmi is initialized with
// AMD_SMI_INIT_AMD_GPUS, the processor_type must be AMD_GPU.
// AMD_SMI_INIT_AMD_GPUS, the processor_type must be AMDSMI_PROCESSOR_TYPE_AMD_GPU.
processor_type_t processor_type = {};
ret = amdsmi_get_processor_type(processor_handles[j], &processor_type);
CHK_AMDSMI_RET(ret)
if (processor_type != AMD_GPU) {
std::cout << "Expect AMD_GPU device type!\n";
if (processor_type != AMDSMI_PROCESSOR_TYPE_AMD_GPU) {
std::cout << "Expect AMDSMI_PROCESSOR_TYPE_AMD_GPU device type!\n";
return AMDSMI_STATUS_NOT_SUPPORTED;
}
@@ -137,10 +137,10 @@ int main() {
CHK_AMDSMI_RET(ret)
printf(" Output of amdsmi_get_gpu_device_bdf:\n");
printf("\tDevice[%d] BDF %04lx:%02x:%02x.%d\n\n", i,
bdf.fields.domain_number,
bdf.fields.bus_number,
bdf.fields.device_number,
bdf.fields.function_number);
bdf.domain_number,
bdf.bus_number,
bdf.device_number,
bdf.function_number);
amdsmi_asic_info_t asic_info = {};
ret = amdsmi_get_gpu_asic_info(processor_handles[j], &asic_info);
@@ -183,63 +183,63 @@ int main() {
printf(" Output of amdsmi_get_fw_info:\n");
printf("\tFirmware version: %d\n", fw_information.num_fw_info);
printf("\tSMU: %ld\n",
fw_information.fw_info_list[amdsmi_fw_block_t::FW_ID_SMU]
fw_information.fw_info_list[amdsmi_fw_block_t::AMDSMI_FW_ID_SMU]
.fw_version);
printf("\tPM: %ld\n",
fw_information.fw_info_list[amdsmi_fw_block_t::FW_ID_PM]
fw_information.fw_info_list[amdsmi_fw_block_t::AMDSMI_FW_ID_PM]
.fw_version);
printf("\tVCN: %ld\n",
fw_information.fw_info_list[amdsmi_fw_block_t::FW_ID_VCN]
fw_information.fw_info_list[amdsmi_fw_block_t::AMDSMI_FW_ID_VCN]
.fw_version);
printf("\tCP_ME: %ld\n",
fw_information.fw_info_list[amdsmi_fw_block_t::FW_ID_CP_ME]
fw_information.fw_info_list[amdsmi_fw_block_t::AMDSMI_FW_ID_CP_ME]
.fw_version);
printf("\tCP_PFP: %ld\n",
fw_information.fw_info_list[amdsmi_fw_block_t::FW_ID_CP_PFP]
fw_information.fw_info_list[amdsmi_fw_block_t::AMDSMI_FW_ID_CP_PFP]
.fw_version);
printf("\tCP_CE: %ld\n",
fw_information.fw_info_list[amdsmi_fw_block_t::FW_ID_CP_CE]
fw_information.fw_info_list[amdsmi_fw_block_t::AMDSMI_FW_ID_CP_CE]
.fw_version);
printf("\tRLC: %ld\n",
fw_information.fw_info_list[amdsmi_fw_block_t::FW_ID_RLC]
fw_information.fw_info_list[amdsmi_fw_block_t::AMDSMI_FW_ID_RLC]
.fw_version);
printf("\tCP_MEC1: %ld\n",
fw_information.fw_info_list[amdsmi_fw_block_t::FW_ID_CP_MEC1]
fw_information.fw_info_list[amdsmi_fw_block_t::AMDSMI_FW_ID_CP_MEC1]
.fw_version);
printf("\tCP_MEC2: %ld\n",
fw_information.fw_info_list[amdsmi_fw_block_t::FW_ID_CP_MEC2]
fw_information.fw_info_list[amdsmi_fw_block_t::AMDSMI_FW_ID_CP_MEC2]
.fw_version);
printf("\tSDMA0: %ld\n",
fw_information.fw_info_list[amdsmi_fw_block_t::FW_ID_SDMA0]
fw_information.fw_info_list[amdsmi_fw_block_t::AMDSMI_FW_ID_SDMA0]
.fw_version);
printf("\tMC: %ld\n",
fw_information.fw_info_list[amdsmi_fw_block_t::FW_ID_MC]
fw_information.fw_info_list[amdsmi_fw_block_t::AMDSMI_FW_ID_MC]
.fw_version);
printf("\tRLC RESTORE LIST CNTL: %ld\n",
fw_information
.fw_info_list
[amdsmi_fw_block_t::FW_ID_RLC_RESTORE_LIST_CNTL]
[amdsmi_fw_block_t::AMDSMI_FW_ID_RLC_RESTORE_LIST_CNTL]
.fw_version);
printf("\tRLC RESTORE LIST GPM MEM: %ld\n",
fw_information
.fw_info_list
[amdsmi_fw_block_t::FW_ID_RLC_RESTORE_LIST_GPM_MEM]
[amdsmi_fw_block_t::AMDSMI_FW_ID_RLC_RESTORE_LIST_GPM_MEM]
.fw_version);
printf("\tRLC RESTORE LIST SRM MEM: %ld\n",
fw_information
.fw_info_list
[amdsmi_fw_block_t::FW_ID_RLC_RESTORE_LIST_SRM_MEM]
[amdsmi_fw_block_t::AMDSMI_FW_ID_RLC_RESTORE_LIST_SRM_MEM]
.fw_version);
printf(
"\tPSP SOSDRV: %ld\n\n",
fw_information.fw_info_list[amdsmi_fw_block_t::FW_ID_PSP_SOSDRV]
fw_information.fw_info_list[amdsmi_fw_block_t::AMDSMI_FW_ID_PSP_SOSDRV]
.fw_version);
// Get temperature measurements
int64_t temp_measurements[TEMPERATURE_TYPE__MAX + 1];
int64_t temp_measurements[AMDSMI_TEMPERATURE_TYPE__MAX + 1];
amdsmi_temperature_type_t temp_types[4] = {
TEMPERATURE_TYPE_EDGE, TEMPERATURE_TYPE_HOTSPOT,
TEMPERATURE_TYPE_VRAM, TEMPERATURE_TYPE_PLX};
AMDSMI_TEMPERATURE_TYPE_EDGE, AMDSMI_TEMPERATURE_TYPE_HOTSPOT,
AMDSMI_TEMPERATURE_TYPE_VRAM, AMDSMI_TEMPERATURE_TYPE_PLX};
for (const auto &temp_type : temp_types) {
ret = amdsmi_get_temp_metric(
processor_handles[j], temp_type,
@@ -249,13 +249,13 @@ int main() {
}
printf(" Output of amdsmi_get_temp_metric:\n");
printf("\tGPU Edge temp measurement: %ld\n",
temp_measurements[TEMPERATURE_TYPE_EDGE]);
temp_measurements[AMDSMI_TEMPERATURE_TYPE_EDGE]);
printf("\tGPU Hotspot temp measurement: %ld\n",
temp_measurements[TEMPERATURE_TYPE_HOTSPOT]);
temp_measurements[AMDSMI_TEMPERATURE_TYPE_HOTSPOT]);
printf("\tGPU VRAM temp measurement: %ld\n",
temp_measurements[TEMPERATURE_TYPE_VRAM]);
temp_measurements[AMDSMI_TEMPERATURE_TYPE_VRAM]);
printf("\tGPU PLX temp measurement: %ld\n\n",
temp_measurements[TEMPERATURE_TYPE_PLX]);
temp_measurements[AMDSMI_TEMPERATURE_TYPE_PLX]);
// Get bad pages
char bad_page_status_names[3][15] = {"RESERVED", "PENDING",
@@ -310,7 +310,7 @@ int main() {
// Get temperature
int64_t val_i64 = 0;
ret = amdsmi_get_temp_metric(processor_handles[j], TEMPERATURE_TYPE_EDGE,
ret = amdsmi_get_temp_metric(processor_handles[j], AMDSMI_TEMPERATURE_TYPE_EDGE,
AMDSMI_TEMP_CURRENT, &val_i64);
CHK_AMDSMI_RET(ret)
printf(" Output of amdsmi_get_temp_metric:\n");
@@ -333,10 +333,10 @@ int main() {
<< "W\n\n";
amdsmi_dpm_policy_t policy;
ret = amdsmi_get_dpm_policy(processor_handles[j], &policy);
ret = amdsmi_get_soc_pstate(processor_handles[j], &policy);
if (ret != AMDSMI_STATUS_NOT_SUPPORTED) {
CHK_AMDSMI_RET(ret)
std::cout << "\t amdsmi_get_dpm_policy total:" << policy.num_supported
std::cout << "\t amdsmi_get_soc_pstate total:" << policy.num_supported
<<" current:" << policy.current << "\n";
for (int x=0; x < policy.num_supported; x++) {
std::cout << x <<": (" << policy.policies[x].policy_id
@@ -104,8 +104,8 @@ int main(int argc, char **argv) {
uint32_t cpu_count = 0;
uint32_t core_count = 0;
// Set processor type as AMD_CPU
processor_type_t processor_type = AMD_CPU;
// Set processor type as AMDSMI_PROCESSOR_TYPE_AMD_CPU
processor_type_t processor_type = AMDSMI_PROCESSOR_TYPE_AMD_CPU;
ret = amdsmi_get_processor_handles_by_type(sockets[i], processor_type, nullptr, &cpu_count);
CHK_AMDSMI_RET(ret)
@@ -116,8 +116,8 @@ int main(int argc, char **argv) {
ret = amdsmi_get_processor_handles_by_type(sockets[i], processor_type, &plist[0], &cpu_count);
CHK_AMDSMI_RET(ret)
// Set processor type as AMD_CPU_CORE
processor_type = AMD_CPU_CORE;
// Set processor type as AMDSMI_PROCESSOR_TYPE_AMD_CPU_CORE
processor_type = AMDSMI_PROCESSOR_TYPE_AMD_CPU_CORE;
ret = amdsmi_get_processor_handles_by_type(sockets[i], processor_type, nullptr, &core_count);
CHK_AMDSMI_RET(ret)
+177 -168
Wyświetl plik
@@ -151,10 +151,10 @@ typedef enum {
#define AMDSMI_LIB_VERSION_YEAR 24
//! Major version should be changed for every header change (adding/deleting APIs, changing names, fields of structures, etc.)
#define AMDSMI_LIB_VERSION_MAJOR 5
#define AMDSMI_LIB_VERSION_MAJOR 6
//! Minor version should be updated for each API change, but without changing headers
#define AMDSMI_LIB_VERSION_MINOR 3
#define AMDSMI_LIB_VERSION_MINOR 0
//! Release version should be set to 0 as default and can be updated by the PMs for each CSP point release
#define AMDSMI_LIB_VERSION_RELEASE 0
@@ -171,8 +171,8 @@ typedef enum {
} amdsmi_mm_ip_t;
typedef enum {
CONTAINER_LXC,
CONTAINER_DOCKER,
AMDSMI_CONTAINER_LXC,
AMDSMI_CONTAINER_DOCKER,
} amdsmi_container_types_t;
//! opaque handler point to underlying implementation
@@ -184,18 +184,18 @@ typedef void *amdsmi_cpusocket_handle;
/**
* @brief Processor types detectable by AMD SMI
* AMD_CPU - CPU Socket is a physical component that holds the CPU.
* AMD_CPU_CORE - CPU Cores are number of individual processing units within the CPU.
* AMD_APU - Combination of AMD_CPU and integrated GPU on single die
* AMDSMI_PROCESSOR_TYPE_AMD_CPU - CPU Socket is a physical component that holds the CPU.
* AMDSMI_PROCESSOR_TYPE_AMD_CPU_CORE - CPU Cores are number of individual processing units within the CPU.
* AMDSMI_PROCESSOR_TYPE_AMD_APU - Combination of AMDSMI_PROCESSOR_TYPE_AMD_CPU and integrated GPU on single die
*/
typedef enum {
UNKNOWN = 0,
AMD_GPU,
AMD_CPU,
NON_AMD_GPU,
NON_AMD_CPU,
AMD_CPU_CORE,
AMD_APU
AMDSMI_PROCESSOR_TYPE_UNKNOWN = 0,
AMDSMI_PROCESSOR_TYPE_AMD_GPU,
AMDSMI_PROCESSOR_TYPE_AMD_CPU,
AMDSMI_PROCESSOR_TYPE_NON_AMD_GPU,
AMDSMI_PROCESSOR_TYPE_NON_AMD_CPU,
AMDSMI_PROCESSOR_TYPE_AMD_CPU_CORE,
AMDSMI_PROCESSOR_TYPE_AMD_APU
} processor_type_t;
/**
@@ -238,15 +238,15 @@ typedef enum {
AMDSMI_STATUS_UNEXPECTED_DATA = 43, //!< The data read or provided to function is not what was expected
//esmi errors
AMDSMI_STATUS_NON_AMD_CPU = 44, //!< System has different cpu than AMD
AMDSMI_NO_ENERGY_DRV = 45, //!< Energy driver not found
AMDSMI_NO_MSR_DRV = 46, //!< MSR driver not found
AMDSMI_NO_HSMP_DRV = 47, //!< HSMP driver not found
AMDSMI_NO_HSMP_SUP = 48, //!< HSMP not supported
AMDSMI_NO_HSMP_MSG_SUP = 49, //!< HSMP message/feature not supported
AMDSMI_HSMP_TIMEOUT = 50, //!< HSMP message is timedout
AMDSMI_NO_DRV = 51, //!< No Energy and HSMP driver present
AMDSMI_FILE_NOT_FOUND = 52, //!< file or directory not found
AMDSMI_ARG_PTR_NULL = 53, //!< Parsed argument is invalid
AMDSMI_STATUS_NO_ENERGY_DRV = 45, //!< Energy driver not found
AMDSMI_STATUS_NO_MSR_DRV = 46, //!< MSR driver not found
AMDSMI_STATUS_NO_HSMP_DRV = 47, //!< HSMP driver not found
AMDSMI_STATUS_NO_HSMP_SUP = 48, //!< HSMP not supported
AMDSMI_STATUS_NO_HSMP_MSG_SUP = 49, //!< HSMP message/feature not supported
AMDSMI_STATUS_HSMP_TIMEOUT = 50, //!< HSMP message is timedout
AMDSMI_STATUS_NO_DRV = 51, //!< No Energy and HSMP driver present
AMDSMI_STATUS_FILE_NOT_FOUND = 52, //!< file or directory not found
AMDSMI_STATUS_ARG_PTR_NULL = 53, //!< Parsed argument is invalid
AMDSMI_STATUS_AMDGPU_RESTART_ERR = 54, //!< AMDGPU restart failed
AMDSMI_STATUS_SETTING_UNAVAILABLE = 55, //!< Setting is not available
@@ -256,23 +256,23 @@ typedef enum {
} amdsmi_status_t;
/**
* Clock types
* @brief Clock types
*/
typedef enum {
CLK_TYPE_SYS = 0x0, //!< System clock
CLK_TYPE_FIRST = CLK_TYPE_SYS,
CLK_TYPE_GFX = CLK_TYPE_SYS,
CLK_TYPE_DF, //!< Data Fabric clock (for ASICs
//!< running on a separate clock)
CLK_TYPE_DCEF, //!< Display Controller Engine clock
CLK_TYPE_SOC,
CLK_TYPE_MEM,
CLK_TYPE_PCIE,
CLK_TYPE_VCLK0,
CLK_TYPE_VCLK1,
CLK_TYPE_DCLK0,
CLK_TYPE_DCLK1,
CLK_TYPE__MAX = CLK_TYPE_DCLK1
AMDSMI_CLK_TYPE_SYS = 0x0, //!< System clock
AMDSMI_CLK_TYPE_FIRST = AMDSMI_CLK_TYPE_SYS,
AMDSMI_CLK_TYPE_GFX = AMDSMI_CLK_TYPE_SYS,
AMDSMI_CLK_TYPE_DF, //!< Data Fabric clock (for ASICs
//!< running on a separate clock)
AMDSMI_CLK_TYPE_DCEF, //!< Display Controller Engine clock
AMDSMI_CLK_TYPE_SOC,
AMDSMI_CLK_TYPE_MEM,
AMDSMI_CLK_TYPE_PCIE,
AMDSMI_CLK_TYPE_VCLK0,
AMDSMI_CLK_TYPE_VCLK1,
AMDSMI_CLK_TYPE_DCLK0,
AMDSMI_CLK_TYPE_DCLK1,
AMDSMI_CLK_TYPE__MAX = AMDSMI_CLK_TYPE_DCLK1
} amdsmi_clk_type_t;
/**
@@ -280,16 +280,16 @@ typedef enum {
* various compute partitioning settings.
*/
typedef enum {
COMPUTE_PARTITION_INVALID = 0,
COMPUTE_PARTITION_CPX, //!< Core mode (CPX)- Per-chip XCC with
AMDSMI_COMPUTE_PARTITION_INVALID = 0,
AMDSMI_COMPUTE_PARTITION_CPX, //!< Core mode (CPX)- Per-chip XCC with
//!< shared memory
COMPUTE_PARTITION_SPX, //!< Single GPU mode (SPX)- All XCCs work
AMDSMI_COMPUTE_PARTITION_SPX, //!< Single GPU mode (SPX)- All XCCs work
//!< together with shared memory
COMPUTE_PARTITION_DPX, //!< Dual GPU mode (DPX)- Half XCCs work
AMDSMI_COMPUTE_PARTITION_DPX, //!< Dual GPU mode (DPX)- Half XCCs work
//!< together with shared memory
COMPUTE_PARTITION_TPX, //!< Triple GPU mode (TPX)- One-third XCCs
AMDSMI_COMPUTE_PARTITION_TPX, //!< Triple GPU mode (TPX)- One-third XCCs
//!< work together with shared memory
COMPUTE_PARTITION_QPX //!< Quad GPU mode (QPX)- Quarter XCCs
AMDSMI_COMPUTE_PARTITION_QPX //!< Quad GPU mode (QPX)- Quarter XCCs
//!< work together with shared memory
} amdsmi_compute_partition_type_t;
@@ -298,16 +298,16 @@ typedef enum {
* memory partition types.
*/
typedef enum {
MEMORY_PARTITION_UNKNOWN = 0,
MEMORY_PARTITION_NPS1, //!< NPS1 - All CCD & XCD data is interleaved
AMDSMI_MEMORY_PARTITION_UNKNOWN = 0,
AMDSMI_MEMORY_PARTITION_NPS1, //!< NPS1 - All CCD & XCD data is interleaved
//!< accross all 8 HBM stacks (all stacks/1).
MEMORY_PARTITION_NPS2, //!< NPS2 - 2 sets of CCDs or 4 XCD interleaved
AMDSMI_MEMORY_PARTITION_NPS2, //!< NPS2 - 2 sets of CCDs or 4 XCD interleaved
//!< accross the 4 HBM stacks per AID pair
//!< (8 stacks/2).
MEMORY_PARTITION_NPS4, //!< NPS4 - Each XCD data is interleaved accross
AMDSMI_MEMORY_PARTITION_NPS4, //!< NPS4 - Each XCD data is interleaved accross
//!< accross 2 (or single) HBM stacks
//!< (8 stacks/8 or 8 stacks/4).
MEMORY_PARTITION_NPS8, //!< NPS8 - Each XCD uses a single HBM stack
AMDSMI_MEMORY_PARTITION_NPS8, //!< NPS8 - Each XCD uses a single HBM stack
//!< (8 stacks/8). Or each XCD uses a single
//!< HBM stack & CCDs share 2 non-interleaved
//!< HBM stacks on its AID
@@ -319,17 +319,17 @@ typedef enum {
* temperature reading should be obtained.
*/
typedef enum {
TEMPERATURE_TYPE_EDGE,
TEMPERATURE_TYPE_FIRST = TEMPERATURE_TYPE_EDGE,
TEMPERATURE_TYPE_HOTSPOT,
TEMPERATURE_TYPE_JUNCTION = TEMPERATURE_TYPE_HOTSPOT,
TEMPERATURE_TYPE_VRAM,
TEMPERATURE_TYPE_HBM_0,
TEMPERATURE_TYPE_HBM_1,
TEMPERATURE_TYPE_HBM_2,
TEMPERATURE_TYPE_HBM_3,
TEMPERATURE_TYPE_PLX,
TEMPERATURE_TYPE__MAX = TEMPERATURE_TYPE_PLX
AMDSMI_TEMPERATURE_TYPE_EDGE,
AMDSMI_TEMPERATURE_TYPE_FIRST = AMDSMI_TEMPERATURE_TYPE_EDGE,
AMDSMI_TEMPERATURE_TYPE_HOTSPOT,
AMDSMI_TEMPERATURE_TYPE_JUNCTION = AMDSMI_TEMPERATURE_TYPE_HOTSPOT,
AMDSMI_TEMPERATURE_TYPE_VRAM,
AMDSMI_TEMPERATURE_TYPE_HBM_0,
AMDSMI_TEMPERATURE_TYPE_HBM_1,
AMDSMI_TEMPERATURE_TYPE_HBM_2,
AMDSMI_TEMPERATURE_TYPE_HBM_3,
AMDSMI_TEMPERATURE_TYPE_PLX,
AMDSMI_TEMPERATURE_TYPE__MAX = AMDSMI_TEMPERATURE_TYPE_PLX
} amdsmi_temperature_type_t;
/**
@@ -337,101 +337,108 @@ typedef enum {
* blocks.
*/
typedef enum {
FW_ID_SMU = 1,
FW_ID_FIRST = FW_ID_SMU,
FW_ID_CP_CE,
FW_ID_CP_PFP,
FW_ID_CP_ME,
FW_ID_CP_MEC_JT1,
FW_ID_CP_MEC_JT2,
FW_ID_CP_MEC1,
FW_ID_CP_MEC2,
FW_ID_RLC,
FW_ID_SDMA0,
FW_ID_SDMA1,
FW_ID_SDMA2,
FW_ID_SDMA3,
FW_ID_SDMA4,
FW_ID_SDMA5,
FW_ID_SDMA6,
FW_ID_SDMA7,
FW_ID_VCN,
FW_ID_UVD,
FW_ID_VCE,
FW_ID_ISP,
FW_ID_DMCU_ERAM, /*eRAM*/
FW_ID_DMCU_ISR, /*ISR*/
FW_ID_RLC_RESTORE_LIST_GPM_MEM,
FW_ID_RLC_RESTORE_LIST_SRM_MEM,
FW_ID_RLC_RESTORE_LIST_CNTL,
FW_ID_RLC_V,
FW_ID_MMSCH,
FW_ID_PSP_SYSDRV,
FW_ID_PSP_SOSDRV,
FW_ID_PSP_TOC,
FW_ID_PSP_KEYDB,
FW_ID_DFC,
FW_ID_PSP_SPL,
FW_ID_DRV_CAP,
FW_ID_MC,
FW_ID_PSP_BL,
FW_ID_CP_PM4,
FW_ID_RLC_P,
FW_ID_SEC_POLICY_STAGE2,
FW_ID_REG_ACCESS_WHITELIST,
FW_ID_IMU_DRAM,
FW_ID_IMU_IRAM,
FW_ID_SDMA_TH0,
FW_ID_SDMA_TH1,
FW_ID_CP_MES,
FW_ID_MES_KIQ,
FW_ID_MES_STACK,
FW_ID_MES_THREAD1,
FW_ID_MES_THREAD1_STACK,
FW_ID_RLX6,
FW_ID_RLX6_DRAM_BOOT,
FW_ID_RS64_ME,
FW_ID_RS64_ME_P0_DATA,
FW_ID_RS64_ME_P1_DATA,
FW_ID_RS64_PFP,
FW_ID_RS64_PFP_P0_DATA,
FW_ID_RS64_PFP_P1_DATA,
FW_ID_RS64_MEC,
FW_ID_RS64_MEC_P0_DATA,
FW_ID_RS64_MEC_P1_DATA,
FW_ID_RS64_MEC_P2_DATA,
FW_ID_RS64_MEC_P3_DATA,
FW_ID_PPTABLE,
FW_ID_PSP_SOC,
FW_ID_PSP_DBG,
FW_ID_PSP_INTF,
FW_ID_RLX6_CORE1,
FW_ID_RLX6_DRAM_BOOT_CORE1,
FW_ID_RLCV_LX7,
FW_ID_RLC_SAVE_RESTORE_LIST,
FW_ID_ASD,
FW_ID_TA_RAS,
FW_ID_TA_XGMI,
FW_ID_RLC_SRLG,
FW_ID_RLC_SRLS,
FW_ID_PM,
FW_ID_DMCU,
FW_ID__MAX
AMDSMI_FW_ID_SMU = 1,
AMDSMI_FW_ID_FIRST = AMDSMI_FW_ID_SMU,
AMDSMI_FW_ID_CP_CE,
AMDSMI_FW_ID_CP_PFP,
AMDSMI_FW_ID_CP_ME,
AMDSMI_FW_ID_CP_MEC_JT1,
AMDSMI_FW_ID_CP_MEC_JT2,
AMDSMI_FW_ID_CP_MEC1,
AMDSMI_FW_ID_CP_MEC2,
AMDSMI_FW_ID_RLC,
AMDSMI_FW_ID_SDMA0,
AMDSMI_FW_ID_SDMA1,
AMDSMI_FW_ID_SDMA2,
AMDSMI_FW_ID_SDMA3,
AMDSMI_FW_ID_SDMA4,
AMDSMI_FW_ID_SDMA5,
AMDSMI_FW_ID_SDMA6,
AMDSMI_FW_ID_SDMA7,
AMDSMI_FW_ID_VCN,
AMDSMI_FW_ID_UVD,
AMDSMI_FW_ID_VCE,
AMDSMI_FW_ID_ISP,
AMDSMI_FW_ID_DMCU_ERAM, /*eRAM*/
AMDSMI_FW_ID_DMCU_ISR, /*ISR*/
AMDSMI_FW_ID_RLC_RESTORE_LIST_GPM_MEM,
AMDSMI_FW_ID_RLC_RESTORE_LIST_SRM_MEM,
AMDSMI_FW_ID_RLC_RESTORE_LIST_CNTL,
AMDSMI_FW_ID_RLC_V,
AMDSMI_FW_ID_MMSCH,
AMDSMI_FW_ID_PSP_SYSDRV,
AMDSMI_FW_ID_PSP_SOSDRV,
AMDSMI_FW_ID_PSP_TOC,
AMDSMI_FW_ID_PSP_KEYDB,
AMDSMI_FW_ID_DFC,
AMDSMI_FW_ID_PSP_SPL,
AMDSMI_FW_ID_DRV_CAP,
AMDSMI_FW_ID_MC,
AMDSMI_FW_ID_PSP_BL,
AMDSMI_FW_ID_CP_PM4,
AMDSMI_FW_ID_RLC_P,
AMDSMI_FW_ID_SEC_POLICY_STAGE2,
AMDSMI_FW_ID_REG_ACCESS_WHITELIST,
AMDSMI_FW_ID_IMU_DRAM,
AMDSMI_FW_ID_IMU_IRAM,
AMDSMI_FW_ID_SDMA_TH0,
AMDSMI_FW_ID_SDMA_TH1,
AMDSMI_FW_ID_CP_MES,
AMDSMI_FW_ID_MES_KIQ,
AMDSMI_FW_ID_MES_STACK,
AMDSMI_FW_ID_MES_THREAD1,
AMDSMI_FW_ID_MES_THREAD1_STACK,
AMDSMI_FW_ID_RLX6,
AMDSMI_FW_ID_RLX6_DRAM_BOOT,
AMDSMI_FW_ID_RS64_ME,
AMDSMI_FW_ID_RS64_ME_P0_DATA,
AMDSMI_FW_ID_RS64_ME_P1_DATA,
AMDSMI_FW_ID_RS64_PFP,
AMDSMI_FW_ID_RS64_PFP_P0_DATA,
AMDSMI_FW_ID_RS64_PFP_P1_DATA,
AMDSMI_FW_ID_RS64_MEC,
AMDSMI_FW_ID_RS64_MEC_P0_DATA,
AMDSMI_FW_ID_RS64_MEC_P1_DATA,
AMDSMI_FW_ID_RS64_MEC_P2_DATA,
AMDSMI_FW_ID_RS64_MEC_P3_DATA,
AMDSMI_FW_ID_PPTABLE,
AMDSMI_FW_ID_PSP_SOC,
AMDSMI_FW_ID_PSP_DBG,
AMDSMI_FW_ID_PSP_INTF,
AMDSMI_FW_ID_RLX6_CORE1,
AMDSMI_FW_ID_RLX6_DRAM_BOOT_CORE1,
AMDSMI_FW_ID_RLCV_LX7,
AMDSMI_FW_ID_RLC_SAVE_RESTORE_LIST,
AMDSMI_FW_ID_ASD,
AMDSMI_FW_ID_TA_RAS,
AMDSMI_FW_ID_TA_XGMI,
AMDSMI_FW_ID_RLC_SRLG,
AMDSMI_FW_ID_RLC_SRLS,
AMDSMI_FW_ID_PM,
AMDSMI_FW_ID_DMCU,
AMDSMI_FW_ID__MAX
} amdsmi_fw_block_t;
typedef enum {
VRAM_TYPE_UNKNOWN = 0,
VRAM_TYPE_GDDR1 = 1,
VRAM_TYPE_DDR2 = 2,
VRAM_TYPE_GDDR3 = 3,
VRAM_TYPE_GDDR4 = 4,
VRAM_TYPE_GDDR5 = 5,
VRAM_TYPE_HBM = 6,
VRAM_TYPE_DDR3 = 7,
VRAM_TYPE_DDR4 = 8,
VRAM_TYPE_GDDR6 = 9,
VRAM_TYPE__MAX = VRAM_TYPE_GDDR6
AMDSMI_VRAM_TYPE_UNKNOWN = 0,
// HBM
AMDSMI_VRAM_TYPE_HBM = 1,
AMDSMI_VRAM_TYPE_HBM2 = 2,
AMDSMI_VRAM_TYPE_HBM2E = 3,
AMDSMI_VRAM_TYPE_HBM3 = 4,
// DDR
AMDSMI_VRAM_TYPE_DDR2 = 10,
AMDSMI_VRAM_TYPE_DDR3 = 11,
AMDSMI_VRAM_TYPE_DDR4 = 12,
// GDDR
AMDSMI_VRAM_TYPE_GDDR1 = 17,
AMDSMI_VRAM_TYPE_GDDR2 = 18,
AMDSMI_VRAM_TYPE_GDDR3 = 19,
AMDSMI_VRAM_TYPE_GDDR4 = 20,
AMDSMI_VRAM_TYPE_GDDR5 = 21,
AMDSMI_VRAM_TYPE_GDDR6 = 22,
AMDSMI_VRAM_TYPE_GDDR7 = 23,
AMDSMI_VRAM_TYPE__MAX = AMDSMI_VRAM_TYPE_GDDR7
} amdsmi_vram_type_t;
typedef enum {
@@ -483,12 +490,12 @@ typedef struct {
} amdsmi_frequency_range_t;
typedef union {
struct fields_ {
struct {
uint64_t function_number : 3;
uint64_t device_number : 5;
uint64_t bus_number : 8;
uint64_t domain_number : 48;
} fields;
};
uint64_t as_uint;
} amdsmi_bdf_t;
@@ -568,7 +575,7 @@ typedef struct {
amdsmi_fw_block_t fw_id;
uint64_t fw_version;
uint64_t reserved[2];
} fw_info_list[FW_ID__MAX];
} fw_info_list[AMDSMI_FW_ID__MAX];
uint32_t reserved[7];
} amdsmi_fw_info_t;
@@ -608,7 +615,8 @@ typedef struct {
typedef struct {
amdsmi_vram_type_t vram_type;
amdsmi_vram_vendor_type_t vram_vendor;
uint64_t vram_size_mb;
uint64_t vram_size;
uint64_t reserved[6];
} amdsmi_vram_info_t;
@@ -638,10 +646,11 @@ typedef struct {
} amdsmi_power_info_t;
typedef struct {
uint32_t cur_clk;
uint32_t clk;
uint32_t min_clk;
uint32_t max_clk;
uint32_t sleep_clk;
uint8_t clk_locked;
uint8_t clk_deep_sleep;
uint32_t reserved[4];
} amdsmi_clk_info_t;
@@ -3375,45 +3384,45 @@ amdsmi_status_t amdsmi_set_clk_freq(amdsmi_processor_handle processor_handle,
amdsmi_clk_type_t clk_type, uint64_t freq_bitmask);
/**
* @brief Get the dpm policy for the processor
* @brief Get the soc pstate policy for the processor
*
* @platform{gpu_bm_linux} @platform{guest_1vf}
*
* @details Given a processor handle @p processor_handle, this function will write
* current dpm policy settings to @p policy. All the processors at the same socket
* current soc pstate policy settings to @p policy. All the processors at the same socket
* will have the same policy.
*
* @param[in] processor_handle a processor handle
*
* @param[in, out] policy the dpm policy for this processor.
* @param[in, out] policy the soc pstate policy for this processor.
* If this parameter is nullptr, this function will return
* ::AMDSMI_STATUS_INVAL
*
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
*/
amdsmi_status_t amdsmi_get_dpm_policy(amdsmi_processor_handle processor_handle,
amdsmi_status_t amdsmi_get_soc_pstate(amdsmi_processor_handle processor_handle,
amdsmi_dpm_policy_t* policy);
/**
* @brief Set the dpm policy for the processor
* @brief Set the soc pstate policy for the processor
*
* @platform{gpu_bm_linux} @platform{guest_1vf}
*
* @details Given a processor handle @p processor_handle and a dpm policy @p policy_id,
* this function will set the dpm policy for this processor. All the processors at
* @details Given a processor handle @p processor_handle and a soc pstate policy @p policy_id,
* this function will set the soc pstate policy for this processor. All the processors at
* the same socket will be set to the same policy.
*
* @note This function requires root access
*
* @param[in] processor_handle a processor handle
*
* @param[in] policy_id the dpm policy id to set. The id is the id in
* @param[in] policy_id the soc pstate policy id to set. The id is the id in
* amdsmi_dpm_policy_entry_t, which can be obtained by calling
* amdsmi_get_dpm_policy()
* amdsmi_get_soc_pstate()
*
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
*/
amdsmi_status_t amdsmi_set_dpm_policy(amdsmi_processor_handle processor_handle,
amdsmi_status_t amdsmi_set_soc_pstate(amdsmi_processor_handle processor_handle,
uint32_t policy_id);
/**
@@ -77,8 +77,23 @@ const std::map<rsmi_status_t, amdsmi_status_t> rsmi_status_map = {
{RSMI_STATUS_UNKNOWN_ERROR, AMDSMI_STATUS_UNKNOWN_ERROR},
};
const std::map<unsigned, amdsmi_vram_type_t> vram_type_map = {
{0, AMDSMI_VRAM_TYPE_UNKNOWN},
{1, AMDSMI_VRAM_TYPE_GDDR1},
{2, AMDSMI_VRAM_TYPE_DDR2},
{3, AMDSMI_VRAM_TYPE_GDDR3},
{4, AMDSMI_VRAM_TYPE_GDDR4},
{5, AMDSMI_VRAM_TYPE_GDDR5},
{6, AMDSMI_VRAM_TYPE_HBM},
{7, AMDSMI_VRAM_TYPE_DDR3},
{8, AMDSMI_VRAM_TYPE_DDR4},
{9, AMDSMI_VRAM_TYPE_GDDR6},
};
amdsmi_status_t rsmi_to_amdsmi_status(rsmi_status_t status);
amdsmi_vram_type_t vram_type_value(unsigned type);
#ifdef ENABLE_ESMI_LIB
// Define a map of esmi status codes to amdsmi status codes
const std::map<esmi_status_t, amdsmi_status_t> esmi_status_map = {
@@ -95,15 +110,15 @@ const std::map<esmi_status_t, amdsmi_status_t> esmi_status_map = {
{ESMI_NOT_INITIALIZED, AMDSMI_STATUS_NOT_INIT},
{ESMI_UNEXPECTED_SIZE, AMDSMI_STATUS_UNEXPECTED_SIZE},
{ESMI_UNKNOWN_ERROR, AMDSMI_STATUS_UNKNOWN_ERROR},
{ESMI_NO_ENERGY_DRV, AMDSMI_NO_ENERGY_DRV},
{ESMI_NO_MSR_DRV, AMDSMI_NO_MSR_DRV},
{ESMI_NO_HSMP_DRV, AMDSMI_NO_HSMP_DRV},
{ESMI_NO_HSMP_SUP, AMDSMI_NO_HSMP_SUP},
{ESMI_NO_DRV, AMDSMI_NO_DRV},
{ESMI_FILE_NOT_FOUND, AMDSMI_FILE_NOT_FOUND},
{ESMI_ARG_PTR_NULL, AMDSMI_ARG_PTR_NULL},
{ESMI_HSMP_TIMEOUT, AMDSMI_HSMP_TIMEOUT},
{ESMI_NO_HSMP_MSG_SUP, AMDSMI_NO_HSMP_MSG_SUP},
{ESMI_NO_ENERGY_DRV, AMDSMI_STATUS_NO_ENERGY_DRV},
{ESMI_NO_MSR_DRV, AMDSMI_STATUS_NO_MSR_DRV},
{ESMI_NO_HSMP_DRV, AMDSMI_STATUS_NO_HSMP_DRV},
{ESMI_NO_HSMP_SUP, AMDSMI_STATUS_NO_HSMP_SUP},
{ESMI_NO_DRV, AMDSMI_STATUS_NO_DRV},
{ESMI_FILE_NOT_FOUND, AMDSMI_STATUS_FILE_NOT_FOUND},
{ESMI_ARG_PTR_NULL, AMDSMI_STATUS_ARG_PTR_NULL},
{ESMI_HSMP_TIMEOUT, AMDSMI_STATUS_HSMP_TIMEOUT},
{ESMI_NO_HSMP_MSG_SUP, AMDSMI_STATUS_NO_HSMP_MSG_SUP},
};
amdsmi_status_t esmi_to_amdsmi_status(esmi_status_t status);
@@ -69,10 +69,10 @@ class AMDSmiGPUDevice: public AMDSmiProcessor {
public:
AMDSmiGPUDevice(uint32_t gpu_id, uint32_t fd, std::string path, amdsmi_bdf_t bdf, AMDSmiDrm& drm):
AMDSmiProcessor(AMD_GPU), gpu_id_(gpu_id), fd_(fd), path_(path), bdf_(bdf), drm_(drm) {}
AMDSmiProcessor(AMDSMI_PROCESSOR_TYPE_AMD_GPU), gpu_id_(gpu_id), fd_(fd), path_(path), bdf_(bdf), drm_(drm) {}
AMDSmiGPUDevice(uint32_t gpu_id, AMDSmiDrm& drm):
AMDSmiProcessor(AMD_GPU), gpu_id_(gpu_id), drm_(drm) {
AMDSmiProcessor(AMDSMI_PROCESSOR_TYPE_AMD_GPU), gpu_id_(gpu_id), drm_(drm) {
if (check_if_drm_is_supported()) this->get_drm_data();
}
~AMDSmiGPUDevice() {
@@ -62,13 +62,13 @@ class AMDSmiSocket {
uint32_t get_socket_index() { return sindex_;}
void add_processor(AMDSmiProcessor* processor) {
switch (processor->get_processor_type()) {
case AMD_GPU:
case AMDSMI_PROCESSOR_TYPE_AMD_GPU:
processors_.push_back(processor);
break;
case AMD_CPU:
case AMDSMI_PROCESSOR_TYPE_AMD_CPU:
cpu_processors_.push_back(processor);
break;
case AMD_CPU_CORE:
case AMDSMI_PROCESSOR_TYPE_AMD_CPU_CORE:
cpu_core_processors_.push_back(processor);
break;
default:
@@ -78,11 +78,11 @@ class AMDSmiSocket {
std::vector<AMDSmiProcessor*>& get_processors() { return processors_;}
std::vector<AMDSmiProcessor*>& get_processors(processor_type_t type) {
switch (type) {
case AMD_GPU:
case AMDSMI_PROCESSOR_TYPE_AMD_GPU:
return processors_;
case AMD_CPU:
case AMDSMI_PROCESSOR_TYPE_AMD_CPU:
return cpu_processors_;
case AMD_CPU_CORE:
case AMDSMI_PROCESSOR_TYPE_AMD_CPU_CORE:
return cpu_core_processors_;
default:
return processors_;
+15 -11
Wyświetl plik
@@ -461,7 +461,7 @@ Field | Description
---|---
`vram_type` | vram type
`vram_vendor` | vram vendor
`vram_size_mb` | vram size in mb
`vram_size` | vram size in mb
Exceptions that can be thrown by `amdsmi_get_gpu_vram_info` function:
@@ -481,7 +481,7 @@ try:
vram_info = amdsmi_get_gpu_vram_info(device)
print(vram_info['vram_type'])
print(vram_info['vram_vendor'])
print(vram_info['vram_size_mb'])
print(vram_info['vram_size'])
except AmdSmiException as e:
print(e)
```
@@ -769,9 +769,11 @@ Output: Dictionary with fields
Field | Description
---|---
`cur_clk` | Current clock for given clock type
`max_clk` | Maximum clock for given clock type
`clk` | Current clock for given clock type
`min_clk` | Minimum clock for given clock type
`max_clk` | Maximum clock for given clock type
`clk_locked` | flag only supported on GFX clock domain
`clk_deep_sleep` | clock deep sleep mode flag
Exceptions that can be thrown by `amdsmi_get_clock_info` function:
@@ -789,9 +791,11 @@ try:
else:
for device in devices:
clock_measure = amdsmi_get_clock_info(device, AmdSmiClkType.GFX)
print(clock_measure['cur_clk'])
print(clock_measure['clk'])
print(clock_measure['min_clk'])
print(clock_measure['max_clk'])
print(clock_measure['clk_locked'])
print(clock_measure['clk_deep_sleep'])
except AmdSmiException as e:
print(e)
```
@@ -2743,7 +2747,7 @@ except AmdSmiException as e:
print(e)
```
### amdsmi_get_dpm_policy
### amdsmi_get_soc_pstate
Description: Get dpm policy information.
@@ -2760,7 +2764,7 @@ Field | Description
`current_id` | current policy id
`policies` | list of dictionaries containing possible policies
Exceptions that can be thrown by `amdsmi_get_dpm_policy` function:
Exceptions that can be thrown by `amdsmi_get_soc_pstate` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
@@ -2775,13 +2779,13 @@ try:
print("No GPUs on machine")
else:
for device in devices:
dpm_policies = amdsmi_get_dpm_policy(device)
dpm_policies = amdsmi_get_soc_pstate(device)
print(dpm_policies)
except AmdSmiException as e:
print(e)
```
### amdsmi_set_dpm_policy
### amdsmi_set_soc_pstate
Description: Set the dpm policy to corresponding policy_id. Typically following: 0(default),1,2,3
@@ -2792,7 +2796,7 @@ Input parameters:
Output: None
Exceptions that can be thrown by `amdsmi_set_dpm_policy` function:
Exceptions that can be thrown by `amdsmi_set_soc_pstate` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
@@ -2807,7 +2811,7 @@ try:
print("No GPUs on machine")
else:
for device in devices:
amdsmi_set_dpm_policy(device, 0)
amdsmi_set_soc_pstate(device, 0)
except AmdSmiException as e:
print(e)
```
@@ -134,7 +134,7 @@ from .amdsmi_interface import amdsmi_set_gpu_fan_speed
from .amdsmi_interface import amdsmi_reset_gpu_fan
from .amdsmi_interface import amdsmi_set_clk_freq
from .amdsmi_interface import amdsmi_set_gpu_overdrive_level
from .amdsmi_interface import amdsmi_set_dpm_policy
from .amdsmi_interface import amdsmi_set_soc_pstate
from .amdsmi_interface import amdsmi_set_xgmi_plpd
from .amdsmi_interface import amdsmi_set_gpu_clear_sram_data
from .amdsmi_interface import amdsmi_set_gpu_process_isolation
@@ -78,15 +78,15 @@ class AmdSmiLibraryException(AmdSmiException):
amdsmi_wrapper.AMDSMI_STATUS_UNEXPECTED_SIZE : "AMDSMI_STATUS_UNEXPECTED_SIZE - unexpected size of data was read",
amdsmi_wrapper.AMDSMI_STATUS_UNEXPECTED_DATA : "AMDSMI_STATUS_UNEXPECTED_DATA - The data read or provided was unexpected",
amdsmi_wrapper.AMDSMI_STATUS_NON_AMD_CPU : "AMDSMI_STATUS_NON_AMD_CPU - System has non-AMD CPU",
amdsmi_wrapper.AMDSMI_NO_ENERGY_DRV : "AMD_SMI_NO_ENERGY_DRV - Energy driver not found",
amdsmi_wrapper.AMDSMI_NO_MSR_DRV : "AMDSMI_NO_MSR_DRV - MSR driver not found",
amdsmi_wrapper.AMDSMI_NO_HSMP_DRV : "AMD_SMI_NO_HSMP_DRV - HSMP driver not found",
amdsmi_wrapper.AMDSMI_NO_HSMP_SUP : "AMD_SMI_NO_HSMP_SUP - HSMP not supported",
amdsmi_wrapper.AMDSMI_NO_HSMP_MSG_SUP : "AMD_SMI_NO_HSMP_MSG_SUP - HSMP message/feature not supported",
amdsmi_wrapper.AMDSMI_HSMP_TIMEOUT : "AMD_SMI_HSMP_TIMEOUT - HSMP message timeout",
amdsmi_wrapper.AMDSMI_NO_DRV : "AMDSMI_NO_DRV - No Energy and HSMP driver present",
amdsmi_wrapper.AMDSMI_FILE_NOT_FOUND : "AMDSMI_FILE_NOT_FOUND - File or directory not found",
amdsmi_wrapper.AMDSMI_ARG_PTR_NULL : "AMDSMI_ARG_PTR_NULL - Parsed argument is invalid",
amdsmi_wrapper.AMDSMI_STATUS_NO_ENERGY_DRV : "AMD_SMI_NO_ENERGY_DRV - Energy driver not found",
amdsmi_wrapper.AMDSMI_STATUS_NO_MSR_DRV : "AMDSMI_STATUS_NO_MSR_DRV - MSR driver not found",
amdsmi_wrapper.AMDSMI_STATUS_NO_HSMP_DRV : "AMD_SMI_NO_HSMP_DRV - HSMP driver not found",
amdsmi_wrapper.AMDSMI_STATUS_NO_HSMP_SUP : "AMD_SMI_NO_HSMP_SUP - HSMP not supported",
amdsmi_wrapper.AMDSMI_STATUS_NO_HSMP_MSG_SUP : "AMD_SMI_NO_HSMP_MSG_SUP - HSMP message/feature not supported",
amdsmi_wrapper.AMDSMI_STATUS_HSMP_TIMEOUT : "AMD_SMI_HSMP_TIMEOUT - HSMP message timeout",
amdsmi_wrapper.AMDSMI_STATUS_NO_DRV : "AMDSMI_STATUS_NO_DRV - No Energy and HSMP driver present",
amdsmi_wrapper.AMDSMI_STATUS_FILE_NOT_FOUND : "AMDSMI_STATUS_FILE_NOT_FOUND - File or directory not found",
amdsmi_wrapper.AMDSMI_STATUS_ARG_PTR_NULL : "AMDSMI_STATUS_ARG_PTR_NULL - Parsed argument is invalid",
amdsmi_wrapper.AMDSMI_STATUS_MAP_ERROR : "AMDSMI_STATUS_MAP_ERROR - The internal library error did not map to a status code",
amdsmi_wrapper.AMDSMI_STATUS_UNKNOWN_ERROR : "AMDSMI_STATUS_UNKNOWN_ERROR - An unknown error occurred"
}
@@ -82,16 +82,16 @@ class AmdSmiInitFlags(IntEnum):
class AmdSmiContainerTypes(IntEnum):
LXC = amdsmi_wrapper.CONTAINER_LXC
DOCKER = amdsmi_wrapper.CONTAINER_DOCKER
LXC = amdsmi_wrapper.AMDSMI_CONTAINER_LXC
DOCKER = amdsmi_wrapper.AMDSMI_CONTAINER_DOCKER
class AmdSmiDeviceType(IntEnum):
UNKNOWN_DEVICE = amdsmi_wrapper.UNKNOWN
AMD_GPU_DEVICE = amdsmi_wrapper.AMD_GPU
AMD_CPU_DEVICE = amdsmi_wrapper.AMD_CPU
NON_AMD_GPU_DEVICE = amdsmi_wrapper.NON_AMD_GPU
NON_AMD_CPU_DEVICE = amdsmi_wrapper.NON_AMD_CPU
UNKNOWN_DEVICE = amdsmi_wrapper.AMDSMI_PROCESSOR_TYPE_UNKNOWN
AMD_GPU_DEVICE = amdsmi_wrapper.AMDSMI_PROCESSOR_TYPE_AMD_GPU
AMD_CPU_DEVICE = amdsmi_wrapper.AMDSMI_PROCESSOR_TYPE_AMD_CPU
NON_AMD_GPU_DEVICE = amdsmi_wrapper.AMDSMI_PROCESSOR_TYPE_NON_AMD_GPU
NON_AMD_CPU_DEVICE = amdsmi_wrapper.AMDSMI_PROCESSOR_TYPE_NON_AMD_CPU
class AmdSmiMmIp(IntEnum):
@@ -101,109 +101,109 @@ class AmdSmiMmIp(IntEnum):
class AmdSmiFwBlock(IntEnum):
FW_ID_SMU = amdsmi_wrapper.FW_ID_SMU
FW_ID_CP_CE = amdsmi_wrapper.FW_ID_CP_CE
FW_ID_CP_PFP = amdsmi_wrapper.FW_ID_CP_PFP
FW_ID_CP_ME = amdsmi_wrapper.FW_ID_CP_ME
FW_ID_CP_MEC_JT1 = amdsmi_wrapper.FW_ID_CP_MEC_JT1
FW_ID_CP_MEC_JT2 = amdsmi_wrapper.FW_ID_CP_MEC_JT2
FW_ID_CP_MEC1 = amdsmi_wrapper.FW_ID_CP_MEC1
FW_ID_CP_MEC2 = amdsmi_wrapper.FW_ID_CP_MEC2
FW_ID_RLC = amdsmi_wrapper.FW_ID_RLC
FW_ID_SDMA0 = amdsmi_wrapper.FW_ID_SDMA0
FW_ID_SDMA1 = amdsmi_wrapper.FW_ID_SDMA1
FW_ID_SDMA2 = amdsmi_wrapper.FW_ID_SDMA2
FW_ID_SDMA3 = amdsmi_wrapper.FW_ID_SDMA3
FW_ID_SDMA4 = amdsmi_wrapper.FW_ID_SDMA4
FW_ID_SDMA5 = amdsmi_wrapper.FW_ID_SDMA5
FW_ID_SDMA6 = amdsmi_wrapper.FW_ID_SDMA6
FW_ID_SDMA7 = amdsmi_wrapper.FW_ID_SDMA7
FW_ID_VCN = amdsmi_wrapper.FW_ID_VCN
FW_ID_UVD = amdsmi_wrapper.FW_ID_UVD
FW_ID_VCE = amdsmi_wrapper.FW_ID_VCE
FW_ID_ISP = amdsmi_wrapper.FW_ID_ISP
FW_ID_DMCU_ERAM = amdsmi_wrapper.FW_ID_DMCU_ERAM
FW_ID_DMCU_ISR = amdsmi_wrapper.FW_ID_DMCU_ISR
FW_ID_RLC_RESTORE_LIST_GPM_MEM = amdsmi_wrapper.FW_ID_RLC_RESTORE_LIST_GPM_MEM
FW_ID_RLC_RESTORE_LIST_SRM_MEM = amdsmi_wrapper.FW_ID_RLC_RESTORE_LIST_SRM_MEM
FW_ID_RLC_RESTORE_LIST_CNTL = amdsmi_wrapper.FW_ID_RLC_RESTORE_LIST_CNTL
FW_ID_RLC_V = amdsmi_wrapper.FW_ID_RLC_V
FW_ID_MMSCH = amdsmi_wrapper.FW_ID_MMSCH
FW_ID_PSP_SYSDRV = amdsmi_wrapper.FW_ID_PSP_SYSDRV
FW_ID_PSP_SOSDRV = amdsmi_wrapper.FW_ID_PSP_SOSDRV
FW_ID_PSP_TOC = amdsmi_wrapper.FW_ID_PSP_TOC
FW_ID_PSP_KEYDB = amdsmi_wrapper.FW_ID_PSP_KEYDB
FW_ID_DFC = amdsmi_wrapper.FW_ID_DFC
FW_ID_PSP_SPL = amdsmi_wrapper.FW_ID_PSP_SPL
FW_ID_DRV_CAP = amdsmi_wrapper.FW_ID_DRV_CAP
FW_ID_MC = amdsmi_wrapper.FW_ID_MC
FW_ID_PSP_BL = amdsmi_wrapper.FW_ID_PSP_BL
FW_ID_CP_PM4 = amdsmi_wrapper.FW_ID_CP_PM4
FW_ID_RLC_P = amdsmi_wrapper.FW_ID_RLC_P
FW_ID_SEC_POLICY_STAGE2 = amdsmi_wrapper.FW_ID_SEC_POLICY_STAGE2
FW_ID_REG_ACCESS_WHITELIST = amdsmi_wrapper.FW_ID_REG_ACCESS_WHITELIST
FW_ID_IMU_DRAM = amdsmi_wrapper.FW_ID_IMU_DRAM
FW_ID_IMU_IRAM = amdsmi_wrapper.FW_ID_IMU_IRAM
FW_ID_SDMA_TH0 = amdsmi_wrapper.FW_ID_SDMA_TH0
FW_ID_SDMA_TH1 = amdsmi_wrapper.FW_ID_SDMA_TH1
FW_ID_CP_MES = amdsmi_wrapper.FW_ID_CP_MES
FW_ID_MES_STACK = amdsmi_wrapper.FW_ID_MES_STACK
FW_ID_MES_THREAD1 = amdsmi_wrapper.FW_ID_MES_THREAD1
FW_ID_MES_THREAD1_STACK = amdsmi_wrapper.FW_ID_MES_THREAD1_STACK
FW_ID_RLX6 = amdsmi_wrapper.FW_ID_RLX6
FW_ID_RLX6_DRAM_BOOT = amdsmi_wrapper.FW_ID_RLX6_DRAM_BOOT
FW_ID_RS64_ME = amdsmi_wrapper.FW_ID_RS64_ME
FW_ID_RS64_ME_P0_DATA = amdsmi_wrapper.FW_ID_RS64_ME_P0_DATA
FW_ID_RS64_ME_P1_DATA = amdsmi_wrapper.FW_ID_RS64_ME_P1_DATA
FW_ID_RS64_PFP = amdsmi_wrapper.FW_ID_RS64_PFP
FW_ID_RS64_PFP_P0_DATA = amdsmi_wrapper.FW_ID_RS64_PFP_P0_DATA
FW_ID_RS64_PFP_P1_DATA = amdsmi_wrapper.FW_ID_RS64_PFP_P1_DATA
FW_ID_RS64_MEC = amdsmi_wrapper.FW_ID_RS64_MEC
FW_ID_RS64_MEC_P0_DATA = amdsmi_wrapper.FW_ID_RS64_MEC_P0_DATA
FW_ID_RS64_MEC_P1_DATA = amdsmi_wrapper.FW_ID_RS64_MEC_P1_DATA
FW_ID_RS64_MEC_P2_DATA = amdsmi_wrapper.FW_ID_RS64_MEC_P2_DATA
FW_ID_RS64_MEC_P3_DATA = amdsmi_wrapper.FW_ID_RS64_MEC_P3_DATA
FW_ID_PPTABLE = amdsmi_wrapper.FW_ID_PPTABLE
FW_ID_PSP_SOC = amdsmi_wrapper.FW_ID_PSP_SOC
FW_ID_PSP_DBG = amdsmi_wrapper.FW_ID_PSP_DBG
FW_ID_PSP_INTF = amdsmi_wrapper.FW_ID_PSP_INTF
FW_ID_RLX6_CORE1 = amdsmi_wrapper.FW_ID_RLX6_CORE1
FW_ID_RLX6_DRAM_BOOT_CORE1 = amdsmi_wrapper.FW_ID_RLX6_DRAM_BOOT_CORE1
FW_ID_RLCV_LX7 = amdsmi_wrapper.FW_ID_RLCV_LX7
FW_ID_RLC_SAVE_RESTORE_LIST = amdsmi_wrapper.FW_ID_RLC_SAVE_RESTORE_LIST
FW_ID_ASD = amdsmi_wrapper.FW_ID_ASD
FW_ID_TA_RAS = amdsmi_wrapper.FW_ID_TA_RAS
FW_ID_TA_XGMI = amdsmi_wrapper.FW_ID_TA_XGMI
FW_ID_RLC_SRLG = amdsmi_wrapper.FW_ID_RLC_SRLG
FW_ID_RLC_SRLS = amdsmi_wrapper.FW_ID_RLC_SRLS
FW_ID_PM = amdsmi_wrapper.FW_ID_PM
FW_ID_DMCU = amdsmi_wrapper.FW_ID_DMCU
AMDSMI_FW_ID_SMU = amdsmi_wrapper.AMDSMI_FW_ID_SMU
AMDSMI_FW_ID_CP_CE = amdsmi_wrapper.AMDSMI_FW_ID_CP_CE
AMDSMI_FW_ID_CP_PFP = amdsmi_wrapper.AMDSMI_FW_ID_CP_PFP
AMDSMI_FW_ID_CP_ME = amdsmi_wrapper.AMDSMI_FW_ID_CP_ME
AMDSMI_FW_ID_CP_MEC_JT1 = amdsmi_wrapper.AMDSMI_FW_ID_CP_MEC_JT1
AMDSMI_FW_ID_CP_MEC_JT2 = amdsmi_wrapper.AMDSMI_FW_ID_CP_MEC_JT2
AMDSMI_FW_ID_CP_MEC1 = amdsmi_wrapper.AMDSMI_FW_ID_CP_MEC1
AMDSMI_FW_ID_CP_MEC2 = amdsmi_wrapper.AMDSMI_FW_ID_CP_MEC2
AMDSMI_FW_ID_RLC = amdsmi_wrapper.AMDSMI_FW_ID_RLC
AMDSMI_FW_ID_SDMA0 = amdsmi_wrapper.AMDSMI_FW_ID_SDMA0
AMDSMI_FW_ID_SDMA1 = amdsmi_wrapper.AMDSMI_FW_ID_SDMA1
AMDSMI_FW_ID_SDMA2 = amdsmi_wrapper.AMDSMI_FW_ID_SDMA2
AMDSMI_FW_ID_SDMA3 = amdsmi_wrapper.AMDSMI_FW_ID_SDMA3
AMDSMI_FW_ID_SDMA4 = amdsmi_wrapper.AMDSMI_FW_ID_SDMA4
AMDSMI_FW_ID_SDMA5 = amdsmi_wrapper.AMDSMI_FW_ID_SDMA5
AMDSMI_FW_ID_SDMA6 = amdsmi_wrapper.AMDSMI_FW_ID_SDMA6
AMDSMI_FW_ID_SDMA7 = amdsmi_wrapper.AMDSMI_FW_ID_SDMA7
AMDSMI_FW_ID_VCN = amdsmi_wrapper.AMDSMI_FW_ID_VCN
AMDSMI_FW_ID_UVD = amdsmi_wrapper.AMDSMI_FW_ID_UVD
AMDSMI_FW_ID_VCE = amdsmi_wrapper.AMDSMI_FW_ID_VCE
AMDSMI_FW_ID_ISP = amdsmi_wrapper.AMDSMI_FW_ID_ISP
AMDSMI_FW_ID_DMCU_ERAM = amdsmi_wrapper.AMDSMI_FW_ID_DMCU_ERAM
AMDSMI_FW_ID_DMCU_ISR = amdsmi_wrapper.AMDSMI_FW_ID_DMCU_ISR
AMDSMI_FW_ID_RLC_RESTORE_LIST_GPM_MEM = amdsmi_wrapper.AMDSMI_FW_ID_RLC_RESTORE_LIST_GPM_MEM
AMDSMI_FW_ID_RLC_RESTORE_LIST_SRM_MEM = amdsmi_wrapper.AMDSMI_FW_ID_RLC_RESTORE_LIST_SRM_MEM
AMDSMI_FW_ID_RLC_RESTORE_LIST_CNTL = amdsmi_wrapper.AMDSMI_FW_ID_RLC_RESTORE_LIST_CNTL
AMDSMI_FW_ID_RLC_V = amdsmi_wrapper.AMDSMI_FW_ID_RLC_V
AMDSMI_FW_ID_MMSCH = amdsmi_wrapper.AMDSMI_FW_ID_MMSCH
AMDSMI_FW_ID_PSP_SYSDRV = amdsmi_wrapper.AMDSMI_FW_ID_PSP_SYSDRV
AMDSMI_FW_ID_PSP_SOSDRV = amdsmi_wrapper.AMDSMI_FW_ID_PSP_SOSDRV
AMDSMI_FW_ID_PSP_TOC = amdsmi_wrapper.AMDSMI_FW_ID_PSP_TOC
AMDSMI_FW_ID_PSP_KEYDB = amdsmi_wrapper.AMDSMI_FW_ID_PSP_KEYDB
AMDSMI_FW_ID_DFC = amdsmi_wrapper.AMDSMI_FW_ID_DFC
AMDSMI_FW_ID_PSP_SPL = amdsmi_wrapper.AMDSMI_FW_ID_PSP_SPL
AMDSMI_FW_ID_DRV_CAP = amdsmi_wrapper.AMDSMI_FW_ID_DRV_CAP
AMDSMI_FW_ID_MC = amdsmi_wrapper.AMDSMI_FW_ID_MC
AMDSMI_FW_ID_PSP_BL = amdsmi_wrapper.AMDSMI_FW_ID_PSP_BL
AMDSMI_FW_ID_CP_PM4 = amdsmi_wrapper.AMDSMI_FW_ID_CP_PM4
AMDSMI_FW_ID_RLC_P = amdsmi_wrapper.AMDSMI_FW_ID_RLC_P
AMDSMI_FW_ID_SEC_POLICY_STAGE2 = amdsmi_wrapper.AMDSMI_FW_ID_SEC_POLICY_STAGE2
AMDSMI_FW_ID_REG_ACCESS_WHITELIST = amdsmi_wrapper.AMDSMI_FW_ID_REG_ACCESS_WHITELIST
AMDSMI_FW_ID_IMU_DRAM = amdsmi_wrapper.AMDSMI_FW_ID_IMU_DRAM
AMDSMI_FW_ID_IMU_IRAM = amdsmi_wrapper.AMDSMI_FW_ID_IMU_IRAM
AMDSMI_FW_ID_SDMA_TH0 = amdsmi_wrapper.AMDSMI_FW_ID_SDMA_TH0
AMDSMI_FW_ID_SDMA_TH1 = amdsmi_wrapper.AMDSMI_FW_ID_SDMA_TH1
AMDSMI_FW_ID_CP_MES = amdsmi_wrapper.AMDSMI_FW_ID_CP_MES
AMDSMI_FW_ID_MES_STACK = amdsmi_wrapper.AMDSMI_FW_ID_MES_STACK
AMDSMI_FW_ID_MES_THREAD1 = amdsmi_wrapper.AMDSMI_FW_ID_MES_THREAD1
AMDSMI_FW_ID_MES_THREAD1_STACK = amdsmi_wrapper.AMDSMI_FW_ID_MES_THREAD1_STACK
AMDSMI_FW_ID_RLX6 = amdsmi_wrapper.AMDSMI_FW_ID_RLX6
AMDSMI_FW_ID_RLX6_DRAM_BOOT = amdsmi_wrapper.AMDSMI_FW_ID_RLX6_DRAM_BOOT
AMDSMI_FW_ID_RS64_ME = amdsmi_wrapper.AMDSMI_FW_ID_RS64_ME
AMDSMI_FW_ID_RS64_ME_P0_DATA = amdsmi_wrapper.AMDSMI_FW_ID_RS64_ME_P0_DATA
AMDSMI_FW_ID_RS64_ME_P1_DATA = amdsmi_wrapper.AMDSMI_FW_ID_RS64_ME_P1_DATA
AMDSMI_FW_ID_RS64_PFP = amdsmi_wrapper.AMDSMI_FW_ID_RS64_PFP
AMDSMI_FW_ID_RS64_PFP_P0_DATA = amdsmi_wrapper.AMDSMI_FW_ID_RS64_PFP_P0_DATA
AMDSMI_FW_ID_RS64_PFP_P1_DATA = amdsmi_wrapper.AMDSMI_FW_ID_RS64_PFP_P1_DATA
AMDSMI_FW_ID_RS64_MEC = amdsmi_wrapper.AMDSMI_FW_ID_RS64_MEC
AMDSMI_FW_ID_RS64_MEC_P0_DATA = amdsmi_wrapper.AMDSMI_FW_ID_RS64_MEC_P0_DATA
AMDSMI_FW_ID_RS64_MEC_P1_DATA = amdsmi_wrapper.AMDSMI_FW_ID_RS64_MEC_P1_DATA
AMDSMI_FW_ID_RS64_MEC_P2_DATA = amdsmi_wrapper.AMDSMI_FW_ID_RS64_MEC_P2_DATA
AMDSMI_FW_ID_RS64_MEC_P3_DATA = amdsmi_wrapper.AMDSMI_FW_ID_RS64_MEC_P3_DATA
AMDSMI_FW_ID_PPTABLE = amdsmi_wrapper.AMDSMI_FW_ID_PPTABLE
AMDSMI_FW_ID_PSP_SOC = amdsmi_wrapper.AMDSMI_FW_ID_PSP_SOC
AMDSMI_FW_ID_PSP_DBG = amdsmi_wrapper.AMDSMI_FW_ID_PSP_DBG
AMDSMI_FW_ID_PSP_INTF = amdsmi_wrapper.AMDSMI_FW_ID_PSP_INTF
AMDSMI_FW_ID_RLX6_CORE1 = amdsmi_wrapper.AMDSMI_FW_ID_RLX6_CORE1
AMDSMI_FW_ID_RLX6_DRAM_BOOT_CORE1 = amdsmi_wrapper.AMDSMI_FW_ID_RLX6_DRAM_BOOT_CORE1
AMDSMI_FW_ID_RLCV_LX7 = amdsmi_wrapper.AMDSMI_FW_ID_RLCV_LX7
AMDSMI_FW_ID_RLC_SAVE_RESTORE_LIST = amdsmi_wrapper.AMDSMI_FW_ID_RLC_SAVE_RESTORE_LIST
AMDSMI_FW_ID_ASD = amdsmi_wrapper.AMDSMI_FW_ID_ASD
AMDSMI_FW_ID_TA_RAS = amdsmi_wrapper.AMDSMI_FW_ID_TA_RAS
AMDSMI_FW_ID_TA_XGMI = amdsmi_wrapper.AMDSMI_FW_ID_TA_XGMI
AMDSMI_FW_ID_RLC_SRLG = amdsmi_wrapper.AMDSMI_FW_ID_RLC_SRLG
AMDSMI_FW_ID_RLC_SRLS = amdsmi_wrapper.AMDSMI_FW_ID_RLC_SRLS
AMDSMI_FW_ID_PM = amdsmi_wrapper.AMDSMI_FW_ID_PM
AMDSMI_FW_ID_DMCU = amdsmi_wrapper.AMDSMI_FW_ID_DMCU
class AmdSmiClkType(IntEnum):
SYS = amdsmi_wrapper.CLK_TYPE_SYS
GFX = amdsmi_wrapper.CLK_TYPE_GFX
DF = amdsmi_wrapper.CLK_TYPE_DF
DCEF = amdsmi_wrapper.CLK_TYPE_DCEF
SOC = amdsmi_wrapper.CLK_TYPE_SOC
MEM = amdsmi_wrapper.CLK_TYPE_MEM
PCIE = amdsmi_wrapper.CLK_TYPE_PCIE
VCLK0 = amdsmi_wrapper.CLK_TYPE_VCLK0
VCLK1 = amdsmi_wrapper.CLK_TYPE_VCLK1
DCLK0 = amdsmi_wrapper.CLK_TYPE_DCLK0
DCLK1 = amdsmi_wrapper.CLK_TYPE_DCLK1
SYS = amdsmi_wrapper.AMDSMI_CLK_TYPE_SYS
GFX = amdsmi_wrapper.AMDSMI_CLK_TYPE_GFX
DF = amdsmi_wrapper.AMDSMI_CLK_TYPE_DF
DCEF = amdsmi_wrapper.AMDSMI_CLK_TYPE_DCEF
SOC = amdsmi_wrapper.AMDSMI_CLK_TYPE_SOC
MEM = amdsmi_wrapper.AMDSMI_CLK_TYPE_MEM
PCIE = amdsmi_wrapper.AMDSMI_CLK_TYPE_PCIE
VCLK0 = amdsmi_wrapper.AMDSMI_CLK_TYPE_VCLK0
VCLK1 = amdsmi_wrapper.AMDSMI_CLK_TYPE_VCLK1
DCLK0 = amdsmi_wrapper.AMDSMI_CLK_TYPE_DCLK0
DCLK1 = amdsmi_wrapper.AMDSMI_CLK_TYPE_DCLK1
class AmdSmiTemperatureType(IntEnum):
EDGE = amdsmi_wrapper.TEMPERATURE_TYPE_EDGE
HOTSPOT = amdsmi_wrapper.TEMPERATURE_TYPE_HOTSPOT
JUNCTION = amdsmi_wrapper.TEMPERATURE_TYPE_JUNCTION
VRAM = amdsmi_wrapper.TEMPERATURE_TYPE_VRAM
HBM_0 = amdsmi_wrapper.TEMPERATURE_TYPE_HBM_0
HBM_1 = amdsmi_wrapper.TEMPERATURE_TYPE_HBM_1
HBM_2 = amdsmi_wrapper.TEMPERATURE_TYPE_HBM_2
HBM_3 = amdsmi_wrapper.TEMPERATURE_TYPE_HBM_3
PLX = amdsmi_wrapper.TEMPERATURE_TYPE_PLX
EDGE = amdsmi_wrapper.AMDSMI_TEMPERATURE_TYPE_EDGE
HOTSPOT = amdsmi_wrapper.AMDSMI_TEMPERATURE_TYPE_HOTSPOT
JUNCTION = amdsmi_wrapper.AMDSMI_TEMPERATURE_TYPE_JUNCTION
VRAM = amdsmi_wrapper.AMDSMI_TEMPERATURE_TYPE_VRAM
HBM_0 = amdsmi_wrapper.AMDSMI_TEMPERATURE_TYPE_HBM_0
HBM_1 = amdsmi_wrapper.AMDSMI_TEMPERATURE_TYPE_HBM_1
HBM_2 = amdsmi_wrapper.AMDSMI_TEMPERATURE_TYPE_HBM_2
HBM_3 = amdsmi_wrapper.AMDSMI_TEMPERATURE_TYPE_HBM_3
PLX = amdsmi_wrapper.AMDSMI_TEMPERATURE_TYPE_PLX
class AmdSmiDevPerfLevel(IntEnum):
@@ -289,20 +289,20 @@ class AmdSmiVoltageType(IntEnum):
class AmdSmiComputePartitionType(IntEnum):
CPX = amdsmi_wrapper.COMPUTE_PARTITION_CPX
SPX = amdsmi_wrapper.COMPUTE_PARTITION_SPX
DPX = amdsmi_wrapper.COMPUTE_PARTITION_DPX
TPX = amdsmi_wrapper.COMPUTE_PARTITION_TPX
QPX = amdsmi_wrapper.COMPUTE_PARTITION_QPX
INVALID = amdsmi_wrapper.COMPUTE_PARTITION_INVALID
CPX = amdsmi_wrapper.AMDSMI_COMPUTE_PARTITION_CPX
SPX = amdsmi_wrapper.AMDSMI_COMPUTE_PARTITION_SPX
DPX = amdsmi_wrapper.AMDSMI_COMPUTE_PARTITION_DPX
TPX = amdsmi_wrapper.AMDSMI_COMPUTE_PARTITION_TPX
QPX = amdsmi_wrapper.AMDSMI_COMPUTE_PARTITION_QPX
INVALID = amdsmi_wrapper.AMDSMI_COMPUTE_PARTITION_INVALID
class AmdSmiMemoryPartitionType(IntEnum):
NPS1 = amdsmi_wrapper.MEMORY_PARTITION_NPS1
NPS2 = amdsmi_wrapper.MEMORY_PARTITION_NPS2
NPS4 = amdsmi_wrapper.MEMORY_PARTITION_NPS4
NPS8 = amdsmi_wrapper.MEMORY_PARTITION_NPS8
UNKNOWN = amdsmi_wrapper.MEMORY_PARTITION_UNKNOWN
NPS1 = amdsmi_wrapper.AMDSMI_MEMORY_PARTITION_NPS1
NPS2 = amdsmi_wrapper.AMDSMI_MEMORY_PARTITION_NPS2
NPS4 = amdsmi_wrapper.AMDSMI_MEMORY_PARTITION_NPS4
NPS8 = amdsmi_wrapper.AMDSMI_MEMORY_PARTITION_NPS8
UNKNOWN = amdsmi_wrapper.AMDSMI_MEMORY_PARTITION_UNKNOWN
class AmdSmiPowerProfilePresetMasks(IntEnum):
@@ -391,11 +391,11 @@ class AmdSmiUtilizationCounterType(IntEnum):
class AmdSmiProcessorType(IntEnum):
UNKNOWN = amdsmi_wrapper.UNKNOWN
AMD_GPU = amdsmi_wrapper.AMD_GPU
AMD_CPU = amdsmi_wrapper.AMD_CPU
NON_AMD_GPU = amdsmi_wrapper.NON_AMD_GPU
NON_AMD_CPU = amdsmi_wrapper.NON_AMD_CPU
UNKNOWN = amdsmi_wrapper.AMDSMI_PROCESSOR_TYPE_UNKNOWN
AMDSMI_PROCESSOR_TYPE_AMD_GPU = amdsmi_wrapper.AMDSMI_PROCESSOR_TYPE_AMD_GPU
AMDSMI_PROCESSOR_TYPE_AMD_CPU = amdsmi_wrapper.AMDSMI_PROCESSOR_TYPE_AMD_CPU
AMDSMI_PROCESSOR_TYPE_NON_AMD_GPU = amdsmi_wrapper.AMDSMI_PROCESSOR_TYPE_NON_AMD_GPU
AMDSMI_PROCESSOR_TYPE_NON_AMD_CPU = amdsmi_wrapper.AMDSMI_PROCESSOR_TYPE_NON_AMD_CPU
class AmdSmiEventReader:
@@ -421,7 +421,8 @@ class AmdSmiEventReader:
self.processor_handle = processor_handle
mask = 0
for event_type in event_types:
mask |= (1 << (int(event_type) - 1))
if event_type != AmdSmiEvtNotificationType.NONE:
mask |= (1 << (int(event_type) - 1))
_check_res(amdsmi_wrapper.amdsmi_init_gpu_event_notification(processor_handle))
_check_res(amdsmi_wrapper.amdsmi_set_gpu_event_notification_mask(
@@ -513,10 +514,10 @@ def _format_bdf(amdsmi_bdf: amdsmi_wrapper.amdsmi_bdf_t) -> str:
Returns:
`str`: String containing BDF data in a readable format.
"""
domain = hex(amdsmi_bdf.fields.domain_number)[2:].zfill(4)
bus = hex(amdsmi_bdf.fields.bus_number)[2:].zfill(2)
device = hex(amdsmi_bdf.fields.device_number)[2:].zfill(2)
function = hex(amdsmi_bdf.fields.function_number)[2:]
domain = hex(amdsmi_bdf.struct_amdsmi_bdf_t.domain_number)[2:].zfill(4)
bus = hex(amdsmi_bdf.struct_amdsmi_bdf_t.bus_number)[2:].zfill(2)
device = hex(amdsmi_bdf.struct_amdsmi_bdf_t.device_number)[2:].zfill(2)
function = hex(amdsmi_bdf.struct_amdsmi_bdf_t.function_number)[2:]
return domain + ":" + bus + ":" + device + "." + function
@@ -563,10 +564,10 @@ def _make_amdsmi_bdf_from_list(bdf):
if len(bdf) != 4:
return None
amdsmi_bdf = amdsmi_wrapper.amdsmi_bdf_t()
amdsmi_bdf.fields.function_number = bdf[3]
amdsmi_bdf.fields.device_number = bdf[2]
amdsmi_bdf.fields.bus_number = bdf[1]
amdsmi_bdf.fields.domain_number = bdf[0]
amdsmi_bdf.struct_amdsmi_bdf_t.function_number = bdf[3]
amdsmi_bdf.struct_amdsmi_bdf_t.device_number = bdf[2]
amdsmi_bdf.struct_amdsmi_bdf_t.bus_number = bdf[1]
amdsmi_bdf.struct_amdsmi_bdf_t.domain_number = bdf[0]
return amdsmi_bdf
def _padHexValue(value, length):
@@ -626,7 +627,7 @@ def amdsmi_get_cpusocket_handles() -> List[amdsmi_wrapper.amdsmi_socket_handle]:
"""
socket_handles = amdsmi_get_socket_handles()
cpu_handles = []
type = amdsmi_wrapper.AMD_CPU
type = amdsmi_wrapper.AMDSMI_PROCESSOR_TYPE_AMD_CPU
for socket in socket_handles:
cpu_count = ctypes.c_uint32()
null_ptr = ctypes.POINTER(amdsmi_wrapper.amdsmi_processor_handle)()
@@ -719,7 +720,7 @@ def amdsmi_get_processor_handles() -> List[amdsmi_wrapper.amdsmi_processor_handl
def amdsmi_get_cpucore_handles() -> List[amdsmi_wrapper.amdsmi_processor_handle]:
socket_handles = amdsmi_get_socket_handles()
core_handles = []
type = amdsmi_wrapper.AMD_CPU_CORE
type = amdsmi_wrapper.AMDSMI_PROCESSOR_TYPE_AMD_CPU_CORE
for socket in socket_handles:
core_count = ctypes.c_uint32()
@@ -1709,7 +1710,7 @@ def amdsmi_get_gpu_vram_info(
return {
"vram_type": vram_info.vram_type,
"vram_vendor": vram_info.vram_vendor,
"vram_size_mb": vram_info.vram_size_mb,
"vram_size": vram_info.vram_size,
}
@@ -1835,10 +1836,11 @@ def amdsmi_get_clock_info(
)
return {
"cur_clk": clock_measure.cur_clk,
"max_clk": clock_measure.max_clk,
"clk": clock_measure.clk,
"min_clk": clock_measure.min_clk,
"sleep_clk" : clock_measure.sleep_clk,
"max_clk": clock_measure.max_clk,
"clk_locked": clock_measure.clk_locked,
"clk_deep_sleep" : clock_measure.clk_deep_sleep,
}
@@ -2119,14 +2121,14 @@ def amdsmi_get_fw_info(
_check_res(amdsmi_wrapper.amdsmi_get_fw_info(
processor_handle, ctypes.byref(fw_info)))
hex_format_fw = [AmdSmiFwBlock.FW_ID_PSP_SOSDRV,
AmdSmiFwBlock.FW_ID_TA_RAS,
AmdSmiFwBlock.FW_ID_TA_XGMI,
AmdSmiFwBlock.FW_ID_UVD,
AmdSmiFwBlock.FW_ID_VCE,
AmdSmiFwBlock.FW_ID_VCN]
hex_format_fw = [AmdSmiFwBlock.AMDSMI_FW_ID_PSP_SOSDRV,
AmdSmiFwBlock.AMDSMI_FW_ID_TA_RAS,
AmdSmiFwBlock.AMDSMI_FW_ID_TA_XGMI,
AmdSmiFwBlock.AMDSMI_FW_ID_UVD,
AmdSmiFwBlock.AMDSMI_FW_ID_VCE,
AmdSmiFwBlock.AMDSMI_FW_ID_VCN]
dec_format_fw = [AmdSmiFwBlock.FW_ID_PM]
dec_format_fw = [AmdSmiFwBlock.AMDSMI_FW_ID_PM]
firmwares = []
for i in range(0, fw_info.num_fw_info):
@@ -2784,7 +2786,7 @@ def amdsmi_set_clk_freq(
)
def amdsmi_set_dpm_policy(
def amdsmi_set_soc_pstate(
processor_handle: amdsmi_wrapper.amdsmi_processor_handle,
policy_id: int,
):
@@ -2793,7 +2795,7 @@ def amdsmi_set_dpm_policy(
processor_handle, amdsmi_wrapper.amdsmi_processor_handle
)
_check_res(
amdsmi_wrapper.amdsmi_set_dpm_policy(
amdsmi_wrapper.amdsmi_set_soc_pstate(
processor_handle, policy_id
)
)
@@ -3403,7 +3405,7 @@ def amdsmi_get_clk_freq(
}
def amdsmi_get_dpm_policy(
def amdsmi_get_soc_pstate(
processor_handle: amdsmi_wrapper.amdsmi_processor_handle,
) -> Dict[str, Any]:
if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle):
@@ -3413,7 +3415,7 @@ def amdsmi_get_dpm_policy(
policy = amdsmi_wrapper.amdsmi_dpm_policy_t()
_check_res(
amdsmi_wrapper.amdsmi_get_dpm_policy(
amdsmi_wrapper.amdsmi_get_soc_pstate(
processor_handle, ctypes.byref(policy)
)
)
Plik diff jest za duży Load Diff
@@ -3353,7 +3353,7 @@ rsmi_status_t rsmi_dev_gpu_clk_freq_set(uint32_t dv_ind,
*
* @return ::RSMI_STATUS_SUCCESS is returned upon successful call, non-zero on fail
*/
rsmi_status_t rsmi_dev_dpm_policy_get(uint32_t dv_ind,
rsmi_status_t rsmi_dev_soc_pstate_get(uint32_t dv_ind,
rsmi_dpm_policy_t* policy);
/**
@@ -3371,7 +3371,7 @@ rsmi_status_t rsmi_dev_dpm_policy_get(uint32_t dv_ind,
*
* @return ::RSMI_STATUS_SUCCESS is returned upon successful call, non-zero on fail
*/
rsmi_status_t rsmi_dev_dpm_policy_set(uint32_t dv_ind,
rsmi_status_t rsmi_dev_soc_pstate_set(uint32_t dv_ind,
uint32_t policy_id);
/**
@@ -3406,7 +3406,7 @@ rsmi_status_t rsmi_dev_xgmi_plpd_get(uint32_t dv_ind,
* @param[in] processor_handle a processor handle
*
* @param[in] xgmi_plpd_id the xgmi plpd id to set. The id is the id in
* rsmi_dpm_policy_entry_t, which can be obtained by calling
* rsmi_soc_pstate_entry_t, which can be obtained by calling
* rsmi_dev_xgmi_plpd_get()
*
* @return ::RSMI_STATUS_SUCCESS is returned upon successful call, non-zero on fail
@@ -101,6 +101,8 @@ enum DevKFDNodePropTypes {
enum DevInfoTypes {
kDevPerfLevel,
kDevSocPstate,
kDevXgmiPlpd,
kDevProcessIsolation,
kDevShaderClean,
kDevOverDriveLevel,
@@ -175,7 +177,6 @@ enum DevInfoTypes {
kDevNumaNode,
kDevGpuMetrics,
kDevPmMetrics,
kDevDPMPolicy,
kDevRegMetrics,
kDevGpuReset,
kDevAvailableComputePartition,
+30 -54
Wyświetl plik
@@ -2142,27 +2142,6 @@ rsmi_status_t rsmi_dev_gpu_clear_sram_data(uint32_t dv_ind,
CATCH
}
rsmi_status_t
rsmi_dev_dpm_policy_set(uint32_t dv_ind,
uint32_t policy_id) {
rsmi_status_t ret;
TRY
std::ostringstream ss;
ss << __PRETTY_FUNCTION__ << " | ======= start =======";
LOG_TRACE(ss);
REQUIRE_ROOT_ACCESS
DEVICE_MUTEX
GET_DEV_FROM_INDX
std::string value("soc_pstate ");
value += std::to_string(policy_id);
int ret = dev->writeDevInfo(amd::smi::kDevDPMPolicy , value);
return amd::smi::ErrnoToRsmiStatus(ret);
CATCH
}
rsmi_status_t
rsmi_dev_xgmi_plpd_get(uint32_t dv_ind,
rsmi_dpm_policy_t* policy) {
@@ -2181,7 +2160,7 @@ rsmi_dev_xgmi_plpd_get(uint32_t dv_ind,
LOG_TRACE(ss);
DEVICE_MUTEX
ret = GetDevValueVec(amd::smi::kDevDPMPolicy, dv_ind, &val_vec);
ret = GetDevValueVec(amd::smi::kDevXgmiPlpd, dv_ind, &val_vec);
if (ret == RSMI_STATUS_FILE_ERROR) {
ss << __PRETTY_FUNCTION__ << " | ======= end ======="
<< ", GetDevValueVec() ret was RSMI_STATUS_FILE_ERROR "
@@ -2199,21 +2178,14 @@ rsmi_dev_xgmi_plpd_get(uint32_t dv_ind,
/*
It will reply on the number but no string as it may vary from soc to soc.
The current xmgi plpd marked with *
xgmi plpd
0 : plpd_disallow
1 : plpd_default
2 : plpd_optimized*
0 : plpd_disallow
1 : plpd_default*
2 : plpd_optimized
*/
bool see_plpd_pstate = false;
bool see_current = false;
policy->num_supported = 0;
for (uint32_t i = 0; i < val_vec.size(); ++i) {
auto current_line = amd::smi::trim(val_vec[i]);
if (current_line == "xgmi plpd") {
see_plpd_pstate = true;
continue;
}
if (see_plpd_pstate == false) continue;
// Get tokens: <integer> : <string *>
std::vector<std::string> tokens;
@@ -2250,17 +2222,13 @@ rsmi_dev_xgmi_plpd_get(uint32_t dv_ind,
policy->num_supported++;
} // end for
if (!see_plpd_pstate) {
return RSMI_STATUS_NOT_SUPPORTED;
}
if (!see_current) {
ss << __PRETTY_FUNCTION__ << " | ======= end ======="
<< ", Unexpected pstat data: cannot find the current plpd policy.";
<< ", Unexpected pstat data: cannot find the current xgmi_plpd policy.";
LOG_ERROR(ss);
return RSMI_STATUS_UNEXPECTED_DATA;
}
// Cannot find it
return RSMI_STATUS_SUCCESS;
CATCH
@@ -2279,16 +2247,15 @@ rsmi_dev_xgmi_plpd_set(uint32_t dv_ind,
DEVICE_MUTEX
GET_DEV_FROM_INDX
std::string value("xgmi ");
value += std::to_string(plpd_id);
int ret = dev->writeDevInfo(amd::smi::kDevDPMPolicy , value);
std::string value = std::to_string(plpd_id);
int ret = dev->writeDevInfo(amd::smi::kDevXgmiPlpd , value);
return amd::smi::ErrnoToRsmiStatus(ret);
CATCH
}
rsmi_status_t
rsmi_dev_dpm_policy_get(uint32_t dv_ind,
rsmi_dev_soc_pstate_get(uint32_t dv_ind,
rsmi_dpm_policy_t* policy) {
rsmi_status_t ret;
std::vector<std::string> val_vec;
@@ -2305,7 +2272,7 @@ rsmi_dev_dpm_policy_get(uint32_t dv_ind,
LOG_TRACE(ss);
DEVICE_MUTEX
ret = GetDevValueVec(amd::smi::kDevDPMPolicy, dv_ind, &val_vec);
ret = GetDevValueVec(amd::smi::kDevSocPstate, dv_ind, &val_vec);
if (ret == RSMI_STATUS_FILE_ERROR) {
ss << __PRETTY_FUNCTION__ << " | ======= end ======="
<< ", GetDevValueVec() ret was RSMI_STATUS_FILE_ERROR "
@@ -2323,22 +2290,15 @@ rsmi_dev_dpm_policy_get(uint32_t dv_ind,
/*
It will reply on the number but no string as it may vary from soc to soc.
The current pstate marked with *
soc pstate
0 : soc_pstate_default
1 : soc_pstate_0
2 : soc_pstate_1*
3 : soc_pstate_2
*/
bool see_soc_pstate = false;
bool see_current = false;
policy->num_supported = 0;
for (uint32_t i = 0; i < val_vec.size(); ++i) {
auto current_line = amd::smi::trim(val_vec[i]);
if (current_line == "soc pstate") {
see_soc_pstate = true;
continue;
}
if (see_soc_pstate == false) continue;
// Get tokens: <integer> : <string *>
std::vector<std::string> tokens;
@@ -2375,10 +2335,6 @@ rsmi_dev_dpm_policy_get(uint32_t dv_ind,
policy->num_supported++;
} // end for
if (!see_soc_pstate) {
return RSMI_STATUS_NOT_SUPPORTED;
}
if (!see_current) {
ss << __PRETTY_FUNCTION__ << " | ======= end ======="
<< ", Unexpected pstat data: cannot find the current policy.";
@@ -2391,6 +2347,26 @@ rsmi_dev_dpm_policy_get(uint32_t dv_ind,
CATCH
}
rsmi_status_t
rsmi_dev_soc_pstate_set(uint32_t dv_ind,
uint32_t policy_id) {
rsmi_status_t ret;
TRY
std::ostringstream ss;
ss << __PRETTY_FUNCTION__ << " | ======= start =======";
LOG_TRACE(ss);
REQUIRE_ROOT_ACCESS
DEVICE_MUTEX
GET_DEV_FROM_INDX
std::string value = std::to_string(policy_id);
int ret = dev->writeDevInfo(amd::smi::kDevSocPstate , value);
return amd::smi::ErrnoToRsmiStatus(ret);
CATCH
}
static std::vector<std::string> pci_name_files = {
"/usr/share/misc/pci.ids",
"/usr/share/hwdata/pci.ids",
@@ -82,6 +82,8 @@ static const char *kDevPCieVendorIDFName = "vendor";
// Device sysfs file names
static const char *kDevPerfLevelFName = "power_dpm_force_performance_level";
static const char *kDevSocPstateFName = "pm_policy/soc_pstate";
static const char *kDevXgmiPlpdFName = "pm_policy/xgmi_plpd";
static const char *kDevProcessIsolationFName = "enforce_isolation";
static const char *kDevShaderCleanFName = "run_cleaner_shader";
static const char *kDevDevProdNameFName = "product_name";
@@ -138,7 +140,6 @@ static const char *kDevAvailableComputePartitionFName =
"available_compute_partition";
static const char *kDevComputePartitionFName = "current_compute_partition";
static const char *kDevMemoryPartitionFName = "current_memory_partition";
static const char* kDevDPMPolicyFName = "pm_policy"; // The PM policy for pstat and XGMI
// Firmware version files
static const char *kDevFwVersionAsdFName = "fw_version/asd_fw_version";
@@ -318,7 +319,8 @@ static const std::map<DevInfoTypes, const char *> kDevAttribNameMap = {
{kDevNumaNode, kDevNumaNodeFName},
{kDevGpuMetrics, kDevGpuMetricsFName},
{kDevPmMetrics, kDevPmMetricsFName},
{kDevDPMPolicy, kDevDPMPolicyFName},
{kDevSocPstate, kDevSocPstateFName},
{kDevXgmiPlpd, kDevXgmiPlpdFName},
{kDevProcessIsolation, kDevProcessIsolationFName},
{kDevShaderClean, kDevShaderCleanFName},
{kDevRegMetrics, kDevRegMetricsFName},
@@ -478,7 +480,8 @@ Device::devInfoTypesStrings = {
{kDevComputePartition, "kDevComputePartition"},
{kDevMemoryPartition, "kDevMemoryPartition"},
{kDevPCieVendorID, "kDevPCieVendorID"},
{kDevDPMPolicy, "kDevDPMPolicy"},
{kDevSocPstate, "kDevSocPstate"},
{kDevXgmiPlpd, "kDevXgmiPlpd"},
{kDevProcessIsolation, "kDevProcessIsolation"},
{kDevShaderClean, "kDevShaderClean"},
};
@@ -522,6 +525,10 @@ static const std::map<const char *, dev_depends_t> kDevFuncDependsMap = {
{"rsmi_dev_perf_level_set", {{kDevPerfLevelFName}, {}}},
{"rsmi_dev_perf_level_set_v1", {{kDevPerfLevelFName}, {}}},
{"rsmi_dev_perf_level_get", {{kDevPerfLevelFName}, {}}},
{"rsmi_dev_soc_pstate_set", {{kDevSocPstateFName}, {}}},
{"rsmi_dev_soc_pstate_get", {{kDevSocPstateFName}, {}}},
{"rsmi_dev_xgmi_plpd_set", {{kDevXgmiPlpdFName}, {}}},
{"rsmi_dev_xgmi_plpd_get", {{kDevXgmiPlpdFName}, {}}},
{"rsmi_dev_process_isolation_set", {{kDevProcessIsolationFName}, {}}},
{"rsmi_dev_process_isolation_get", {{kDevProcessIsolationFName}, {}}},
{"rsmi_dev_gpu_shader_clean", {{kDevShaderCleanFName}, {}}},
@@ -545,10 +552,6 @@ static const std::map<const char *, dev_depends_t> kDevFuncDependsMap = {
{"rsmi_topo_numa_affinity_get", {{kDevNumaNodeFName}, {}}},
{"rsmi_dev_gpu_metrics_info_get", {{kDevGpuMetricsFName}, {}}},
{"rsmi_dev_pm_metrics_info_get", {{kDevPmMetricsFName}, {}}},
{"rsmi_dev_dpm_policy_get", {{kDevDPMPolicyFName}, {}}},
{"rsmi_dev_dpm_policy_set", {{kDevDPMPolicyFName}, {}}},
{"rsmi_dev_xgmi_plpd_get", {{kDevDPMPolicyFName}, {}}},
{"rsmi_dev_xgmi_plpd_set", {{kDevDPMPolicyFName}, {}}},
{"rsmi_dev_reg_table_info_get", {{kDevRegMetricsFName}, {}}},
{"rsmi_dev_gpu_reset", {{kDevGpuResetFName}, {}}},
{"rsmi_dev_compute_partition_get", {{kDevComputePartitionFName}, {}}},
@@ -948,6 +951,8 @@ int Device::writeDevInfo(DevInfoTypes type, std::string val) {
sysfs_path += kDevAttribNameMap.at(type);
switch (type) {
case kDevGPUMClk:
case kDevSocPstate:
case kDevXgmiPlpd:
case kDevProcessIsolation:
case kDevShaderClean:
case kDevDCEFClk:
@@ -956,7 +961,6 @@ int Device::writeDevInfo(DevInfoTypes type, std::string val) {
case kDevPCIEClk:
case kDevPowerODVoltage:
case kDevSOCClk:
case kDevDPMPolicy:
return writeDevInfoStr(type, val);
case kDevComputePartition:
case kDevMemoryPartition:
@@ -1223,6 +1227,8 @@ int Device::readDevInfo(DevInfoTypes type, std::vector<std::string> *val) {
switch (type) {
case kDevGPUMClk:
case kDevSocPstate:
case kDevXgmiPlpd:
case kDevProcessIsolation:
case kDevGPUSClk:
case kDevDCEFClk:
@@ -1239,7 +1245,6 @@ int Device::readDevInfo(DevInfoTypes type, std::vector<std::string> *val) {
case kDevErrCntHDP:
case kDevErrCntXGMIWAFL:
case kDevMemPageBad:
case kDevDPMPolicy:
return readDevInfoMultiLineStr(type, val);
break;
+68 -69
Wyświetl plik
@@ -94,7 +94,7 @@ static amdsmi_status_t get_gpu_device_from_handle(amdsmi_processor_handle proces
.handle_to_processor(processor_handle, &device);
if (r != AMDSMI_STATUS_SUCCESS) return r;
if (device->get_processor_type() == AMD_GPU) {
if (device->get_processor_type() == AMDSMI_PROCESSOR_TYPE_AMD_GPU) {
*gpudevice = static_cast<amd::smi::AMDSmiGPUDevice*>(processor_handle);
return AMDSMI_STATUS_SUCCESS;
}
@@ -304,11 +304,11 @@ amdsmi_status_t amdsmi_get_processor_count_from_handles(amdsmi_processor_handle*
&processor_type);
if (r != AMDSMI_STATUS_SUCCESS) return r;
if(processor_type == AMD_CPU) {
if(processor_type == AMDSMI_PROCESSOR_TYPE_AMD_CPU) {
count_cpusockets++;
} else if(processor_type == AMD_CPU_CORE) {
} else if(processor_type == AMDSMI_PROCESSOR_TYPE_AMD_CPU_CORE) {
count_cpucores++;
} else if(processor_type == AMD_GPU) {
} else if(processor_type == AMDSMI_PROCESSOR_TYPE_AMD_GPU) {
count_gpus++;
}
}
@@ -538,7 +538,7 @@ amdsmi_status_t amdsmi_get_temp_metric(amdsmi_processor_handle processor_handle
}
// Get the PLX temperature from the gpu_metrics
if (sensor_type == TEMPERATURE_TYPE_PLX) {
if (sensor_type == AMDSMI_TEMPERATURE_TYPE_PLX) {
amdsmi_gpu_metrics_t metric_info;
auto r_status = amdsmi_get_gpu_metrics_info(
processor_handle, &metric_info);
@@ -568,7 +568,7 @@ amdsmi_status_t amdsmi_get_gpu_vram_usage(amdsmi_processor_handle processor_hand
.handle_to_processor(processor_handle, &device);
if (ret != AMDSMI_STATUS_SUCCESS) return ret;
if (device->get_processor_type() != AMD_GPU) {
if (device->get_processor_type() != AMDSMI_PROCESSOR_TYPE_AMD_GPU) {
return AMDSMI_STATUS_NOT_SUPPORTED;
}
@@ -639,27 +639,27 @@ amdsmi_status_t amdsmi_get_gpu_revision(amdsmi_processor_handle processor_handle
amdsmi_status_t amdsmi_get_fw_info(amdsmi_processor_handle processor_handle,
amdsmi_fw_info_t *info) {
const std::map<amdsmi_fw_block_t, rsmi_fw_block_t> fw_in_rsmi = {
{ FW_ID_ASD, RSMI_FW_BLOCK_ASD},
{ FW_ID_CP_CE, RSMI_FW_BLOCK_CE},
{ FW_ID_DMCU, RSMI_FW_BLOCK_DMCU},
{ FW_ID_MC, RSMI_FW_BLOCK_MC},
{ FW_ID_CP_ME, RSMI_FW_BLOCK_ME},
{ FW_ID_CP_MEC1, RSMI_FW_BLOCK_MEC},
{ FW_ID_CP_MEC2, RSMI_FW_BLOCK_MEC2},
{ FW_ID_CP_PFP, RSMI_FW_BLOCK_PFP},
{ FW_ID_RLC, RSMI_FW_BLOCK_RLC},
{ FW_ID_RLC_RESTORE_LIST_CNTL, RSMI_FW_BLOCK_RLC_SRLC},
{ FW_ID_RLC_RESTORE_LIST_GPM_MEM, RSMI_FW_BLOCK_RLC_SRLG},
{ FW_ID_RLC_RESTORE_LIST_SRM_MEM, RSMI_FW_BLOCK_RLC_SRLS},
{ FW_ID_SDMA0, RSMI_FW_BLOCK_SDMA},
{ FW_ID_SDMA1, RSMI_FW_BLOCK_SDMA2},
{ FW_ID_PM, RSMI_FW_BLOCK_SMC},
{ FW_ID_PSP_SOSDRV, RSMI_FW_BLOCK_SOS},
{ FW_ID_TA_RAS, RSMI_FW_BLOCK_TA_RAS},
{ FW_ID_TA_XGMI, RSMI_FW_BLOCK_TA_XGMI},
{ FW_ID_UVD, RSMI_FW_BLOCK_UVD},
{ FW_ID_VCE, RSMI_FW_BLOCK_VCE},
{ FW_ID_VCN, RSMI_FW_BLOCK_VCN}
{ AMDSMI_FW_ID_ASD, RSMI_FW_BLOCK_ASD},
{ AMDSMI_FW_ID_CP_CE, RSMI_FW_BLOCK_CE},
{ AMDSMI_FW_ID_DMCU, RSMI_FW_BLOCK_DMCU},
{ AMDSMI_FW_ID_MC, RSMI_FW_BLOCK_MC},
{ AMDSMI_FW_ID_CP_ME, RSMI_FW_BLOCK_ME},
{ AMDSMI_FW_ID_CP_MEC1, RSMI_FW_BLOCK_MEC},
{ AMDSMI_FW_ID_CP_MEC2, RSMI_FW_BLOCK_MEC2},
{ AMDSMI_FW_ID_CP_PFP, RSMI_FW_BLOCK_PFP},
{ AMDSMI_FW_ID_RLC, RSMI_FW_BLOCK_RLC},
{ AMDSMI_FW_ID_RLC_RESTORE_LIST_CNTL, RSMI_FW_BLOCK_RLC_SRLC},
{ AMDSMI_FW_ID_RLC_RESTORE_LIST_GPM_MEM, RSMI_FW_BLOCK_RLC_SRLG},
{ AMDSMI_FW_ID_RLC_RESTORE_LIST_SRM_MEM, RSMI_FW_BLOCK_RLC_SRLS},
{ AMDSMI_FW_ID_SDMA0, RSMI_FW_BLOCK_SDMA},
{ AMDSMI_FW_ID_SDMA1, RSMI_FW_BLOCK_SDMA2},
{ AMDSMI_FW_ID_PM, RSMI_FW_BLOCK_SMC},
{ AMDSMI_FW_ID_PSP_SOSDRV, RSMI_FW_BLOCK_SOS},
{ AMDSMI_FW_ID_TA_RAS, RSMI_FW_BLOCK_TA_RAS},
{ AMDSMI_FW_ID_TA_XGMI, RSMI_FW_BLOCK_TA_XGMI},
{ AMDSMI_FW_ID_UVD, RSMI_FW_BLOCK_UVD},
{AMDSMI_FW_ID_VCE, RSMI_FW_BLOCK_VCE},
{ AMDSMI_FW_ID_VCN, RSMI_FW_BLOCK_VCN}
};
AMDSMI_CHECK_INIT();
@@ -794,8 +794,8 @@ amdsmi_status_t amdsmi_get_gpu_vram_info(
return r;
// init the info structure with default value
info->vram_type = VRAM_TYPE_UNKNOWN;
info->vram_size_mb = 0;
info->vram_type = AMDSMI_VRAM_TYPE_UNKNOWN;
info->vram_size = 0;
info->vram_vendor = AMDSMI_VRAM_VENDOR__PLACEHOLDER0;
// Only can read vram type from libdrm
@@ -805,14 +805,13 @@ amdsmi_status_t amdsmi_get_gpu_vram_info(
AMDGPU_INFO_DEV_INFO,
sizeof(struct drm_amdgpu_info_device), &dev_info);
if (r == AMDSMI_STATUS_SUCCESS) {
info->vram_type = static_cast<amdsmi_vram_type_t>(
dev_info.vram_type);
info->vram_type = amd::smi::vram_type_value(dev_info.vram_type);
}
}
// if vram type is greater than the max enum set it to unknown
if (info->vram_type > VRAM_TYPE__MAX)
info->vram_type = VRAM_TYPE_UNKNOWN;
if (info->vram_type > AMDSMI_VRAM_TYPE__MAX)
info->vram_type = AMDSMI_VRAM_TYPE_UNKNOWN;
// map the vendor name to enum
char brand[256];
@@ -843,7 +842,7 @@ amdsmi_status_t amdsmi_get_gpu_vram_info(
r = rsmi_wrapper(rsmi_dev_memory_total_get, processor_handle,
RSMI_MEM_TYPE_VRAM, &total);
if (r == AMDSMI_STATUS_SUCCESS) {
info->vram_size_mb = total / (1024 * 1024);
info->vram_size = total / (1024 * 1024);
}
return AMDSMI_STATUS_SUCCESS;
@@ -1250,7 +1249,7 @@ amdsmi_get_power_cap_info(amdsmi_processor_handle processor_handle,
set_ret_success = true;
info->power_cap = power_cap;
status = smi_amdgpu_get_ranges(gpudevice, CLK_TYPE_GFX,
status = smi_amdgpu_get_ranges(gpudevice, AMDSMI_CLK_TYPE_GFX,
NULL, NULL, &dpm, NULL);
if ((status == AMDSMI_STATUS_SUCCESS) && !set_ret_success)
set_ret_success = true;
@@ -1349,10 +1348,10 @@ amdsmi_status_t amdsmi_get_clk_freq(amdsmi_processor_handle processor_handle,
// nullptr api supported
// Get from gpu_metrics
if (clk_type == CLK_TYPE_VCLK0 ||
clk_type == CLK_TYPE_VCLK1 ||
clk_type == CLK_TYPE_DCLK0 ||
clk_type == CLK_TYPE_DCLK1 ) {
if (clk_type == AMDSMI_CLK_TYPE_VCLK0 ||
clk_type == AMDSMI_CLK_TYPE_VCLK1 ||
clk_type == AMDSMI_CLK_TYPE_DCLK0 ||
clk_type == AMDSMI_CLK_TYPE_DCLK1 ) {
// when f == nullptr -> check if metrics are supported
amdsmi_gpu_metrics_t metric_info;
@@ -1369,19 +1368,19 @@ amdsmi_status_t amdsmi_get_clk_freq(amdsmi_processor_handle processor_handle,
return r_status;
f->num_supported = 1;
if (clk_type == CLK_TYPE_VCLK0) {
if (clk_type == AMDSMI_CLK_TYPE_VCLK0) {
f->current = metric_info_p->current_vclk0;
f->frequency[0] = metric_info_p->average_vclk0_frequency;
}
if (clk_type == CLK_TYPE_VCLK1) {
if (clk_type == AMDSMI_CLK_TYPE_VCLK1) {
f->current = metric_info_p->current_vclk1;
f->frequency[0] = metric_info_p->average_vclk1_frequency;
}
if (clk_type == CLK_TYPE_DCLK0) {
if (clk_type == AMDSMI_CLK_TYPE_DCLK0) {
f->current = metric_info_p->current_dclk0;
f->frequency[0] = metric_info_p->average_dclk0_frequency;
}
if (clk_type == CLK_TYPE_DCLK1) {
if (clk_type == AMDSMI_CLK_TYPE_DCLK1) {
f->current = metric_info_p->current_dclk1;
f->frequency[0] = metric_info_p->average_dclk1_frequency;
}
@@ -1399,10 +1398,10 @@ amdsmi_status_t amdsmi_set_clk_freq(amdsmi_processor_handle processor_handle,
AMDSMI_CHECK_INIT();
// Not support the clock type write into gpu_metrics
if (clk_type == CLK_TYPE_VCLK0 ||
clk_type == CLK_TYPE_VCLK1 ||
clk_type == CLK_TYPE_DCLK0 ||
clk_type == CLK_TYPE_DCLK1 ) {
if (clk_type == AMDSMI_CLK_TYPE_VCLK0 ||
clk_type == AMDSMI_CLK_TYPE_VCLK1 ||
clk_type == AMDSMI_CLK_TYPE_DCLK0 ||
clk_type == AMDSMI_CLK_TYPE_DCLK1 ) {
return AMDSMI_STATUS_NOT_SUPPORTED;
}
@@ -1410,19 +1409,19 @@ amdsmi_status_t amdsmi_set_clk_freq(amdsmi_processor_handle processor_handle,
static_cast<rsmi_clk_type_t>(clk_type), freq_bitmask);
}
amdsmi_status_t amdsmi_set_dpm_policy(amdsmi_processor_handle processor_handle,
amdsmi_status_t amdsmi_set_soc_pstate(amdsmi_processor_handle processor_handle,
uint32_t policy) {
AMDSMI_CHECK_INIT();
return rsmi_wrapper(rsmi_dev_dpm_policy_set, processor_handle,
return rsmi_wrapper(rsmi_dev_soc_pstate_set, processor_handle,
policy);
}
amdsmi_status_t amdsmi_get_dpm_policy(amdsmi_processor_handle processor_handle,
amdsmi_status_t amdsmi_get_soc_pstate(amdsmi_processor_handle processor_handle,
amdsmi_dpm_policy_t* policy) {
AMDSMI_CHECK_INIT();
return rsmi_wrapper(rsmi_dev_dpm_policy_get, processor_handle,
return rsmi_wrapper(rsmi_dev_soc_pstate_get, processor_handle,
reinterpret_cast<rsmi_dpm_policy_t*>(policy));
}
@@ -1692,7 +1691,7 @@ amdsmi_get_clock_info(amdsmi_processor_handle processor_handle, amdsmi_clk_type_
return AMDSMI_STATUS_INVAL;
}
if (clk_type > CLK_TYPE__MAX) {
if (clk_type > AMDSMI_CLK_TYPE__MAX) {
return AMDSMI_STATUS_INVAL;
}
@@ -1717,26 +1716,26 @@ amdsmi_get_clock_info(amdsmi_processor_handle processor_handle, amdsmi_clk_type_
}
info->max_clk = max_freq;
info->min_clk = min_freq;
info->sleep_clk = sleep_state_freq;
info->clk_deep_sleep = sleep_state_freq;
switch (clk_type) {
case CLK_TYPE_GFX:
info->cur_clk = metrics.current_gfxclk;
case AMDSMI_CLK_TYPE_GFX:
info->clk = metrics.current_gfxclk;
break;
case CLK_TYPE_MEM:
info->cur_clk = metrics.current_uclk;
case AMDSMI_CLK_TYPE_MEM:
info->clk = metrics.current_uclk;
break;
case CLK_TYPE_VCLK0:
info->cur_clk = metrics.current_vclk0;
case AMDSMI_CLK_TYPE_VCLK0:
info->clk = metrics.current_vclk0;
break;
case CLK_TYPE_VCLK1:
info->cur_clk = metrics.current_vclk1;
case AMDSMI_CLK_TYPE_VCLK1:
info->clk = metrics.current_vclk1;
break;
case CLK_TYPE_DCLK0:
info->cur_clk = metrics.current_dclk0;
case AMDSMI_CLK_TYPE_DCLK0:
info->clk = metrics.current_dclk0;
break;
case CLK_TYPE_DCLK1:
info->cur_clk = metrics.current_dclk1;
case AMDSMI_CLK_TYPE_DCLK1:
info->clk = metrics.current_dclk1;
break;
default:
return AMDSMI_STATUS_INVAL;
@@ -2207,10 +2206,10 @@ amdsmi_status_t amdsmi_get_processor_handle_from_bdf(amdsmi_bdf_t bdf,
return status;
}
amdsmi_bdf_t found_bdf = gpu_device->get_bdf();
if ((bdf.fields.bus_number == found_bdf.fields.bus_number) &&
(bdf.fields.device_number == found_bdf.fields.device_number) &&
(bdf.fields.domain_number == found_bdf.fields.domain_number) &&
(bdf.fields.function_number == found_bdf.fields.function_number)) {
if ((bdf.bus_number == found_bdf.bus_number) &&
(bdf.device_number == found_bdf.device_number) &&
(bdf.domain_number == found_bdf.domain_number) &&
(bdf.function_number == found_bdf.function_number)) {
*processor_handle = devs[idx];
return AMDSMI_STATUS_SUCCESS;
}
@@ -63,6 +63,18 @@ amdsmi_status_t rsmi_to_amdsmi_status(rsmi_status_t status) {
return amdsmi_status;
}
amdsmi_vram_type_t vram_type_value(unsigned type) {
amdsmi_vram_type_t value = AMDSMI_VRAM_TYPE_UNKNOWN;
auto search = amd::smi::vram_type_map.find(type);
if (search != amd::smi::vram_type_map.end()) {
value = search->second;
}
return value;
}
#ifdef ENABLE_ESMI_LIB
amdsmi_status_t esmi_to_amdsmi_status(esmi_status_t status) {
amdsmi_status_t amdsmi_status = AMDSMI_STATUS_MAP_ERROR;
@@ -173,10 +173,10 @@ amdsmi_status_t AMDSmiDrm::init() {
}
has_valid_fds = true;
bdf.fields.function_number = device->businfo.pci->func;
bdf.fields.device_number = device->businfo.pci->dev;
bdf.fields.bus_number = device->businfo.pci->bus;
bdf.fields.domain_number = device->businfo.pci->domain;
bdf.function_number = device->businfo.pci->func;
bdf.device_number = device->businfo.pci->dev;
bdf.bus_number = device->businfo.pci->bus;
bdf.domain_number = device->businfo.pci->domain;
vendor_id = device->deviceinfo.pci->vendor_id;
@@ -71,13 +71,13 @@ amdsmi_status_t AMDSmiSocket::get_processor_count(uint32_t* processor_count) con
amdsmi_status_t AMDSmiSocket::get_processor_count(processor_type_t type, uint32_t* processor_count) const {
amdsmi_status_t ret = AMDSMI_STATUS_SUCCESS;
switch (type) {
case AMD_GPU:
case AMDSMI_PROCESSOR_TYPE_AMD_GPU:
*processor_count = static_cast<uint32_t>(processors_.size());
break;
case AMD_CPU:
case AMDSMI_PROCESSOR_TYPE_AMD_CPU:
*processor_count = static_cast<uint32_t>(cpu_processors_.size());
break;
case AMD_CPU_CORE:
case AMDSMI_PROCESSOR_TYPE_AMD_CPU_CORE:
*processor_count = static_cast<uint32_t>(cpu_core_processors_.size());
break;
default:
@@ -162,12 +162,12 @@ amdsmi_status_t AMDSmiSystem::populate_amd_cpus() {
socket = new AMDSmiSocket(cpu_socket_id);
sockets_.push_back(socket);
}
AMDSmiProcessor* cpusocket = new AMDSmiProcessor(AMD_CPU, i);
AMDSmiProcessor* cpusocket = new AMDSmiProcessor(AMDSMI_PROCESSOR_TYPE_AMD_CPU, i);
socket->add_processor(cpusocket);
processors_.insert(cpusocket);
for (uint32_t k = 0; k < (cpus/threads)/sockets; k++) {
AMDSmiProcessor* core = new AMDSmiProcessor(AMD_CPU_CORE, k);
AMDSmiProcessor* core = new AMDSmiProcessor(AMDSMI_PROCESSOR_TYPE_AMD_CPU_CORE, k);
socket->add_processor(core);
processors_.insert(core);
}
@@ -322,7 +322,7 @@ amdsmi_status_t AMDSmiSystem::gpu_index_to_handle(uint32_t gpu_index,
auto iter = processors_.begin();
for (; iter != processors_.end(); iter++) {
auto cur_device = (*iter);
if (cur_device->get_processor_type() != AMD_GPU)
if (cur_device->get_processor_type() != AMDSMI_PROCESSOR_TYPE_AMD_GPU)
continue;
amd::smi::AMDSmiGPUDevice* gpu_device =
static_cast<amd::smi::AMDSmiGPUDevice*>(cur_device);
@@ -256,22 +256,22 @@ amdsmi_status_t smi_amdgpu_get_ranges(amd::smi::AMDSmiGPUDevice* device, amdsmi_
std::string fullpath = "/sys/class/drm/" + device->get_gpu_path() + "/device";
switch (domain) {
case CLK_TYPE_GFX:
case AMDSMI_CLK_TYPE_GFX:
fullpath += "/pp_dpm_sclk";
break;
case CLK_TYPE_MEM:
case AMDSMI_CLK_TYPE_MEM:
fullpath += "/pp_dpm_mclk";
break;
case CLK_TYPE_VCLK0:
case AMDSMI_CLK_TYPE_VCLK0:
fullpath += "/pp_dpm_vclk";
break;
case CLK_TYPE_VCLK1:
case AMDSMI_CLK_TYPE_VCLK1:
fullpath += "/pp_dpm_vclk1";
break;
case CLK_TYPE_DCLK0:
case AMDSMI_CLK_TYPE_DCLK0:
fullpath += "/pp_dpm_dclk";
break;
case CLK_TYPE_DCLK1:
case AMDSMI_CLK_TYPE_DCLK1:
fullpath += "/pp_dpm_dclk1";
break;
default:
+10 -10
Wyświetl plik
@@ -34,8 +34,8 @@
extern "C" {
static const char *container_type_name[AMDSMI_MAX_CONTAINER_TYPE] = {
[CONTAINER_LXC] = "lxc",
[CONTAINER_DOCKER] = "docker",
[AMDSMI_CONTAINER_LXC] = "lxc",
[AMDSMI_CONTAINER_DOCKER] = "docker",
};
amdsmi_status_t gpuvsmi_pid_is_gpu(const std::string &path, const char *bdf)
@@ -74,10 +74,10 @@ amdsmi_status_t gpuvsmi_get_pids(const amdsmi_bdf_t &bdf, std::vector<long int>
/* 0000:00:00.0 */
snprintf(bdf_str, 13, "%04x:%02x:%02x.%d",
bdf.fields.domain_number & 0xffff,
bdf.fields.bus_number & 0xff,
bdf.fields.device_number & 0x1f,
bdf.fields.function_number & 0x7);
bdf.domain_number & 0xffff,
bdf.bus_number & 0xff,
bdf.device_number & 0x1f,
bdf.function_number & 0x7);
d = opendir("/proc");
if (!d)
@@ -123,10 +123,10 @@ amdsmi_status_t gpuvsmi_get_pid_info(const amdsmi_bdf_t &bdf, long int pid,
/* 0000:00:00.0 */
snprintf(bdf_str, 13, "%04x:%02x:%02x.%d",
bdf.fields.domain_number & 0xffff,
bdf.fields.bus_number & 0xff,
bdf.fields.device_number & 0x1f,
bdf.fields.function_number & 0x7);
bdf.domain_number & 0xffff,
bdf.bus_number & 0xff,
bdf.device_number & 0x1f,
bdf.function_number & 0x7);
std::string path = "/proc/" + std::to_string(pid) + "/fdinfo/";
@@ -158,11 +158,11 @@ void TestFrequenciesRead::Run(void) {
PrintDeviceHeader(processor_handles_[i]);
freq_output(CLK_TYPE_MEM, "Supported GPU Memory");
freq_output(CLK_TYPE_SYS, "Supported GPU");
freq_output(CLK_TYPE_DF, "Data Fabric Clock");
freq_output(CLK_TYPE_DCEF, "Display Controller Engine Clock");
freq_output(CLK_TYPE_SOC, "SOC Clock");
freq_output(AMDSMI_CLK_TYPE_MEM, "Supported GPU Memory");
freq_output(AMDSMI_CLK_TYPE_SYS, "Supported GPU");
freq_output(AMDSMI_CLK_TYPE_DF, "Data Fabric Clock");
freq_output(AMDSMI_CLK_TYPE_DCEF, "Display Controller Engine Clock");
freq_output(AMDSMI_CLK_TYPE_SOC, "SOC Clock");
err = amdsmi_get_gpu_pci_bandwidth(processor_handles_[i], &b);
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
@@ -104,13 +104,13 @@ void TestFrequenciesReadWrite::Run(void) {
for (uint32_t dv_ind = 0; dv_ind < num_monitor_devs(); ++dv_ind) {
PrintDeviceHeader(processor_handles_[dv_ind]);
for (uint32_t clk = CLK_TYPE_FIRST; clk <= CLK_TYPE__MAX; ++clk) {
for (uint32_t clk = AMDSMI_CLK_TYPE_FIRST; clk <= AMDSMI_CLK_TYPE__MAX; ++clk) {
amdsmi_clk = (amdsmi_clk_type_t)clk;
auto freq_read = [&]() -> bool {
// Skip CLK_TYPE_PCIE, which does not supported in rocm-smi.
// Skip AMDSMI_CLK_TYPE_PCIE, which does not supported in rocm-smi.
std::cout << amdsmi_clk << std::endl;
if (amdsmi_clk == CLK_TYPE_PCIE)
if (amdsmi_clk == AMDSMI_CLK_TYPE_PCIE)
return false;
ret = amdsmi_get_clk_freq(processor_handles_[dv_ind], amdsmi_clk, &f);
std::cout << ret << std::endl;
@@ -139,8 +139,8 @@ void TestFrequenciesReadWrite::Run(void) {
auto freq_write = [&]() {
// Set clocks to something other than the usual default of the lowest
// frequency.
// Skip CLK_TYPE_PCIE, which does not supported in rocm-smi.
if (amdsmi_clk == CLK_TYPE_PCIE)
// Skip AMDSMI_CLK_TYPE_PCIE, which does not supported in rocm-smi.
if (amdsmi_clk == AMDSMI_CLK_TYPE_PCIE)
return;
freq_bitmask = 0b01100; // Try the 3rd and 4th clocks
@@ -155,7 +155,7 @@ void TestIdInfoRead::Run(void) {
std::cout << "\t**Device Vram vendor id: "
<< vram_info.vram_vendor << std::endl;
std::cout << "\t**Device Vram size: "
<< vram_info.vram_size_mb << std::endl;
<< vram_info.vram_size << std::endl;
}
err = amdsmi_get_gpu_vendor_name(processor_handles_[i], buffer, kBufferLen);
@@ -229,7 +229,7 @@ void TestMutualExclusion::Run(void) {
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
ret = amdsmi_get_gpu_fan_speed_max(processor_handles_[0], 0, &dmy_ui64);
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
ret = amdsmi_get_temp_metric(processor_handles_[0], TEMPERATURE_TYPE_EDGE, AMDSMI_TEMP_CURRENT, &dmy_i64);
ret = amdsmi_get_temp_metric(processor_handles_[0], AMDSMI_TEMPERATURE_TYPE_EDGE, AMDSMI_TEMP_CURRENT, &dmy_i64);
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
ret = amdsmi_reset_gpu_fan(processor_handles_[0], 0);
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
@@ -239,13 +239,13 @@ void TestMutualExclusion::Run(void) {
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
ret = amdsmi_get_gpu_overdrive_level(processor_handles_[0], &dmy_ui32);
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
ret = amdsmi_get_clk_freq(processor_handles_[0], CLK_TYPE_SYS, &dmy_freqs);
ret = amdsmi_get_clk_freq(processor_handles_[0], AMDSMI_CLK_TYPE_SYS, &dmy_freqs);
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
ret = amdsmi_get_gpu_od_volt_info(processor_handles_[0], &dmy_od_volt);
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
ret = amdsmi_get_gpu_od_volt_curve_regions(processor_handles_[0], &dmy_ui32, &dmy_vlt_reg);
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
ret = amdsmi_set_clk_freq(processor_handles_[0], CLK_TYPE_SYS, 0);
ret = amdsmi_set_clk_freq(processor_handles_[0], AMDSMI_CLK_TYPE_SYS, 0);
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
ret = amdsmi_get_gpu_ecc_count(processor_handles_[0], AMDSMI_GPU_BLOCK_UMC, &dmy_err_cnt);
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
@@ -57,15 +57,15 @@
static const std::map<uint32_t, std::string> kTempSensorNameMap = {
{TEMPERATURE_TYPE_VRAM, "Memory"},
{TEMPERATURE_TYPE_HOTSPOT, "Hotspot"},
{TEMPERATURE_TYPE_JUNCTION, "Junction"},
{TEMPERATURE_TYPE_EDGE, "Edge"},
{TEMPERATURE_TYPE_HBM_0, "HBM_0"},
{TEMPERATURE_TYPE_HBM_1, "HBM_1"},
{TEMPERATURE_TYPE_HBM_2, "HBM_2"},
{TEMPERATURE_TYPE_HBM_3, "HBM_3"},
{TEMPERATURE_TYPE_PLX, "PLX"}
{AMDSMI_TEMPERATURE_TYPE_VRAM, "Memory"},
{AMDSMI_TEMPERATURE_TYPE_HOTSPOT, "Hotspot"},
{AMDSMI_TEMPERATURE_TYPE_JUNCTION, "Junction"},
{AMDSMI_TEMPERATURE_TYPE_EDGE, "Edge"},
{AMDSMI_TEMPERATURE_TYPE_HBM_0, "HBM_0"},
{AMDSMI_TEMPERATURE_TYPE_HBM_1, "HBM_1"},
{AMDSMI_TEMPERATURE_TYPE_HBM_2, "HBM_2"},
{AMDSMI_TEMPERATURE_TYPE_HBM_3, "HBM_3"},
{AMDSMI_TEMPERATURE_TYPE_PLX, "PLX"}
};
TestTempRead::TestTempRead() : TestBase() {
set_title("AMDSMI Temp Read Test");
@@ -141,7 +141,7 @@ void TestTempRead::Run(void) {
"C" << std::endl;
}
};
for (type = TEMPERATURE_TYPE_FIRST; type <= TEMPERATURE_TYPE__MAX; ++type) {
for (type = AMDSMI_TEMPERATURE_TYPE_FIRST; type <= AMDSMI_TEMPERATURE_TYPE__MAX; ++type) {
IF_VERB(STANDARD) {
std::cout << "\t** **********" << kTempSensorNameMap.at(type) <<
" Temperatures **********" << std::endl;
@@ -220,19 +220,19 @@ const std::string GetVoltSensorNameStr(amdsmi_voltage_type_t st) {
return kVoltSensorNameMap.at(st);
}
const char *FreqEnumToStr(amdsmi_clk_type_t amdsmi_clk) {
static_assert(CLK_TYPE__MAX == CLK_TYPE_DCLK1,
static_assert(AMDSMI_CLK_TYPE__MAX == AMDSMI_CLK_TYPE_DCLK1,
"FreqEnumToStr() needs to be updated");
switch (amdsmi_clk) {
case CLK_TYPE_SYS: return "System clock";
case CLK_TYPE_DF: return "Data Fabric clock";
case CLK_TYPE_DCEF: return "Display Controller Engine clock";
case CLK_TYPE_SOC: return "SOC clock";
case CLK_TYPE_MEM: return "Memory clock";
case CLK_TYPE_PCIE: return "PCIE clock";
case CLK_TYPE_VCLK0: return "VCLK0 clock";
case CLK_TYPE_VCLK1: return "VCLK1 clock";
case CLK_TYPE_DCLK0: return "DCLK0 clock";
case CLK_TYPE_DCLK1: return "DCLK1 clock";
case AMDSMI_CLK_TYPE_SYS: return "System clock";
case AMDSMI_CLK_TYPE_DF: return "Data Fabric clock";
case AMDSMI_CLK_TYPE_DCEF: return "Display Controller Engine clock";
case AMDSMI_CLK_TYPE_SOC: return "SOC clock";
case AMDSMI_CLK_TYPE_MEM: return "Memory clock";
case AMDSMI_CLK_TYPE_PCIE: return "PCIE clock";
case AMDSMI_CLK_TYPE_VCLK0: return "VCLK0 clock";
case AMDSMI_CLK_TYPE_VCLK1: return "VCLK1 clock";
case AMDSMI_CLK_TYPE_DCLK0: return "DCLK0 clock";
case AMDSMI_CLK_TYPE_DCLK1: return "DCLK1 clock";
default: return "Invalid Clock ID";
}
}
@@ -49,28 +49,28 @@
#include "test_utils.h"
static const std::map<amdsmi_fw_block_t, const char *> kDevFWNameMap = {
{FW_ID_ASD, "asd"},
{FW_ID_CP_CE, "ce"},
{FW_ID_DMCU_ERAM, "dmcu"}, // TODO(bliu): double check
{FW_ID_MC, "mc"},
{FW_ID_CP_ME, "me"},
{FW_ID_CP_MEC1, "mec1"},
{FW_ID_CP_MEC2, "mec2"},
{FW_ID_CP_MES, "mes"},
{FW_ID_MES_KIQ, "mes_kiq"}, // TODO: double check
{FW_ID_CP_PFP, "pfp"},
{FW_ID_RLC, "rlc"},
{FW_ID_RLC_SRLG, "rlc_srlg"},
{FW_ID_RLC_SRLS, "rlc_srls"},
{FW_ID_SDMA1, "sdma1"},
{FW_ID_SDMA2, "sdma2"},
{FW_ID_PM, "pm"},
{FW_ID_PSP_SOSDRV, "sos"},
{FW_ID_TA_RAS, "ta_ras"},
{FW_ID_TA_XGMI, "ta_xgmi"},
{FW_ID_UVD, "uvd"},
{FW_ID_VCE, "vce"},
{FW_ID_VCN, "vcn"},
{AMDSMI_FW_ID_ASD, "asd"},
{AMDSMI_FW_ID_CP_CE, "ce"},
{AMDSMI_FW_ID_DMCU_ERAM, "dmcu"}, // TODO(bliu): double check
{AMDSMI_FW_ID_MC, "mc"},
{AMDSMI_FW_ID_CP_ME, "me"},
{AMDSMI_FW_ID_CP_MEC1, "mec1"},
{AMDSMI_FW_ID_CP_MEC2, "mec2"},
{AMDSMI_FW_ID_CP_MES, "mes"},
{AMDSMI_FW_ID_MES_KIQ, "mes_kiq"}, // TODO: double check
{AMDSMI_FW_ID_CP_PFP, "pfp"},
{AMDSMI_FW_ID_RLC, "rlc"},
{AMDSMI_FW_ID_RLC_SRLG, "rlc_srlg"},
{AMDSMI_FW_ID_RLC_SRLS, "rlc_srls"},
{AMDSMI_FW_ID_SDMA1, "sdma1"},
{AMDSMI_FW_ID_SDMA2, "sdma2"},
{AMDSMI_FW_ID_PM, "pm"},
{AMDSMI_FW_ID_PSP_SOSDRV, "sos"},
{AMDSMI_FW_ID_TA_RAS, "ta_ras"},
{AMDSMI_FW_ID_TA_XGMI, "ta_xgmi"},
{AMDSMI_FW_ID_UVD, "uvd"},
{AMDSMI_FW_ID_VCE, "vce"},
{AMDSMI_FW_ID_VCN, "vcn"},
};
const char *
+46 -1
Wyświetl plik
@@ -73,7 +73,6 @@ def parseArgument():
def replace_line(full_path_file_name, string_to_repalce, new_string):
fh, abs_path = tempfile.mkstemp()
with os.fdopen(fh, 'w') as new_file:
new_file.write(HEADER)
with open(full_path_file_name, 'r+', encoding='UTF-8') as old_file:
for line in old_file:
new_file.write(line.replace(string_to_repalce, new_string))
@@ -83,6 +82,19 @@ def replace_line(full_path_file_name, string_to_repalce, new_string):
shutil.move(abs_path, full_path_file_name)
def write_header(full_path_file_name):
fh, abs_path = tempfile.mkstemp()
with os.fdopen(fh, 'w') as new_file:
new_file.write(HEADER)
with open(full_path_file_name, 'r+', encoding='UTF-8') as old_file:
for line in old_file:
new_file.write(line)
shutil.copymode(full_path_file_name, abs_path)
os.remove(full_path_file_name)
shutil.move(abs_path, full_path_file_name)
def main():
output_file, input_file, library, clang_extra_args = parseArgument()
@@ -134,8 +146,41 @@ except OSError as error:
arguments.append("--clang-args=-I" + clang_include_dir + clang_extra_args)
clangToPy(arguments)
write_header(output_file)
replace_line(output_file, line_to_replace, new_line)
# Custom handling for anonymous struct within amdsmi_bdf_t in Linux
if os_platform == "Linux":
# Get line number for anonymous error in struct_amdsmi_bdf_t
reference_line = "uint64_t function_number :"
line_number = -1
with open(input_file, 'r') as file:
for input_file_line_number, line in enumerate(file, 1):
if reference_line in line:
line_number = input_file_line_number - 1 # Anonymous line will error on the line before this
break
if line_number == -1:
print("Could not find reference line in amdsmi.h for amdsmi_bdf_t struct. Skipping anonymous struct replacement.")
else:
print(f"Found reference line in amdsmi.h for amdsmi_bdf_t struct at line {line_number}")
union_anon_line = "union_amdsmi_bdf_t._anonymous_ = ('_0',)"
replace_line(output_file, union_anon_line, "")
internal_union_anon_line = f"('_0', struct_struct (anonymous at amdsmi.h:{line_number}:3))"
internal_union_struct_line = "('struct_amdsmi_bdf_t', struct_amdsmi_bdf_t)"
replace_line(output_file, internal_union_anon_line, internal_union_struct_line)
struct_anon_line = f"struct_struct (anonymous at amdsmi.h:{line_number}:3)"
struct_amdsmi_bdf_t_line = "struct_amdsmi_bdf_t"
replace_line(output_file, struct_anon_line, struct_amdsmi_bdf_t_line)
struct_anon_all_line = "'struct_struct (anonymous at"
struct_amdsmi_bdf_t_line = "'struct_amdsmi_bdf_t',"
replace_line(output_file, struct_anon_all_line, struct_amdsmi_bdf_t_line)
struct_anon_all_line = f"amdsmi.h:{line_number}:3)', "
replace_line(output_file, struct_anon_all_line, "")
if __name__ == "__main__":
main()