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_cpusocket_handles (uint32_t *socket_count, amdsmi_cpusocket_handle *socket_handles)
 Get the list of cpu 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_info (amdsmi_processor_handle processor_handle, size_t len, char *name)
 Get information about the given processor. More...
 
amdsmi_status_t amdsmi_get_processor_count_from_handles (amdsmi_processor_handle *processor_handles, uint32_t *processor_count, uint32_t *nr_cpusockets, uint32_t *nr_cpucores, uint32_t *nr_gpus)
 Get respective processor counts from the processor handles. More...
 
amdsmi_status_t amdsmi_get_processor_handles_by_type (amdsmi_socket_handle socket_handle, processor_type_t processor_type, amdsmi_processor_handle *processor_handles, uint32_t *processor_count)
 Get processor list as per processor type. 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_cpucore_handles (amdsmi_cpusocket_handle socket_handle, uint32_t *processor_count, amdsmi_processor_handle *processor_handles)
 Get the list of the cpu core handles associated to a cpu 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.

Platform:

gpu_bm_linux

host

cpu_bm

guest_1vf

guest_mvf

guest_windows

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_cpusocket_handles()

amdsmi_status_t amdsmi_get_cpusocket_handles ( uint32_t *  socket_count,
amdsmi_cpusocket_handle *  socket_handles 
)

Get the list of cpu socket handles in the system.

Platform:
cpu_bm

Depends on AMDSMI_INIT_AMD_CPUS flag passed to amdsmi_init. 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.

Parameters
[in,out]socket_countAs input, the value passed through this parameter is the number of ::amdsmi_cpusocket_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_cpusocket_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.

Platform:

gpu_bm_linux

host

guest_1vf

guest_mvf

guest_windows

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_info()

amdsmi_status_t amdsmi_get_processor_info ( amdsmi_processor_handle  processor_handle,
size_t  len,
char *  name 
)

Get information about the given processor.

Platform:
cpu_bm

This function retrieves processor information. The processor_handle must be provided to retrieve the processor ID.

Parameters
[in]processor_handlea processor handle
[out]nameThe id of the processor.
[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_count_from_handles()

amdsmi_status_t amdsmi_get_processor_count_from_handles ( amdsmi_processor_handle processor_handles,
uint32_t *  processor_count,
uint32_t *  nr_cpusockets,
uint32_t *  nr_cpucores,
uint32_t *  nr_gpus 
)

Get respective processor counts from the processor handles.

Platform:
cpu_bm

This function retrieves respective processor counts information. The processor_handle must be provided to retrieve the processor ID.

Parameters
[in]processor_handlesA pointer to a block of memory to which the amdsmi_processor_handle values will be written. This value may be NULL.
[in]processor_counttotal processor count per socket
[out]nr_cpusocketsTotal number of cpu sockets
[out]nr_cpucoresTotal number of cpu cores
[out]nr_gpusTotal number of gpu devices
Returns
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail

◆ amdsmi_get_processor_handles_by_type()

amdsmi_status_t amdsmi_get_processor_handles_by_type ( amdsmi_socket_handle  socket_handle,
processor_type_t  processor_type,
amdsmi_processor_handle processor_handles,
uint32_t *  processor_count 
)

Get processor list as per processor type.

Platform:
cpu_bm

This function retrieves processor list as per the processor type from the total processor handles list. The list of processor_handles and processor type must be provided.

Parameters
[in]socket_handlesocket handle
[in]processor_typeprocessor type
[out]processor_handleslist of processor handles as per processor type
[out]processor_countprocessor count as per processor type selected
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.

Platform:

gpu_bm_linux

host

guest_1vf

guest_mvf

guest_windows

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_cpucore_handles()

amdsmi_status_t amdsmi_get_cpucore_handles ( amdsmi_cpusocket_handle  socket_handle,
uint32_t *  processor_count,
amdsmi_processor_handle processor_handles 
)

Get the list of the cpu core handles associated to a cpu socket.

Platform:
cpu_bm

This function retrieves the cpu core handles of a cpu socket.

Parameters
[in]socket_handleThe cpu 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 cpu cores are available to read for the cpu 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.

Platform:

gpu_bm_linux

host

cpu_bm

guest_1vf

guest_mvf

guest_windows

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.

Platform:

gpu_bm_linux

host

guest_1vf

guest_mvf

guest_windows

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