AMD SMI C/C++ functions#
AMD SMI library functions grouped by category. Each function returns an
amdsmi_status_t status code.
Initialization and Shutdown#
-
amdsmi_status_t amdsmi_init(uint64_t init_flags)#
Initialize the AMD SMI library.
@platform{gpu_bm_linux} @platform{host} @platform{cpu_bm} @platform{guest_1vf} @platform{guest_mvf} @platform{guest_windows}
This function initializes the library and the internal data structures, including those corresponding to sources of information that SMI provides. Singleton Design, requires the same number of inits as shutdowns.
The
init_flagsdecides which type of processor can be discovered by amdsmi_get_socket_handles(). 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. Currently, only AMDSMI_INIT_AMD_GPUS is supported.- Parameters:
init_flags – [in] Bit flags that tell SMI how to initialize. Values of amdsmi_init_flags_t may be OR’d together and passed through
init_flagsto modify how AMDSMI initializes.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_shut_down(void)#
Shutdown the AMD SMI library.
@platform{gpu_bm_linux} @platform{host} @platform{cpu_bm} @platform{guest_1vf} @platform{guest_mvf} @platform{guest_windows}
This function shuts down the library and internal data structures and performs any necessary clean ups. Singleton Design, requires the same number of inits as shutdowns.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
Processor Discovery#
-
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)#
Returns a list of processor handles of the specified type in the system.
@platform{host} @platform{gpu_bm_linux} @platform{cpu_bm}
This function retrieves processor list as per the processor type from the total processor handles list. The
listof processor_handles and processor type must be provided.Note
This function fills the user-provided buffer with processor handles of the given type (e.g., GPU, NIC). The processor handles returned are used to instantiate the rest of processor queries in the library. If the buffer is not large enough, the call will fail.
- Parameters:
socket_handle – [in] The socket to query.
processor_type – [in] The type of processor to query (see processor_type_t).
processor_handles – [out] Reference to list of processor handles returned by the library. Buffer must be allocated by user.
processor_count – [inout] As input, the size of the provided buffer. As output, number of processor handles in the buffer. Parameter must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
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} @platform{host} @platform{cpu_bm} @platform{guest_1vf} @platform{guest_mvf} @platform{guest_windows}
This function retrieves the processor type. A processor_handle must be provided for that processor.
- Parameters:
processor_handle – [in] a processor handle
processor_type – [out] a 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_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} @platform{host} @platform{cpu_bm} @platform{guest_1vf} @platform{guest_mvf} @platform{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 telemetries.
- Parameters:
socket_count – [inout] 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_countwill 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_handlesis NULL, as output,socket_countwill contain how many sockets are available to read in the system.socket_handles – [inout] 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_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} @platform{host} @platform{guest_1vf} @platform{guest_mvf} @platform{guest_windows}
This function retrieves the processor handles of a socket. The
socket_handlemust be provided for the processor. A socket may have multiple 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_countifprocessor_handlesis NULL. Then the number ofprocessor_countcan be pass as input to retrieval all processors on the socket toprocessor_handles.Note
Sockets are not supported on the @platform{host}.
Note
On the @platform{host} this function currently supports only AMD GPUs. To enumerate other devices, such as AMD NICs, use amdsmi_get_processor_handles_by_type().
- Parameters:
socket_handle – [in] The socket to query
processor_count – [inout] As 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 toprocessor_handles. On return,processor_countwill contain the number of processor handles written toprocessor_handles, or the number of processor handles that could have been written if enough memory had been provided. Ifprocessor_handlesis NULL, as output,processor_countwill contain how many processors are available to read for the socket.processor_handles – [inout] A 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_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} @platform{host} @platform{guest_1vf} @platform{guest_mvf} @platform{guest_windows}
This function retrieves socket information. The
socket_handlemust be provided to retrieve the Socket ID.- Parameters:
socket_handle – [in] a socket handle
len – [in] the length of the caller provided buffer
name.name – [out] The id of the socket.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
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} @platform{host} @platform{guest_1vf} @platform{guest_mvf} @platform{guest_windows}
Given bdf info
bdf, this function will get the processor handle with the matching bdf.- Parameters:
bdf – [in] The bdf to match with corresponding processor handle.
processor_handle – [out] processor handle with the matching bdf.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_gpu_device_bdf(amdsmi_processor_handle processor_handle, amdsmi_bdf_t *bdf)#
Returns BDF of the given GPU device.
@platform{gpu_bm_linux} @platform{host} @platform{guest_1vf} @platform{guest_mvf} @platform{guest_windows}
- Parameters:
processor_handle – [in] Device which to query
bdf – [out] Reference to BDF. Must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_gpu_device_uuid(amdsmi_processor_handle processor_handle, unsigned int *uuid_length, char *uuid)#
Returns the UUID of the device.
@platform{gpu_bm_linux} @platform{host} @platform{guest_1vf} @platform{guest_mvf} @platform{guest_windows}
- Parameters:
processor_handle – [in] Device which to query
uuid_length – [inout] Length of the uuid string. As input, must be equal or greater than AMDSMI_GPU_UUID_SIZE and be allocated by user. As output it is the length of the uuid string.
uuid – [out] Pointer to string to store the UUID. Must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_gpu_virtualization_mode(amdsmi_processor_handle processor_handle, amdsmi_virtualization_mode_t *mode)#
Returns the virtualization mode for the target device.
@platform{gpu_bm_linux} @platform{host} @platform{guest_windows}
The virtualization mode is detected and returned as an enum.
- Parameters:
processor_handle – [in] The identifier of the given device.
mode – [inout] Reference to the enum representing virtualization mode.
When zero, the virtualization mode is unknown
When non-zero, the virtualization mode is detected
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail.
-
amdsmi_status_t amdsmi_get_cpu_affinity_with_scope(amdsmi_processor_handle processor_handle, uint32_t cpu_set_size, uint64_t *cpu_set, amdsmi_affinity_scope_t scope)#
Retrieves an array of uint64_t (sized to cpu_set_size) of bitmasks with the affinity within numa node or socket for the device.
@platform{gpu_bm_linux} @platform{host}
Given a processor handle
processor_handle, the size of the cpu_set arraycpu_set_size, and a pointer to an array of int64_tcpu_set, andscope, this function will write the CPU affinity bitmask to the array pointed to bycpu_set.User must allocate the enough memory for the cpu_set array. The size of the array is determined by the number of CPU cores in the system. As an example, if there are 2 CPUs and each has 112 cores, the size should be ceiling(2*112/64) = 4, where 64 is the bits of uint64_t. The function will write the CPU affinity bitmask to the array. For example, to describe the CPU cores 0-55,112-167, it will set the 0-55 and 112-167 bits to 1 and the reset of bits to 0 in the cpu_set array.
- Parameters:
processor_handle – [in] a processor handle
cpu_set_size – [in] The size of the cpu_set array that is safe to access
cpu_set – [inout] Array reference in which to return a bitmask of CPU cores that this processor affinities with.
scope – [in] Scope for socket or numa affinity.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_node_handle(amdsmi_processor_handle processor_handle, amdsmi_node_handle *node_handle)#
Get the node handle associated with processor handle.
@platform{gpu_bm_linux} @platform{host}
This function retrieves the node handle of a processor handler. The
processor_handlemust be provided for the processor. Currently, only AMD GPUs are supported.- Parameters:
processor_handle – [in] A pointer to a amdsmi_processor_handle, this is required to be OAM ID 0 otherwise the API will fail. OAM ID is sourced from amdsmi_get_gpu_asic_info API.
node_handle – [out] A pointer to a block of memory where amdsmi_node_handle will be written.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_index_from_processor_handle(amdsmi_processor_handle processor_handle, uint32_t *processor_index)#
Returns the index of the given processor handle.
@platform{host} @platform{guest_1vf} @platform{guest_mvf} @platform{guest_windows}
- Parameters:
processor_handle – [in] Processor handle for which to query
processor_index – [out] Pointer to integer to store the processor index. Must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_processor_handle_from_index(uint32_t processor_index, amdsmi_processor_handle *processor_handle)#
Returns the processor handle from the given processor index.
@platform{host} @platform{guest_1vf} @platform{guest_mvf} @platform{guest_windows}
Note
On the @platform{host} this function currently supports only AMD GPU indexes.
- Parameters:
processor_index – [in] Function processor_index to query
processor_handle – [out] Reference to the processor handle. Must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_processor_bdf(amdsmi_processor_handle processor_handle, amdsmi_bdf_t *bdf)#
Returns BDF of the given device.
@platform{host} @platform{guest_1vf} @platform{guest_mvf} @platform{guest_windows}
- Parameters:
processor_handle – [in] Device which to query
bdf – [out] Reference to BDF. Must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_processor_handle_from_uuid(const char *uuid, amdsmi_processor_handle *processor_handle)#
Returns the processor handle from the given UUID.
@platform{host} @platform{guest_windows}
- Parameters:
uuid – [in] Function UUID to query.
processor_handle – [out] Reference to the processor handle. Must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_vf_handle_from_bdf(amdsmi_bdf_t bdf, amdsmi_vf_handle_t *vf_handle)#
Returns VF handle from the given BDF.
@platform{host}
- Parameters:
bdf – [in] BDF of the VF
vf_handle – [out] Reference to the VF handle. Must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_vf_handle_from_uuid(const char *uuid, amdsmi_vf_handle_t *vf_handle)#
Returns the handle of a virtual function from the given UUID.
@platform{host}
- Parameters:
uuid – [in] Function UUID to query.
vf_handle – [out] Reference to the VF handle. Must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_vf_handle_from_vf_index(amdsmi_processor_handle processor_handle, uint32_t fcn_idx, amdsmi_vf_handle_t *vf_handle)#
Returns the handle of a virtual function given its index.
@platform{host}
- Parameters:
processor_handle – [in] PF of a processor for which to query
fcn_idx – [in] Function index to query
vf_handle – [out] VF handle. Must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_vf_bdf(amdsmi_vf_handle_t vf_handle, amdsmi_bdf_t *bdf)#
Returns BDF of the given device (VF).
@platform{host}
- Parameters:
vf_handle – [in] VF for which to query
bdf – [out] Reference to BDF. Must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_vf_uuid(amdsmi_vf_handle_t processor_handle, unsigned int *uuid_length, char *uuid)#
Returns the UUID of the VF.
@platform{host}
- Parameters:
processor_handle – [in] VF for which to query
uuid_length – [inout] Length of the uuid string. As input, must be equal or greater than AMDSMI_GPU_UUID_SIZE and be allocated by user. As output it is the length of the uuid string.
uuid – [out] Pointer to string to store the UUID. Must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_nic_processor_handles(amdsmi_socket_handle socket_handle, uint32_t *processor_count, amdsmi_processor_handle *processor_handles)#
Get the list of the NIC processor handles associated to a socket.
@platform{gpu_bm_linux} @platform{host}
This function retrieves the processor handles of a socket. The
socket_handlemust be provided for the processor.The number of processor count is returned through
processor_countifprocessor_handlesis NULL. Then the number ofprocessor_countcan be pass as input to retrieval all processors on the socket toprocessor_handles.Note
Sockets are not supported on the @platform{host}.
- Parameters:
socket_handle – [in] The socket to query
processor_count – [inout] As 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 toprocessor_handles. On return,processor_countwill contain the number of processor handles written toprocessor_handles, or the number of processor handles that could have been written if enough memory had been provided. Ifprocessor_handlesis NULL, as output,processor_countwill contain how many processors are available to read for the socket.processor_handles – [inout] A 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_status_t amdsmi_get_nic_device_bdf(amdsmi_processor_handle processor_handle, amdsmi_bdf_t *bdf)#
Returns BDF of the given NIC device.
@platform{gpu_bm_linux} @platform{host}
- Parameters:
processor_handle – [in] Device which to query
bdf – [out] Reference to BDF. Must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
Software Version Information#
-
amdsmi_status_t amdsmi_get_lib_version(amdsmi_version_t *version)#
Get the build version information for the currently running build of AMDSMI.
@platform{gpu_bm_linux} @platform{cpu_bm} @platform{guest_1vf} @platform{guest_mvf} @platform{guest_windows}
Get the major, minor, patch and build string for AMDSMI build currently in use through
version- Parameters:
version – [inout] A pointer to an amdsmi_version_t structure that will be updated with the version information upon return.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
Error Queries#
-
amdsmi_status_t amdsmi_status_code_to_string(amdsmi_status_t status, const char **status_string)#
Get a description of a provided AMDSMI error status.
@platform{gpu_bm_linux} @platform{host} @platform{cpu_bm} @platform{guest_1vf} @platform{guest_mvf} @platform{guest_windows}
Set the provided pointer to a const char *,
status_string, to a string containing a description of the provided error codestatus.- Parameters:
status – [in] The error status for which a description is desired
status_string – [inout] A pointer to a const char * which will be made to point to a description of the provided error code
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
ASIC & Board Static Information#
-
amdsmi_status_t amdsmi_get_gpu_asic_info(amdsmi_processor_handle processor_handle, amdsmi_asic_info_t *info)#
Returns the ASIC information for the device.
@platform{gpu_bm_linux} @platform{host} @platform{guest_1vf} @platform{guest_mvf} @platform{guest_windows}
This function returns ASIC information such as the product name, the vendor ID, the subvendor ID, the device ID, the revision ID and the serial number.
Note
The processor_handle that contains amdsmi_asic_info_t member oam_id = 0 corresponds to the socket that contains baseboard information.
- Parameters:
processor_handle – [in] Device which to query
info – [out] Reference to static asic information structure. Must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_power_cap_info(amdsmi_processor_handle processor_handle, uint32_t sensor_ind, amdsmi_power_cap_info_t *info)#
Returns the power caps as currently configured in the system.
@platform{gpu_bm_linux} @platform{host} @platform{guest_windows}
- Parameters:
processor_handle – [in] Device which to query
sensor_ind – [in] A 0-based sensor index. Normally, this will be 0. If a device has more than one sensor, it could be greater than 0. Parameter
sensor_indis unused on @platform{host}.info – [out] Reference to power caps information structure. Must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_pcie_info(amdsmi_processor_handle processor_handle, amdsmi_pcie_info_t *info)#
Returns the PCIe info for the GPU.
@platform{gpu_bm_linux} @platform{host} @platform{guest_1vf} @platform{guest_windows}
- Parameters:
processor_handle – [in] Device which to query
info – [out] Reference to the PCIe information returned by the library. Must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_gpu_pci_bandwidth(amdsmi_processor_handle processor_handle, amdsmi_pcie_bandwidth_t *bandwidth)#
Get the list of possible PCIe bandwidths that are available. It is not supported on virtual machine guest.
@platform{gpu_bm_linux} @platform{host}
Given a processor handle
processor_handleand a pointer to a to an amdsmi_pcie_bandwidth_t structurebandwidth, this function will fill inbandwidthwith the possible T/s values and associated number of lanes, and indication of the current selection.- Parameters:
processor_handle – [in] a processor handle
bandwidth – [inout] a pointer to a caller provided amdsmi_pcie_bandwidth_t structure to which the frequency information will be written
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_gpu_vram_info(amdsmi_processor_handle processor_handle, amdsmi_vram_info_t *info)#
Returns vram info.
@platform{gpu_bm_linux} @platform{host} @platform{guest_1vf} @platform{guest_mvf}
- Parameters:
processor_handle – [in] PF of a processor for which to query
info – [out] Reference to vram info structure Must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_gpu_board_info(amdsmi_processor_handle processor_handle, amdsmi_board_info_t *info)#
Returns the board part number and board information for the requested device.
@platform{gpu_bm_linux} @platform{host} @platform{guest_1vf} @platform{guest_mvf}
- Parameters:
processor_handle – [in] Device which to query
info – [out] Reference to board info structure. Must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_fb_layout(amdsmi_processor_handle processor_handle, amdsmi_pf_fb_info_t *info)#
Returns the framebuffer info for the ASIC.
@platform{host}
- Parameters:
processor_handle – [in] PF of a processor for which to query
info – [out] Reference to framebuffer info. Must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
Firmware & VBIOS queries#
-
amdsmi_status_t amdsmi_get_fw_info(amdsmi_processor_handle processor_handle, amdsmi_fw_info_t *info)#
Returns the firmware versions running on the device.
@platform{gpu_bm_linux} @platform{host} @platform{guest_1vf} @platform{guest_mvf} @platform{guest_windows}
- Parameters:
processor_handle – [in] Device which to query
info – [out] Reference to the fw info. Must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_gpu_vbios_info(amdsmi_processor_handle processor_handle, amdsmi_vbios_info_t *info)#
Returns the static information for the vBIOS on the device.
@platform{gpu_bm_linux} @platform{host} @platform{guest_1vf} @platform{guest_mvf} @platform{guest_windows}
- Parameters:
processor_handle – [in] Device which to query
info – [out] Reference to static vBIOS information. Must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_fw_error_records(amdsmi_processor_handle processor_handle, amdsmi_fw_error_record_t *records)#
Gets firmware error records.
@platform{host}
- Parameters:
processor_handle – [in] PF of a processor for which to query
records – [out] reference to the error records structure. Must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_dfc_fw_table(amdsmi_processor_handle processor_handle, amdsmi_dfc_fw_t *info)#
Returns the DFC fw table.
@platform{host}
- Parameters:
processor_handle – [in] PF of a processor for which to query
info – [out] Reference to the dfc fw info. Must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
GPU Monitoring#
-
amdsmi_status_t amdsmi_get_gpu_activity(amdsmi_processor_handle processor_handle, amdsmi_engine_usage_t *info)#
Returns the current usage of the GPU engines (GFX, MM and MEM). Each usage is reported as a percentage from 0-100%.
@platform{gpu_bm_linux} @platform{host} @platform{guest_windows}
- Parameters:
processor_handle – [in] Device which to query
info – [out] Reference to the gpu engine usage structure. Must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_power_info(amdsmi_processor_handle processor_handle, amdsmi_power_info_t *info)#
Returns the current power and voltage of the GPU.
@platform{gpu_bm_linux} @platform{host} @platform{guest_windows}
Note
amdsmi_power_info_t::socket_power metric can rarely spike above the socket power limit in some cases
Note
unsupported struct members are set to UINT32_MAX
- Parameters:
processor_handle – [in] PF of a processor for which to query
info – [out] Reference to the gpu power structure. Must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_is_gpu_power_management_enabled(amdsmi_processor_handle processor_handle, bool *enabled)#
Returns is power management enabled.
@platform{gpu_bm_linux} @platform{host}
- Parameters:
processor_handle – [in] PF of a processor for which to query
enabled – [out] Reference to bool. Must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_clock_info(amdsmi_processor_handle processor_handle, amdsmi_clk_type_t clk_type, amdsmi_clk_info_t *info)#
Returns the measurements of the clocks in the GPU for the GFX and multimedia engines and Memory. This call reports the averages over 1s in MHz. It is not supported on virtual machine guest.
@platform{gpu_bm_linux} @platform{host} @platform{guest_windows}
- Parameters:
processor_handle – [in] Device which to query
clk_type – [in] Enum representing the clock type to query.
info – [out] Reference to the gpu clock structure. Must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_temp_metric(amdsmi_processor_handle processor_handle, amdsmi_temperature_type_t sensor_type, amdsmi_temperature_metric_t metric, int64_t *temperature)#
Get the temperature metric value for the specified metric, from the specified temperature sensor on the specified device. It is not supported on virtual machine guest.
@platform{gpu_bm_linux} @platform{host} @platform{guest_windows}
Given a processor handle
processor_handle, a sensor typesensor_type, a amdsmi_temperature_metric_tmetricand a pointer to an int64_ttemperature, this function will write the value of the metric indicated bymetricandsensor_typeto the memory locationtemperature.- Parameters:
processor_handle – [in] a processor handle
sensor_type – [in] part of device from which temperature should be obtained. This should come from the enum amdsmi_temperature_type_t
metric – [in] enum indicated which temperature value should be retrieved
temperature – [inout] a pointer to int64_t to which the temperature is in Celsius. If this parameter is nullptr, this function will return AMDSMI_STATUS_INVAL if the function is supported with the provided, arguments and AMDSMI_STATUS_NOT_SUPPORTED if it is not supported with the provided arguments.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_gpu_metrics(amdsmi_processor_handle processor_handle, uint32_t *metrics_size, amdsmi_metric_t *metrics)#
Return metrics information.
@platform{host}
Note
System baseboard data can be retrieved from the processor_handle whose amdsmi_asic_info_t member oam_id = 0.
- Parameters:
processor_handle – [in] PF of a processor for which to query
metrics_size – [inout] As input, the size of the provided buffer. As output, number of metrics in the buffer. Parameter must be allocated by user.
metrics – [out] Reference to list of metrics returned by the library. Buffer must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
Partitioning Functions#
-
amdsmi_status_t amdsmi_get_gpu_memory_partition_config(amdsmi_processor_handle processor_handle, amdsmi_memory_partition_config_t *config)#
Returns current gpu memory partition capabilities.
@platform{gpu_bm_linux} @platform{host} @platform{guest_1vf} @platform{guest_mvf}
- Parameters:
processor_handle – [in] a processor handle
config – [out] reference to the memory partition config. Must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_set_gpu_memory_partition_mode(amdsmi_processor_handle processor_handle, amdsmi_memory_partition_type_t mode)#
Sets memory partition mode Set memory partition setting based on memory_partition mode from amdsmi_get_gpu_memory_partition_config.
@platform{gpu_bm_linux} @platform{host}
Given a processor handle
processor_handleand a type of memory partitionmode, this function will attempt to update the selected device’s memory partition setting. This function does not allow any concurrent operations. Device must be idle and have no workloads when performing set partition operations.On @platform{gpu_bm_linux} AMDGPU driver restart is REQUIRED to complete updating to the new memory partition setting. Refer to
amdsmi_gpu_driver_reload()for more details.- Parameters:
processor_handle – [in] A processor handle
mode – [in] Enum representing memory partitioning mode to set
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
Accelerator Partitioning Functions#
-
amdsmi_status_t amdsmi_get_gpu_accelerator_partition_profile_config(amdsmi_processor_handle processor_handle, amdsmi_accelerator_partition_profile_config_t *profile_config)#
Returns gpu accelerator partition caps as currently configured in the system.
@platform{gpu_bm_linux} @platform{host} @platform{guest_1vf} @platform{guest_mvf}
Note
API requires admin/sudo privileges or API will not be able to read all resources for @platform{gpu_bm_linux} or any resources for @platform{host}.
- Parameters:
processor_handle – [in] Device which to query
profile_config – [out] reference to the accelerator partition config. Must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_gpu_accelerator_partition_profile(amdsmi_processor_handle processor_handle, amdsmi_accelerator_partition_profile_t *profile, uint32_t *partition_id)#
Returns current gpu accelerator partition cap.
@platform{gpu_bm_linux} @platform{host} @platform{guest_1vf} @platform{guest_mvf}
Note
API requires admin/sudo privileges or API will not be able to read all resources for @platform{gpu_bm_linux} or any resources for @platform{host}.
- Parameters:
processor_handle – [in] Device which to query
profile – [out] reference to the accelerator partition profile. Must be allocated by user.
partition_id – [inout] array of ids for current accelerator profile. Must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_set_gpu_accelerator_partition_profile(amdsmi_processor_handle processor_handle, uint32_t profile_index)#
Set accelerator partition setting based on profile_index from amdsmi_get_gpu_accelerator_partition_profile_config.
@platform{gpu_bm_linux} @platform{host}
Note
API requires admin/sudo privileges or API will not be able to read all resources for @platform{gpu_bm_linux} or any resources for @platform{host}.
- Parameters:
processor_handle – [in] Device which to query
profile_index – [in] Represents index of a partition user wants to set
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_gpu_accelerator_partition_profile_config_global(amdsmi_processor_handle processor_handle, amdsmi_accelerator_partition_profile_config_global_t *config)#
Returns all GPU accelerator partition capabilities which can be configured on the system.
@platform{host}
This function retrieves the global accelerator partition profile configuration for the specified processor. The returned structure contains all possible partition profiles and their associated capabilities, including the supported VF modes for each profile. The VF modes are represented as a bitmask in the
vf_modefield of each profile (see amdsmi_accelerator_partition_profile_global_t). To determine if specific VF mode is supported for a given profile, use the amdsmi_vf_mode_t enumeration as bitmask flags. For example, to check if 4 VF mode is supported, test if (vf_mode & AMDSMI_VF_MODE_4_SUPPORT) is non-zero. The bitmask can be used to extract support for 1, 2, 4, or 8 VF modes using the corresponding enum values.- Parameters:
processor_handle – [in] PF of a processor for which to query.
config – [out] Reference to the global accelerator partition config Must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
Hardware Topology Functions#
-
amdsmi_status_t amdsmi_get_link_metrics(amdsmi_processor_handle processor_handle, amdsmi_link_metrics_t *link_metrics)#
Return link metric information.
@platform{gpu_bm_linux} @platform{host}
- Parameters:
processor_handle – [in] PF of a processor for which to query
link_metrics – [out] reference to the link metrics struct. Must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_link_topology_nearest(amdsmi_processor_handle processor_handle, amdsmi_link_type_t link_type, amdsmi_topology_nearest_t *topology_nearest_info)#
Retrieve the set of GPUs that are nearest to a given device at a specific interconnectivity level.
@platform{gpu_bm_linux} @platform{host}
Once called topology_nearest_info will get populated with a list of all nearest devices for a given link_type. The list has a count of the number of devices found and their respective handles/identifiers.
- Parameters:
processor_handle – [in] The identifier of the given device.
link_type – [in] The amdsmi_link_type_t level to search for nearest GPUs. Only AMDSMI_LINK_TYPE_INTERNAL, AMDSMI_LINK_TYPE_PCIE and AMDSMI_LINK_TYPE_XGMI are supported; any other value returns AMDSMI_STATUS_INVAL.
topology_nearest_info – [inout] .count;
When zero, set to the number of matching GPUs such that .device_list can be malloc’d.
When non-zero, .device_list will be filled with count number of processor_handle. .device_list An array of processor_handle for GPUs found at level.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail.
-
amdsmi_status_t amdsmi_topo_get_p2p_status(amdsmi_processor_handle processor_handle_src, amdsmi_processor_handle processor_handle_dst, amdsmi_link_type_t *type, amdsmi_p2p_capability_t *cap)#
Retrieve connection type and P2P capabilities between 2 GPUs.
@platform{gpu_bm_linux} @platform{host} @platform{guest_1vf} @platform{guest_mvf}
Given a source processor handle
processor_handle_srcand a destination processor handleprocessor_handle_dst, a pointer to an amdsmi_link_type_ttype, and a pointer to amdsmi_p2p_capability_tcap. This function will write the connection type, and io link capabilities between the deviceprocessor_handle_srcandprocessor_handle_dstto the memory pointed to bycapandtype.- Parameters:
processor_handle_src – [in] the source processor handle
processor_handle_dst – [in] the destination processor handle
type – [inout] A pointer to an amdsmi_link_type_t to which the type for the connection should be written.
cap – [inout] A pointer to an amdsmi_p2p_capability_t to which the io link capabilities should be written.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_topo_get_numa_node_number(amdsmi_processor_handle processor_handle, uint32_t *numa_node)#
Retrieve the NUMA CPU node number for a device.
@platform{gpu_bm_linux} @platform{host}
Given a processor handle
processor_handle, and a pointer to an uint32_tnuma_node, this function will write the node number of NUMA CPU for the deviceprocessor_handleto the memory pointed to bynuma_node.- Parameters:
processor_handle – [in] a processor handle
numa_node – [inout] A pointer to an uint32_t to which the numa node number should be written.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_topo_get_link_type(amdsmi_processor_handle processor_handle_src, amdsmi_processor_handle processor_handle_dst, uint64_t *hops, amdsmi_link_type_t *type)#
Retrieve the hops and the connection type between 2 processors.
@platform{gpu_bm_linux} @platform{host}
Given a source processor handle
processor_handle_srcand a destination processor handleprocessor_handle_dst, this function writes the connection type totype. Ifhopsis non-NULL, the number of hops for the connection is also written.For GPU-to-GPU queries,
typereturns one of INTERNAL, PCIE, XGMI, NOT_APPLICABLE, or UNKNOWN, andhopsreturns the hop count.For queries involving a NIC processor (NIC-to-GPU or NIC-to-NIC),
typereturns one of PCIE (same PCIe switch), NUMA (same NUMA node, different PCIe switch), XNUMA (different NUMA nodes), or UNKNOWN. Thehopsparameter is not meaningful for NIC queries; callers should pass NULL. If non-NULL,hopsis set to UINT64_MAX.See also
Note
This is a lightweight query that returns only the link type and hop count, and is available on both @platform{gpu_bm_linux} and @platform{host} for GPU-to-GPU, NIC-to-GPU and NIC-to-NIC pairs. On @platform{host}, amdsmi_get_link_topology returns a richer GPU-to-GPU-only description (link weight, HW link status and framebuffer sharing flag in addition to link type and hop count).
- Parameters:
processor_handle_src – [in] the source processor handle
processor_handle_dst – [in] the destination processor handle
hops – [inout] A pointer to uint64_t to receive the hop count, or NULL if hop count is not needed.
type – [inout] A pointer to an amdsmi_link_type_t to receive the link type. Must not be NULL.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_link_topology(amdsmi_processor_handle processor_handle_src, amdsmi_processor_handle processor_handle_dst, amdsmi_link_topology_t *topology_info)#
Return link topology information between two connected processors.
@platform{host}
Returns the full GPU-to-GPU link description (weight, HW link status, link type, hop count, framebuffer sharing flag) between the two given processors. For a lightweight query that only retrieves the link type and hop count, and that is also available on @platform{gpu_bm_linux} and supports NIC-to-GPU and NIC-to-NIC pairs, see amdsmi_topo_get_link_type.
See also
- Parameters:
processor_handle_src – [in] Source PF of a processor for which to query
processor_handle_dst – [in] Destination PF of a processor for which to query
topology_info – [out] reference to the link topology struct. Must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_xgmi_fb_sharing_caps(amdsmi_processor_handle processor_handle, amdsmi_xgmi_fb_sharing_caps_t *caps)#
Return XGMI capabilities.
@platform{host}
- Parameters:
processor_handle – [in] PF of a processor for which to query
caps – [out] reference to the xgmi caps union. Must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_xgmi_fb_sharing_mode_info(amdsmi_processor_handle processor_handle_src, amdsmi_processor_handle processor_handle_dst, amdsmi_xgmi_fb_sharing_mode_t mode, uint8_t *fb_sharing)#
Return XGMI framebuffer sharing information between two GPUs.
@platform{host}
- Parameters:
processor_handle_src – [in] Source PF of a processor for which to query
processor_handle_dst – [in] Destination PF of a processor for which to query
mode – [in] Enum representing the framebuffer sharing mode to query
fb_sharing – [out] Indicates framebuffer sharing between two processors. Must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_set_xgmi_fb_sharing_mode(amdsmi_processor_handle processor_handle, amdsmi_xgmi_fb_sharing_mode_t mode)#
Set XGMI framebuffer sharing mode.
@platform{host}
- Parameters:
processor_handle – [in] PF of a processor for which to query
mode – [in] Enum representing the framebuffer sharing mode to set
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_set_xgmi_fb_sharing_mode_v2(amdsmi_processor_handle *processor_list, uint32_t num_processors, amdsmi_xgmi_fb_sharing_mode_t mode)#
Set XGMI framebuffer custom sharing mode.
@platform{host}
Note
This API will only work if there’s no guest VM running.
- Parameters:
processor_list – [in] The list of processors
num_processors – [in] The number of processors in the list
mode – [in] Enum representing the framebuffer sharing mode to set
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
Clock, Power and Performance Control#
-
amdsmi_status_t amdsmi_get_soc_pstate(amdsmi_processor_handle processor_handle, amdsmi_dpm_policy_t *policy)#
Get the soc pstate policy for the processor.
@platform{gpu_bm_linux} @platform{guest_1vf} @platform{host}
Given a processor handle
processor_handle, this function will write current soc pstate policy settings topolicy. All the processors at the same socket will have the same policy.- Parameters:
processor_handle – [in] a processor handle
policy – [inout] the soc pstate policy for this processor. 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_status_t amdsmi_set_soc_pstate(amdsmi_processor_handle processor_handle, uint32_t policy_id)#
Set the soc pstate policy for the processor.
@platform{gpu_bm_linux} @platform{guest_1vf} @platform{host}
Given a processor handle
processor_handleand a soc pstate policypolicy_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 admin/sudo privileges on @platform{gpu_bm_linux}
- Parameters:
processor_handle – [in] a processor handle
policy_id – [in] 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_soc_pstate()
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_xgmi_plpd(amdsmi_processor_handle processor_handle, amdsmi_dpm_policy_t *xgmi_plpd)#
Get the xgmi per-link power down policy parameter for the processor.
@platform{gpu_bm_linux} @platform{guest_1vf} @platform{host}
Given a processor handle
processor_handle, this function will write current xgmi plpd settings toxgmi_plpd. All the processors at the same socket will have the same policy.- Parameters:
processor_handle – [in] a processor handle
xgmi_plpd – [inout] the xgmi plpd for this processor. 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_status_t amdsmi_set_xgmi_plpd(amdsmi_processor_handle processor_handle, uint32_t policy_id)#
Set the xgmi per-link power down policy parameter for the processor.
@platform{gpu_bm_linux} @platform{guest_1vf} @platform{host}
Given a processor handle
processor_handleand a dpm policypolicy_id, this function will set the xgmi plpd for this processor. All the processors at the same socket will be set to the same policy.Note
This function requires admin/sudo privileges
- Parameters:
processor_handle – [in] a processor handle
policy_id – [in] the xgmi plpd id to set. The id is the id in amdsmi_dpm_policy_entry_t, which can be obtained by calling amdsmi_get_xgmi_plpd()
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
Power Control#
-
amdsmi_status_t amdsmi_set_power_cap(amdsmi_processor_handle processor_handle, uint32_t sensor_ind, uint64_t cap)#
Set the maximum gpu power cap value. It is not supported on virtual machine guest.
@platform{host} @platform{gpu_bm_linux} @platform{guest_1vf} @platform{guest_windows}
Set the power cap to the provided value
cap.capmust be between the minimum and maximum power cap values set by the system, which can be obtained from ::amdsmi_dev_power_cap_range_get.- Parameters:
processor_handle – [in] A processor handle
sensor_ind – [in] a 0-based sensor index. Normally, this will be 0. If a processor has more than one sensor, it could be greater than 0. Parameter
sensor_indis unused on @platform{gpu_bm_linux}.cap – [in] a uint64_t that indicates the desired power cap.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_supported_power_cap(amdsmi_processor_handle processor_handle, uint32_t *sensor_count, uint32_t *sensor_inds, amdsmi_power_cap_type_t *sensor_types)#
Query the supported power cap sensors and their types for a device.
@platform{gpu_bm_linux} @platform{host}
This function returns the list of supported power cap sensors for the given device, including their sensor indices and types (e.g., PPT0, PPT1).
- Parameters:
processor_handle – [in] A processor handle.
sensor_count – [out] Pointer to a uint32_t that will be set to the number of supported sensors.
sensor_inds – [out] Pointer to an array of uint32_t to be filled with sensor indices. The array must be allocated by the caller with enough space.
sensor_types – [out] Pointer to an array of amdsmi_power_cap_type_t to be filled with sensor types. The array must be allocated by the caller with enough space.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail.
Physical State Queries#
-
amdsmi_status_t amdsmi_get_gpu_cache_info(amdsmi_processor_handle processor_handle, amdsmi_gpu_cache_info_t *info)#
Returns gpu cache info.
@platform{gpu_bm_linux} @platform{host}
- Parameters:
processor_handle – [in] PF of a processor for which to query
info – [out] reference to the cache info struct. Must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
ECC Information#
-
amdsmi_status_t amdsmi_get_gpu_ecc_count(amdsmi_processor_handle processor_handle, amdsmi_gpu_block_t block, amdsmi_error_count_t *ec)#
Retrieve the error counts for a GPU block. It is not supported on virtual machine guest.
@platform{gpu_bm_linux} @platform{host}
Given a processor handle
processor_handle, an amdsmi_gpu_block_tblockand a pointer to an amdsmi_error_count_tec, this function will write the error count values for the GPU block indicated byblockto memory pointed to byec.- Parameters:
processor_handle – [in] a processor handle
block – [in] The block for which error counts should be retrieved
ec – [inout] A pointer to an amdsmi_error_count_t to which the error counts should be written If this parameter is nullptr, this function will return AMDSMI_STATUS_INVAL if the function is supported with the provided arguments and AMDSMI_STATUS_NOT_SUPPORTED if it is not supported with the provided arguments.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_gpu_ecc_enabled(amdsmi_processor_handle processor_handle, uint64_t *enabled_blocks)#
Retrieve the enabled ECC bit-mask. It is not supported on virtual machine guest.
@platform{gpu_bm_linux} @platform{host}
Given a processor handle
processor_handle, and a pointer to a uint64_tenabled_mask, this function will write bits to memory pointed to byenabled_blocks. Upon a successful call,enabled_blockscan then be AND’d with amdsmi_gpu_block_t values to determine if the corresponding block has ECC enabled. Note that whether a block has ECC enabled or not in the device is independent of whether there is kernel support for error counting for that block. Although a block may be enabled, but there may not be kernel support for reading error counters for that block.- Parameters:
processor_handle – [in] a processor handle
enabled_blocks – [inout] A pointer to a uint64_t to which the enabled blocks bits will be written. If this parameter is nullptr, this function will return AMDSMI_STATUS_INVAL if the function is supported with the provided arguments and AMDSMI_STATUS_NOT_SUPPORTED if it is not supported with the provided arguments.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_gpu_total_ecc_count(amdsmi_processor_handle processor_handle, amdsmi_error_count_t *ec)#
Returns the total number of ECC errors (correctable, uncorrectable and deferred) in the given GPU. It is not supported on virtual machine guest.
@platform{gpu_bm_linux} @platform{host} @platform{guest_windows}
- Parameters:
processor_handle – [in] Device which to query
ec – [out] Reference to ecc error count structure. Must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
RAS information#
-
amdsmi_status_t amdsmi_get_gpu_cper_entries(amdsmi_processor_handle processor_handle, uint32_t severity_mask, char *cper_data, uint64_t *buf_size, amdsmi_cper_hdr_t **cper_hdrs, uint64_t *entry_count, uint64_t *cursor)#
Retrieve CPER entries cached in the driver.
@platform{gpu_bm_linux} @platform{host} @platform{guest_1vf}
The user will pass buffers to hold the CPER data and CPER headers. The library will fill the buffer based on the severity_mask user passed. It will also parse the CPER header and stored in the cper_hdrs array. The user can use the cper_hdrs to get the timestamp and other header information. A cursor is also returned to the user, which can be used to get the next set of CPER entries.
If there are more data than any of the buffers user pass, the library will return AMDSMI_STATUS_MORE_DATA. User can call the API again with the cursor returned at previous call to get more data. If the buffer size is too small to even hold one entry, the library will return AMDSMI_STATUS_OUT_OF_RESOURCES.
Even if the API returns AMDSMI_STATUS_MORE_DATA, the 2nd call may still get the entry_count == 0 as the driver cache may not contain the severity user is interested in. The API should return AMDSMI_STATUS_SUCCESS in this case so that user can ignore that call.
- Parameters:
processor_handle – [in] Handle to the processor for which CPER entries are to be retrieved.
severity_mask – [in] The severity mask of the entries to be retrieved.
cper_data – [inout] Pointer to a buffer where the CPER data will be stored. User must allocate the buffer and set the buf_size correctly.
buf_size – [inout] Pointer to a variable that specifies the size of the cper_data. On return, it will contain the actual size of the data written to the cper_data.
cper_hdrs – [inout] Array of the parsed headers of the cper_data. The user must allocate the array of pointers to cper_hdr. The library will fill the array with the pointers to the parsed headers. The underlying data is in the cper_data buffer and only pointer is stored in this array.
entry_count – [inout] Pointer to a variable that specifies the array length of the cper_hdrs user allocated. On return, it will contain the actual entries written to the cper_hdrs.
cursor – [inout] Pointer to a variable that will contain the cursor for the next call.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_afids_from_cper(char *cper_buffer, uint32_t buf_size, uint64_t *afids, uint32_t *num_afids)#
Get the AFIDs from CPER buffer.
@platform{gpu_bm_linux} @platform{host} @platform{guest_1vf} @platform{guest_mvf}
A utility function which retrieves the AFIDs from the CPER record.
- Parameters:
cper_buffer – [in] a pointer to the buffer with one CPER record. The caller must make sure the whole CPER record is loaded into the buffer.
buf_size – [in] is the size of the cper_buffer.
afids – [out] a pointer to an array of uint64_t to which the AF IDs will be written
num_afids – [inout] As input, the value passed through this parameter is the number of uint64_t that may be safely written to the memory pointed to by
afids. This is the limit on how many AF IDs will be written toafids. On return,num_afidswill contain the number of AF IDs written toafids, or the number of AF IDs that could have been written if enough memory had been provided. It is suggest to pass AMDSMI_MAX_NUMBER_OF_AFIDS_PER_RECORD for all AF Ids.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_gpu_ras_feature_info(amdsmi_processor_handle processor_handle, amdsmi_ras_feature_t *ras_feature)#
Returns RAS features info.
@platform{gpu_bm_linux} @platform{host} @platform{guest_windows}
- Parameters:
processor_handle – [in] Device handle which to query
ras_feature – [out] RAS features that are currently enabled and supported on the processor. Must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_gpu_bad_page_info(amdsmi_processor_handle processor_handle, uint32_t *bad_page_size, amdsmi_eeprom_table_record_t *bad_pages)#
Returns the bad page info.
@platform{host}
- Parameters:
processor_handle – [in] PF of a processor to query.
bad_page_size – [inout] On input, length of the
bad_pagesarray allocated by the caller. On output, the number of bad page records written by the library.bad_pages – [out] Reference to the eeprom table record structure. Must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_gpu_ras_policy_info(amdsmi_processor_handle processor_handle, amdsmi_gpu_ras_policy_info_t *info)#
Get the RAS policy info for a device.
@platform{host}
Given a processor handle
processor_handle, this function will retrieve the RAS policy information for the device.- Parameters:
processor_handle – [in] PF of a processor for which to query
info – [out] RAS policy info for the device. Must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_bad_page_threshold(amdsmi_processor_handle processor_handle, uint32_t *threshold)#
Get the bad page threshold for a device.
@platform{host}
Given a processor handle
processor_handleand a pointer to a uint32_tthreshold, this function will retrieve the bad page threshold value associated with deviceprocessor_handleand store the value at location pointed to bythreshold.- Parameters:
processor_handle – [in] a processor handle
threshold – [inout] pointer to location where bad page threshold value will be written. If this parameter is nullptr, this function will return AMDSMI_STATUS_INVAL if the function is supported with the provided, arguments and AMDSMI_STATUS_NOT_SUPPORTED if it is not supported with the provided arguments.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_fabric_cper_entries(amdsmi_processor_handle processor_handle, uint32_t severity_mask, char *cper_data, uint64_t *buf_size, amdsmi_cper_hdr_t **cper_hdrs, uint64_t *entry_count, uint64_t *cursor)#
Retrieve CPER entries for UALoE fabric events.
@platform{gpu_bm_linux} @platform{host}
Returns CPER-formatted error records for UALoE netport link events. Uses the same CPER format and calling conventions as amdsmi_get_gpu_cper_entries() so callers can handle both GPU and fabric CPERs with identical code paths.
- Parameters:
processor_handle – [in] GPU processor handle.
severity_mask – [in] The severity mask of the entries to be retrieved.
cper_data – [inout] Caller-allocated buffer for raw CPER data. Records are packed back-to-back.
buf_size – [inout] [in] size of cper_data buffer in bytes. [out] actual bytes written.
cper_hdrs – [inout] Array of pointers into cper_data, one per returned entry. Caller allocates the array.
entry_count – [out] Number of CPER entries returned.
cursor – [inout] [in] cursor from previous call (0 = start). [out] cursor for next call.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, AMDSMI_STATUS_MORE_DATA if entries returned but more remain, non-zero on fail
Clock, Power and Performance Queries#
-
amdsmi_status_t amdsmi_reset_gpu(amdsmi_processor_handle processor_handle)#
Triggers a chain that resets all GPUs. It is not supported on virtual machine guest.
@platform{gpu_bm_linux} @platform{host}
Given a processor handle
processor_handle, this function will reset the GPUNote
After this function returns, the caller must wait a few seconds before calling any other AMD SMI API functions to allow the GPU reset to complete. Calling other APIs too soon may result in AMDSMI_STATUS_BUSY or undefined behavior.
- Parameters:
processor_handle – [in] a processor handle
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
Node Information#
-
amdsmi_status_t amdsmi_get_npm_info(amdsmi_node_handle node_handle, amdsmi_npm_info_t *info)#
Retrieves node power management (NPM) status and power limit for the specified node.
@platform{gpu_bm_linux} @platform{host}
This function queries the NPM controller for the given node and returns whether NPM is enabled, along with the current node-level power limit in Watts. The NPM status and limit are set out-of-band and reported via this API.
- Parameters:
node_handle – [in] Handle to the Node to query.
info – [out] Pointer to amdsmi_npm_info_t structure to receive NPM status and limit. Must be allocated by the user.
- Returns:
AMDSMI_STATUS_SUCCESS on success, non-zero on failure.
-
amdsmi_status_t amdsmi_get_tray_info(amdsmi_node_handle node_handle, amdsmi_tray_info_t *info)#
Returns the compute tray configuration for the given node.
@platform{gpu_bm_linux} @platform{host}
Returns tray-level platform configuration sourced from the UALoE interface. Tray configuration is node-wide; the first GPU with an active UALoE handle is used.
Note
node_handleis reserved for future use and must be passed as NULL.- Parameters:
node_handle – [in] Reserved, must be NULL.
info – [out] Reference to tray information structure. Must be allocated by the caller.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
PTL (Peak Tops Limiter) control and formats#
-
amdsmi_status_t amdsmi_get_gpu_ptl_state(amdsmi_processor_handle processor_handle, bool *enabled)#
Get PTL enable/disable state.
@platform{gpu_bm_linux} @platform{host}
This function retrieves whether PTL (Peak Tops Limiter) is currently enabled or disabled for the specified processor. This is a simple state query that returns the current PTL operational state without detailed configuration.
- Parameters:
processor_handle – [in] Device which to query
enabled – [out] Pointer to boolean that will be set to true if PTL is enabled, false if PTL is disabled
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, AMDSMI_STATUS_NOT_SUPPORTED if PTL is not supported on this device, non-zero on other failures
-
amdsmi_status_t amdsmi_set_gpu_ptl_state(amdsmi_processor_handle processor_handle, bool enable)#
Set PTL enable/disable state.
@platform{gpu_bm_linux} @platform{host}
This function enables or disables PTL (Peak Tops Limiter) operation. Use amdsmi_set_gpu_ptl_enable_with_formats() for more control over the preferred data formats when enabling.
- Parameters:
processor_handle – [in] Device to configure
enable – [in] Boolean flag: true to enable PTL with default formats, false to disable PTL
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_gpu_ptl_formats(amdsmi_processor_handle processor_handle, amdsmi_ptl_data_format_t *data_format1, amdsmi_ptl_data_format_t *data_format2)#
Get PTL (Peak Tops Limiter) formats for the processor.
@platform{gpu_bm_linux} @platform{host}
This function retrieves the current PTL formats for the specified processor. PTL prevents the product to never deliver more than a specified TOPS/second. If function returns 0 for both formats, PTL was never enabled before on that system
- Parameters:
processor_handle – [in] Device which to query
data_format1 – [out] Pointer to first preferred data format that receives peak performance
data_format2 – [out] Pointer to second preferred data format that receives peak performance
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, AMDSMI_STATUS_NOT_SUPPORTED if PTL is not supported on this device, non-zero on other failures
-
amdsmi_status_t amdsmi_set_gpu_ptl_formats(amdsmi_processor_handle processor_handle, amdsmi_ptl_data_format_t data_format1, amdsmi_ptl_data_format_t data_format2)#
Set PTL with specified preferred data formats.
@platform{gpu_bm_linux} @platform{host}
This function sets PTL with the specified preferred data format pair. PTL must be enabled first before calling this function using amdsmi_set_gpu_ptl_state. The two specified formats will receive accurate performance monitoring and peak performance. F8 and XF32 formats always receive peak performance regardless of this setting.
- Parameters:
processor_handle – [in] Device to configure
data_format1 – [in] First preferred data format (must be from the limited set: I8, F16, BF16, F32, F64, F8, Vector)
data_format2 – [in] Second preferred data format (must be from the limited set: I8, F16, BF16, F32, F64, and different from data_format1)
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, AMDSMI_STATUS_NOT_SUPPORTED if PTL is not supported on this device, non-zero on other failures
Fabric (The Fabric used for scale up networking)#
-
amdsmi_status_t amdsmi_get_gpu_fabric_info(amdsmi_processor_handle processor_handle, amdsmi_fabric_info_t *info)#
Get Fabric device information.
@platform{gpu_bm_linux} @platform{host}
Reads optional UALoE fabric attributes Missing/unreadable attributes are skipped so the call can return partial data
- Parameters:
processor_handle – [in] - Handle for the target processor
info – [out] - Pointer to Fabric information structure to be populated Must be allocated by the caller. Written on every return except errors such as AMDSMI_STATUS_INVAL
- Returns:
AMDSMI_STATUS_SUCCESS if at least one attribute yielded usable content
AMDSMI_STATUS_NO_DATA if no attribute yielded usable data (output still contains BDF and default/sentinel fabric fields)
Other codes (e.g. invalid processor handle) on failure
-
amdsmi_status_t amdsmi_alloc_fabric_telemetry(amdsmi_processor_handle processor_handle, uint32_t category_mask, amdsmi_fabric_telemetry_t **telemetry)#
Allocate storage for Fabric telemetry data.
@platform{gpu_bm_linux} @platform{host}
This function allocates storage for Fabric telemetry data for the specified categories. The allocated storage can be reused for multiple telemetry retrievals.
- Parameters:
processor_handle – [in] - Handle for the target processor
category_mask – [in] - Bitmask of telemetry categories to allocate, constructed using AMDSMI_FABRIC_TELEMETRY_CATEGORY_MASK(cat)
telemetry – [out] - Pointer to allocated telemetry structure
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_fabric_telemetry_data(amdsmi_processor_handle processor_handle, amdsmi_fabric_telemetry_t *telemetry)#
Get Fabric telemetry data.
@platform{gpu_bm_linux} @platform{host}
This function retrieves the latest Fabric telemetry data snapshot into pre-allocated storage.
- Parameters:
processor_handle – [in] - Handle for the target processor
telemetry – [inout] - Pre-allocated telemetry structure to populate
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_free_fabric_telemetry(amdsmi_processor_handle processor_handle, amdsmi_fabric_telemetry_t *telemetry)#
Free Fabric telemetry storage.
@platform{gpu_bm_linux} @platform{host}
This function frees the storage allocated for Fabric telemetry data.
- Parameters:
processor_handle – [in] - Handle for the target processor
telemetry – [in] - Telemetry structure to free
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_set_gpu_fabric_ppod_config(amdsmi_processor_handle processor_handle, const amdsmi_fabric_ppod_config_t *config)#
Apply PPOD setup parameters.
@platform{gpu_bm_linux} @platform{host}
Writes accel_id, ppod_id, ppod_size, local_accels, bandwidth, and latency for each bit set in
config->mask(fixed order). Whenconfig->commitis true, the configuration is finalized and applied to hardware. On bare-metal Linux this triggers a sysfs commit; on host the PSP command applies atomically soconfig->commithas no additional effect- Parameters:
processor_handle – [in] Handle for the target GPU
config – [in] Non-NULL request;
config->maskandconfig->commitmust not both be false
- Returns:
-
amdsmi_status_t amdsmi_set_gpu_fabric_vpod_config(amdsmi_processor_handle processor_handle, const amdsmi_fabric_vpod_config_t *config)#
Apply VPOD configuration.
@platform{gpu_bm_linux} @platform{host}
Writes vpod_id, vpod_size, vpod_active_accels, and addr_mode for each bit set in
config->mask. Whenconfig->commitis true, the configuration is finalized and applied to hardware. On bare-metal Linux this triggers a sysfs commit; on host the PSP command applies atomically soconfig->commithas no additional effect- Parameters:
processor_handle – [in] Handle for the target GPU
config – [in] Non-NULL request
- Returns:
-
amdsmi_status_t amdsmi_set_gpu_fabric_station_config(amdsmi_processor_handle processor_handle, const amdsmi_fabric_station_config_t *config)#
Apply DF reconfiguration.
@platform{gpu_bm_linux} @platform{host}
Writes station_flags, num_stations, and lane_en_bitmap for each bit set in
config->mask. Whenconfig->commitis true, the configuration is finalized and applied to hardware. On bare-metal Linux this triggers a sysfs commit; on host the PSP command applies atomically soconfig->commithas no additional effect- Parameters:
processor_handle – [in] Handle for the target GPU
config – [in] Non-NULL request
- Returns:
VF and FB partitioning queries#
-
amdsmi_status_t amdsmi_get_num_vf(amdsmi_processor_handle processor_handle, uint32_t *num_vf_enabled, uint32_t *num_vf_supported)#
Returns the number of VFs enabled by gpuv in the ASIC.
@platform{host}
- Parameters:
processor_handle – [in] PF of a processor for which to query
num_vf_enabled – [out] Reference to number of VF enabled. Must be allocated by user.
num_vf_supported – [out] Reference to number of VF supported. Must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_vf_partition_info(amdsmi_processor_handle processor_handle, unsigned int vf_buffer_num, amdsmi_partition_info_t *info)#
Returns the current framebuffer partitioning structure as currently configured by the driver.
@platform{host}
- Parameters:
processor_handle – [in] PF of a processor for which to query
vf_buffer_num – [in] Size of the buffer where the library will copy the data in units of VF
info – [out] Reference to structure with the current partitioning information. Must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_partition_profile_info(amdsmi_processor_handle processor_handle, amdsmi_profile_info_t *profile_info)#
Return the list of supported profiles on the given GPU device.
@platform{host}
- Parameters:
processor_handle – [in] PF of a processor for which to query
profile_info – [out] reference to the profile info struct. Must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
VF Configuration#
-
amdsmi_status_t amdsmi_get_vf_info(amdsmi_vf_handle_t vf_handle, amdsmi_vf_info_t *config)#
Returns the configuration structure for a VF.
@platform{host}
- Parameters:
vf_handle – [in] Handle of the VF to query.
config – [out] Reference to structure with the current VF configuration. Must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_vf_data(amdsmi_vf_handle_t vf_handle, amdsmi_vf_data_t *info)#
Returns the data structure for a VF.
@platform{host}
- Parameters:
vf_handle – [in] Handle of the PF or VF to query.
info – [out] Reference to structure with the current VF data. Must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_vf_hbm_info(amdsmi_vf_handle_t vf_handle, amdsmi_vf_hbm_info_t *info)#
Returns the HBM information for a VF.
@platform{host}
- Parameters:
vf_handle – [in] Handle of the VF to query.
info – [out] Reference to the HBM info. Must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
Event Monitoring#
-
amdsmi_status_t amdsmi_event_create(amdsmi_processor_handle *processor_list, uint32_t num_devices, uint64_t event_types, amdsmi_event_set *set)#
Allocate a new event set notifier to monitor different types of issues with the GPU running virtualization SW. This call registers an event set. The user must pass an array with the GPUs it wants to monitor with the selected event flags.
@platform{host}
There are 5 event severities and the appropriate macros to set them: 0b0000 High severity - AMDSMI_MASK_HIGH_ERROR_SEVERITY_ONLY 0b0001 Med severity - AMDSMI_MASK_INCLUDE_MED_ERROR_SEVERITY 0b0010 Low severity - AMDSMI_MASK_INCLUDE_LOW_ERROR_SEVERITY 0b0100 Warn severity - AMDSMI_MASK_INCLUDE_WARN_SEVERITY 0b1000 Info severity - AMDSMI_MASK_INCLUDE_INFO_SEVERITY
AMDSMI_MASK_INCLUDE_CATEGORY macro is used to set the category we want to monitor. Enum AMDSMI_EVENT_CATEGORY is used as the input parameter of the macro.
- Parameters:
processor_list – [in] Processor handles for the GPU to listen for events.
num_devices – [in] Number of processors in the list.
event_types – [in] Bitmask of the different event_types that the event_set will monitor in this GPU. Bit index (from 0): | 63 62 61 60| 59 ………. 0 | | event severity | event category bit field |
set – [out] Reference to the pointer to the event set created by the library. This will be allocated by the library.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_event_read(amdsmi_event_set set, int64_t timeout_usec, amdsmi_event_entry_t *event)#
The call blocks till timeout is expired to copy one event specified by the event set into the user provided notifier storage.
@platform{host}
Note
If timeout_usec is negative, the call will block forever, if timeout_usec is zero, the call returns immediately. Timeout value given in microseconds is converted to milliseconds. Minimal timeout is 1000 us. If provided timeout is lower than 1000 then the timeout will be set to 1000us by default. The timeout value in us will be converted to a smaller integer value in ms. (e.g. 1500us -> 1ms , 2600us -> 2ms)
Note
Provided event entry contains a 64 bit timestamp, fields for the category of the error, the sub-code and flags associated with the error, VF and GPU handles that originated the error and a 256B text buffer with a human-readable description of the error.
- Parameters:
set – [in] Event set to read from. Use the same variable set that was used in the amdsmi_event_create call.
timeout_usec – [in] Timeout in usec to wait for event
event – [out] Reference to the user allocated event notifier.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_event_destroy(amdsmi_event_set set)#
Destroys and frees an event set.
@platform{host}
- Parameters:
set – [in] Event set to destroy.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
Host-Guest Interaction#
-
amdsmi_status_t amdsmi_get_guest_data(amdsmi_vf_handle_t vf_handle, amdsmi_guest_data_t *info)#
Returns guest OS information of the queried VF. The fw_info field from the amdsmi_guest_data structure is deprecated and will be empty. To get the vf fw info, amdsmi_get_vf_fw_info API should be used.
@platform{host}
- Parameters:
vf_handle – [in] Handle of the VF to query.
info – [out] reference to the guest_data structure. Must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_vf_fw_info(amdsmi_vf_handle_t vf_handle, amdsmi_fw_info_t *info)#
Returns the firmware versions running on a VF. In case the VM is not started on the VF, empty list will be returned and num_fw_info will be set to zero.
@platform{host}
- Parameters:
vf_handle – [in] VF handle of a processor for which to query
info – [out] Reference to the fw info. Must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
VF management#
-
amdsmi_status_t amdsmi_clear_vf_fb(amdsmi_vf_handle_t vf_handle)#
Clear the framebuffer of a VF. If trying to clear the framebuffer of an active function, the call will fail with device busy.
@platform{host}
- Parameters:
vf_handle – [in] - Handle to the VF to send the command to.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_set_num_vf(amdsmi_processor_handle processor_handle, uint32_t num_vf)#
Enable a given number of VF.
@platform{host}
- Parameters:
processor_handle – [in] PF of a processor for which to query
num_vf – [in] - Number of VFs to enable.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
Confidential Compute#
-
amdsmi_status_t amdsmi_get_tdi_state(amdsmi_vf_handle_t vf_handle, amdsmi_tdi_state_t *state)#
Gets TDI (TEE(Trusted Execution Environment) Device Interface) state.
@platform{host}
- Parameters:
vf_handle – [in] VF handle for which to query
state – [out] Enum representing TDI state
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_gpu_cc_mode(amdsmi_processor_handle processor_handle, amdsmi_gpu_cc_mode_t *mode)#
Gets CC (Confidential Compute) mode.
@platform{host}
- Parameters:
processor_handle – [in] PF of a processor for which to query
mode – [out] Enum representing confidential compute mode
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_set_gpu_cc_mode(amdsmi_processor_handle processor_handle, amdsmi_gpu_cc_mode_t mode)#
Sets CC (Confidential Compute) mode.
@platform{host}
- Parameters:
processor_handle – [in] PF of a processor for which to query
mode – [in] Enum representing confidential compute mode to set
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
NIC Information#
-
amdsmi_status_t amdsmi_get_nic_driver_info(amdsmi_processor_handle processor_handle, amdsmi_nic_driver_info_t *info)#
Retrieves information about the NIC driver.
@platform{host} @platform{gpu_bm_linux}
- Parameters:
processor_handle – [in] NIC for which to query
info – [out] reference to the nic driver info struct. Must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_nic_fw_info(amdsmi_processor_handle processor_handle, amdsmi_nic_fw_info_t *info)#
Retrieves firmware version information for the NIC.
@platform{host} @platform{gpu_bm_linux}
Note
This API depends on libmnl. If libmnl is not installed on the system, this function returns AMDSMI_STATUS_NOT_SUPPORTED.
- Parameters:
processor_handle – [in] NIC for which to query
info – [out] reference to the nic firmware info struct. Must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_nic_asic_info(amdsmi_processor_handle processor_handle, amdsmi_nic_asic_info_t *info)#
Retrieves ASIC information for the NIC.
@platform{host} @platform{gpu_bm_linux}
- Parameters:
processor_handle – [in] NIC for which to query
info – [out] reference to the nic asic info struct. Must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_nic_bus_info(amdsmi_processor_handle processor_handle, amdsmi_nic_bus_info_t *info)#
Retrieves BUS information for the NIC.
@platform{host} @platform{gpu_bm_linux}
- Parameters:
processor_handle – [in] NIC for which to query
info – [out] reference to the nic bus info struct. Must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_nic_numa_info(amdsmi_processor_handle processor_handle, amdsmi_nic_numa_info_t *info)#
Retrieves NUMA information for the NIC.
@platform{host} @platform{gpu_bm_linux}
- Parameters:
processor_handle – [in] NIC for which to query
info – [out] reference to the nic numa info struct. Must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_nic_port_info(amdsmi_processor_handle processor_handle, amdsmi_nic_port_info_t *info)#
Retrieves PORT information for the NIC.
@platform{host} @platform{gpu_bm_linux}
- Parameters:
processor_handle – [in] NIC for which to query
info – [out] reference to the nic port info struct. Must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_nic_rdma_dev_info(amdsmi_processor_handle processor_handle, amdsmi_nic_rdma_devices_info_t *info)#
Retrieves RDMA devices information for the NIC.
@platform{host} @platform{gpu_bm_linux}
- Parameters:
processor_handle – [in] NIC for which to query
info – [out] reference to the nic rdma devices info struct. Must be allocated by user.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_nic_port_statistics(amdsmi_processor_handle processor_handle, uint32_t port_index, uint32_t *num_stats, amdsmi_nic_stat_t *stats)#
Retrieve PORT statistics for the specified NIC port.
@platform{host} @platform{gpu_bm_linux}
This function follows a two-call pattern:
First call with stats=NULL to get the count of available statistics
Second call with allocated array to retrieve all statistics
- Parameters:
processor_handle – [in] NIC for which to query
port_index – [in] index of the NIC port to query
num_stats – [inout] pointer to the number of statistics
Input: maximum number of statistics that stats array can hold
Output: actual number of statistics available/returned
stats – [out] pointer to array of amdsmi_nic_stat_t structures to be filled
If NULL, only num_stats is filled with the count of available statistics
If not NULL, must be allocated by user with at least num_stats elements
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_nic_vendor_statistics(amdsmi_processor_handle processor_handle, uint32_t port_index, uint32_t *num_stats, amdsmi_nic_stat_t *stats)#
Retrieve vendor specific statistics for the NIC port.
@platform{host} @platform{gpu_bm_linux}
This function follows a two-call pattern:
First call with stats=NULL to get the count of available statistics
Second call with allocated array to retrieve all statistics
This API provides access to vendor/driver specific statistics that may vary between different NIC vendors and driver/fw versions. The statistic names are preserved as provided by the underlying driver implementation.
- Parameters:
processor_handle – [in] NIC for which to query
port_index – [in] index of the NIC port to query
num_stats – [inout] pointer to the number of statistics
Input: maximum number of statistics that stats array can hold
Output: actual number of statistics available/returned
stats – [out] pointer to array of amdsmi_nic_stat_t structures to be filled
If NULL, only num_stats is filled with the count of available statistics
If not NULL, must be allocated by user with at least num_stats elements
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail
-
amdsmi_status_t amdsmi_get_nic_rdma_port_statistics(amdsmi_processor_handle processor_handle, uint32_t rdma_port_index, uint32_t *num_stats, amdsmi_nic_stat_t *stats)#
Retrieve RDMA port statistics for the NIC.
@platform{host} @platform{gpu_bm_linux}
This function follows a two-call pattern:
First call with stats=NULL to get the count of available statistics
Second call with allocated array to retrieve the statistics
- Parameters:
processor_handle – [in] NIC for which to query
rdma_port_index – [in] Zero-based position of the RDMA port in the order amdsmi_get_nic_rdma_dev_info() lists them: all ports of rdma_dev_info[0], then all ports of rdma_dev_info[1], and so on. This is not the rdma_port number.
num_stats – [inout] Pointer to the number of statistics.
When
statsis NULL, the input value is ignored. On success,*num_statsis the number of available statistics.When
statsis not NULL, the input value is how many entriesstatscan hold. On success,*num_statsis the number of entries written.
stats – [out] Pointer to an array of amdsmi_nic_stat_t to be filled. If NULL, only
num_statsis set to the count of available statistics.
- Returns:
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail