Discovery Queries

Discovery Queries#

AMD SMI: Discovery Queries
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, size_t len, char *name)
 Get information about the given socket. More...
 
amdsmi_status_t amdsmi_get_processor_handles (amdsmi_socket_handle socket_handle, uint32_t *processor_count, amdsmi_processor_handle *processor_handles)
 Get the list of the processor handles associated to a socket. More...
 
amdsmi_status_t amdsmi_get_processor_type (amdsmi_processor_handle processor_handle, processor_type_t *processor_type)
 Get the processor type of the processor_handle. More...
 
amdsmi_status_t amdsmi_get_processor_handle_from_bdf (amdsmi_bdf_t bdf, amdsmi_processor_handle *processor_handle)
 Get processor 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 processor handles in that socket, which will be used in other APIs to get processor detail information or telemtries.

Parameters
[in,out]socket_countAs 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 to socket_handles. On return, socket_count will contain the number of socket handles written to socket_handles, or the number of socket handles that could have been written if enough memory had been provided. If socket_handles is NULL, as output, socket_count will contain how many sockets are available to read in the system.
[in,out]socket_handlesA 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,
size_t  len,
char *  name 
)

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_handlea socket handle
[out]nameThe id of the socket.
[in]lenthe length of the caller provided buffer name.
Returns
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail

◆ amdsmi_get_processor_handles()

amdsmi_status_t amdsmi_get_processor_handles ( amdsmi_socket_handle  socket_handle,
uint32_t *  processor_count,
amdsmi_processor_handle processor_handles 
)

Get the list of the processor handles associated to a socket.

This function retrieves the processor handles of a socket. The socket_handle must be provided for the processor. A socket may have mulitple different type processors: An APU on a socket have both CPUs and GPUs. Currently, only AMD GPUs are supported.

The number of processor count is returned through processor_count if processor_handles is NULL. Then the number of processor_count can be pass as input to retrieval all processors on the socket to processor_handles.

Parameters
[in]socket_handleThe socket to query
[in,out]processor_countAs input, the value passed through this parameter is the number of amdsmi_processor_handle's that may be safely written to the memory pointed to by processor_handles. This is the limit on how many processor handles will be written to processor_handles. On return, processor_count will contain the number of processor handles written to processor_handles, or the number of processor handles that could have been written if enough memory had been provided. If processor_handles is NULL, as output, processor_count will contain how many processors are available to read for the socket.
[in,out]processor_handlesA pointer to a block of memory to which the amdsmi_processor_handle values will be written. This value may be NULL. In this case, this function can be used to query how many processors are available to read.
Returns
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail

◆ amdsmi_get_processor_type()

amdsmi_status_t amdsmi_get_processor_type ( amdsmi_processor_handle  processor_handle,
processor_type_t processor_type 
)

Get the processor type of the processor_handle.

This function retrieves the processor type. A processor_handle must be provided for that processor.

Parameters
[in]processor_handlea processor handle
[out]processor_typea pointer to processor_type_t to which the processor 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_processor_handle_from_bdf()

amdsmi_status_t amdsmi_get_processor_handle_from_bdf ( amdsmi_bdf_t  bdf,
amdsmi_processor_handle processor_handle 
)

Get processor handle with the matching bdf.

Given bdf info bdf, this function will get the processor handle with the matching bdf.

Parameters
[in]bdfThe bdf to match with corresponding processor handle.
[out]processor_handleprocessor handle with the matching bdf.
Returns
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail