Skip to content

Commit c11a8ef

Browse files
authored
Merge amd-staging into amd-mainline 20250308 (#162)
Signed-off-by: Maisam Arif <Maisam.Arif@amd.com>
2 parents de6f49b + 0e67568 commit c11a8ef

File tree

25 files changed

+1479
-118
lines changed

25 files changed

+1479
-118
lines changed

.github/workflows/amdsmi-build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ jobs:
1313
runs-on:
1414
- self-hosted
1515
- ${{ vars.RUNNER_TYPE }}
16+
continue-on-error: true
1617
strategy:
1718
matrix:
1819
os:
@@ -171,6 +172,7 @@ jobs:
171172
runs-on:
172173
- self-hosted
173174
- ${{ vars.RUNNER_TYPE }}
175+
continue-on-error: true
174176
strategy:
175177
matrix:
176178
os:

CHANGELOG.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,36 @@ Full documentation for amd_smi_lib is available at [https://rocm.docs.amd.com/pr
88

99
### Added
1010

11+
- **Added enumeration mapping `amdsmi_get_gpu_enumeration_info()` to Python & C APIs.**
12+
- Enumeration mapping consists of `amdsmi_enumeration_info_t`
13+
14+
```shell
15+
typedef struct {
16+
uint32_t drm_render; // the render node under /sys/class/drm/renderD*
17+
uint32_t drm_card; // the graphic card device under /sys/class/drm/card*
18+
uint32_t hsa_id; // the HSA enumeration ID
19+
uint32_t hip_id; // the HIP enumeration ID
20+
char hip_uuid[AMDSMI_MAX_STRING_LENGTH]; // the HIP unique identifer
21+
} amdsmi_enumeration_info_t;
22+
```
23+
24+
- The mapping is also enabled in the CLI interface via `amd-smi list -e`
25+
26+
```shell
27+
$ amd-smi list -e
28+
GPU: 0
29+
BDF: 0000:23:00.0
30+
UUID: XXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
31+
KFD_ID: 45412
32+
NODE_ID: 1
33+
PARTITION_ID: 0
34+
RENDER: renderD128
35+
CARD: card0
36+
HSA_ID: 1
37+
HIP_ID: 0
38+
HIP_UUID: GPU-XXXXXXXXXXXXXXXX
39+
```
40+
1141
- **Added dynamic virtualization mode detection**.
1242
- Added new C and Python API `amdsmi_get_gpu_virtualization_mode_info`
1343
- Added new C and Python enum `amdsmi_virtualization_mode_t`
@@ -414,7 +444,9 @@ Updated structure `amdsmi_vram_info_t`:
414444
415445
### Upcoming changes
416446
417-
- **Deprication of the `AMDSMI_LIB_VERSION_YEAR` enum and API fields.**
447+
- **Deprication in ROCm 7.0 of the `AMDSMI_LIB_VERSION_YEAR` enum and API fields.**
448+
449+
- **Deprication in ROCm 7.0 of the `pasid` field within struct `amdsmi_process_info_t`**
418450
419451
### Known issues
420452

README.md

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,23 @@ for more information.
2626
* [Install the AMD SMI library and CLI tool](https://rocm.docs.amd.com/projects/amdsmi/en/latest/install/install.html)
2727

2828
## Requirements
29-
The following are required to install and use the AMD SMI libraries and CLI tool.
3029

31-
* Python 3.6.8+ (64-bit)
30+
The following are required to install and use the AMD SMI library through its language interfaces and CLI.
31+
3232
* `amdgpu` driver must be loaded for [`amdsmi_init()`](./docs/how-to/amdsmi-cpp-lib#hello-amd-smi) to work.
33+
* Export `LD_LIBRARY_PATH` to the `amdsmi` installation directory.
34+
35+
```bash
36+
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/rocm/lib:/opt/rocm/lib64
37+
```
38+
39+
### Python interface and CLI tool prerequisites
40+
41+
* Python 3.6.8+ (64-bit)
42+
43+
### Go API prerequisites
44+
45+
* Go version 1.20 or greater
3346

3447
## Install amdgpu driver and AMD SMI with ROCm
3548

@@ -97,6 +110,17 @@ Refer to the [user guide](https://rocm.docs.amd.com/projects/amdsmi/en/latest/ho
97110
detailed [Python API reference](https://rocm.docs.amd.com/projects/amdsmi/en/latest/reference/amdsmi-py-api.html) in the
98111
ROCm documentation portal.
99112

113+
### Go library
114+
115+
The AMD SMI Go interface provides a simple
116+
[API](https://rocm.docs.amd.com/projects/amdsmi/en/latest/reference/amdsmi-go-lib.html)
117+
for AMD hardware management. It streamlines hardware monitoring and control
118+
while leveraging Golang's features.
119+
120+
Refer to the [user guide](https://rocm.docs.amd.com/projects/amdsmi/en/latest/how-to/amdsmi-go-lib.html) and the
121+
[Go API reference](https://rocm.docs.amd.com/projects/amdsmi/en/latest/reference/amdsmi-go-api.html) in the
122+
ROCm documentation portal.
123+
100124
### CLI tool
101125

102126
A versatile command line tool for managing and monitoring AMD hardware. You can use `amd-smi` for:

amdsmi_cli/amdsmi_commands.py

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ def version(self, args, gpu_version=None, cpu_version=None):
175175
elif self.logger.is_json_format() or self.logger.is_csv_format():
176176
self.logger.print_output()
177177

178-
179178
def list(self, args, multiple_devices=False, gpu=None):
180179
"""List information for target gpu
181180
@@ -214,12 +213,20 @@ def list(self, args, multiple_devices=False, gpu=None):
214213
bdf = amdsmi_interface.amdsmi_get_gpu_device_bdf(args.gpu)
215214
except amdsmi_exception.AmdSmiLibraryException as e:
216215
bdf = e.get_error_info()
217-
218216
try:
219217
uuid = amdsmi_interface.amdsmi_get_gpu_device_uuid(args.gpu)
220218
except amdsmi_exception.AmdSmiLibraryException as e:
221219
uuid = e.get_error_info()
222220

221+
try:
222+
enumeration_info = amdsmi_interface.amdsmi_get_gpu_enumeration_info(args.gpu)
223+
except:
224+
enumeration_info = {"drm_render": "N/A",
225+
"drm_card": "N/A",
226+
"hip_id": "N/A",
227+
"hip_uuid": "N/A",
228+
"hsa_id": "N/A"}
229+
223230
try:
224231
kfd_info = amdsmi_interface.amdsmi_get_gpu_kfd_info(args.gpu)
225232
kfd_id = kfd_info['kfd_id']
@@ -233,15 +240,26 @@ def list(self, args, multiple_devices=False, gpu=None):
233240
if self.logger.is_csv_format():
234241
self.logger.store_output(args.gpu, 'gpu_bdf', bdf)
235242
self.logger.store_output(args.gpu, 'gpu_uuid', uuid)
236-
self.logger.store_output(args.gpu, 'kfd_id', kfd_id)
237-
self.logger.store_output(args.gpu, 'node_id', node_id)
238-
self.logger.store_output(args.gpu, 'partition_id', partition_id)
239243
else:
240244
self.logger.store_output(args.gpu, 'bdf', bdf)
241245
self.logger.store_output(args.gpu, 'uuid', uuid)
242-
self.logger.store_output(args.gpu, 'kfd_id', kfd_id)
243-
self.logger.store_output(args.gpu, 'node_id', node_id)
244-
self.logger.store_output(args.gpu, 'partition_id', partition_id)
246+
247+
self.logger.store_output(args.gpu, 'kfd_id', kfd_id)
248+
self.logger.store_output(args.gpu, 'node_id', node_id)
249+
self.logger.store_output(args.gpu, 'partition_id', partition_id)
250+
251+
if args.e:
252+
if enumeration_info['drm_render'] == "N/A":
253+
self.logger.store_output(args.gpu, 'render', enumeration_info['drm_render'])
254+
else:
255+
self.logger.store_output(args.gpu, 'render', f"renderD{enumeration_info['drm_render']}")
256+
if enumeration_info['drm_card'] == "N/A":
257+
self.logger.store_output(args.gpu, 'card', enumeration_info['drm_card'])
258+
else:
259+
self.logger.store_output(args.gpu, 'card', f"card{enumeration_info['drm_card']}")
260+
self.logger.store_output(args.gpu, 'hsa_id', enumeration_info['hsa_id'])
261+
self.logger.store_output(args.gpu, 'hip_id', enumeration_info['hip_id'])
262+
self.logger.store_output(args.gpu, 'hip_uuid', enumeration_info['hip_uuid'])
245263

246264
if multiple_devices:
247265
self.logger.store_multiple_device_output()

amdsmi_cli/amdsmi_parser.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,8 @@ def _add_list_parser(self, subparsers: argparse._SubParsersAction, func):
626626

627627
# Create list subparser
628628
list_parser = subparsers.add_parser('list', help=list_help, description=list_subcommand_help)
629+
# Create -e subparser
630+
list_parser.add_argument("-e", action="store_true", help="Enumeration mapping to other features.\n Lists the BDF, UUID, KFD_ID, CARD, RENDER, HIP_ID, HIP_UUID and HSA_ID for each GPU.")
629631
list_parser.formatter_class=lambda prog: AMDSMISubparserHelpFormatter(prog)
630632
list_parser.set_defaults(func=func)
631633

0 commit comments

Comments
 (0)