Discovery Queries#
Functions | |
amdsmi_status_t | amdsmi_get_socket_handles (uint32_t *socket_count, amdsmi_socket_handle *socket_handles) |
Get the list of socket handles in the system. More... | |
amdsmi_status_t | amdsmi_get_socket_info (amdsmi_socket_handle socket_handle, char *name, size_t len) |
Get information about the given socket. More... | |
amdsmi_status_t | amdsmi_get_device_handles (amdsmi_socket_handle socket_handle, uint32_t *device_count, amdsmi_device_handle *device_handles) |
Get the list of the device handles associated to a socket. More... | |
amdsmi_status_t | amdsmi_get_device_type (amdsmi_device_handle device_handle, device_type_t *device_type) |
Get the device type of the device_handle. More... | |
amdsmi_status_t | amdsmi_get_device_handle_from_bdf (amdsmi_bdf_t bdf, amdsmi_device_handle *device_handle) |
Get device handle with the matching bdf. More... | |
Detailed Description
These functions provide discovery of the sockets.
Function Documentation
◆ amdsmi_get_socket_handles()
amdsmi_status_t amdsmi_get_socket_handles | ( | uint32_t * | socket_count, |
amdsmi_socket_handle * | socket_handles | ||
) |
Get the list of socket handles in the system.
Depends on what flag is passed to amdsmi_init. AMDSMI_INIT_AMD_GPUS returns sockets with AMD GPUS, and AMDSMI_INIT_AMD_GPUS | AMDSMI_INIT_AMD_CPUS returns sockets with either AMD GPUS or CPUS. The socket handles can be used to query the device handles in that socket, which will be used in other APIs to get device detail information or telemtries.
- Parameters
-
[in,out] socket_count As input, the value passed through this parameter is the number of ::amdsmi_socket_handle that may be safely written to the memory pointed to by socket_handles
. This is the limit on how many socket handles will be written tosocket_handles
. On return,socket_count
will contain the number of socket handles written tosocket_handles
, or the number of socket handles that could have been written if enough memory had been provided. Ifsocket_handles
is NULL, as output,socket_count
will contain how many sockets are available to read in the system.[in,out] socket_handles A pointer to a block of memory to which the ::amdsmi_socket_handle values will be written. This value may be NULL. In this case, this function can be used to query how many sockets are available to read in the system.
- Returns
- amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
◆ amdsmi_get_socket_info()
amdsmi_status_t amdsmi_get_socket_info | ( | amdsmi_socket_handle | socket_handle, |
char * | name, | ||
size_t | len | ||
) |
Get information about the given socket.
This function retrieves socket information. The socket_handle
must be provided to retrieve the Socket ID.
- Parameters
-
[in] socket_handle a socket handle [out] name The id of the socket. [in] len the length of the caller provided buffer name
.
- Returns
- amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
◆ amdsmi_get_device_handles()
amdsmi_status_t amdsmi_get_device_handles | ( | amdsmi_socket_handle | socket_handle, |
uint32_t * | device_count, | ||
amdsmi_device_handle * | device_handles | ||
) |
Get the list of the device handles associated to a socket.
This function retrieves the device handles of a socket. The socket_handle
must be provided for the device. A socket may have mulitple different type devices: An APU on a socket have both CPUs and GPUs. Currently, only AMD GPUs are supported.
The number of device count is returned through device_count
if device_handles
is NULL. Then the number of device_count
can be pass as input to retrieval all devices on the socket to device_handles
.
- Parameters
-
[in] socket_handle The socket to query [in,out] device_count As input, the value passed through this parameter is the number of amdsmi_device_handle's that may be safely written to the memory pointed to by device_handles
. This is the limit on how many device handles will be written todevice_handles
. On return,device_count
will contain the number of device handles written todevice_handles
, or the number of device handles that could have been written if enough memory had been provided. Ifdevice_handles
is NULL, as output,device_count
will contain how many devices are available to read for the socket.[in,out] device_handles A pointer to a block of memory to which the amdsmi_device_handle values will be written. This value may be NULL. In this case, this function can be used to query how many devices are available to read.
- Returns
- amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
◆ amdsmi_get_device_type()
amdsmi_status_t amdsmi_get_device_type | ( | amdsmi_device_handle | device_handle, |
device_type_t * | device_type | ||
) |
Get the device type of the device_handle.
This function retrieves the device type. A device_handle must be provided for that device.
- Parameters
-
[in] device_handle a device handle [out] device_type a pointer to device_type_t to which the device type will be written. If this parameter is nullptr, this function will return AMDSMI_STATUS_INVAL.
- Returns
- amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
◆ amdsmi_get_device_handle_from_bdf()
amdsmi_status_t amdsmi_get_device_handle_from_bdf | ( | amdsmi_bdf_t | bdf, |
amdsmi_device_handle * | device_handle | ||
) |
Get device handle with the matching bdf.
Given bdf info bdf
, this function will get the device handle with the matching bdf.
- Parameters
-
[in] bdf The bdf to match with corresponding device handle. [out] device_handle device handle with the matching bdf.
- Returns
- amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail