PCIe Queries

PCIe Queries#

ROCmSMI: PCIe Queries
PCIe Queries

Functions

rsmi_status_t rsmi_dev_pci_bandwidth_get (uint32_t dv_ind, rsmi_pcie_bandwidth_t *bandwidth)
 Get the list of possible PCIe bandwidths that are available. More...
 
rsmi_status_t rsmi_dev_pci_id_get (uint32_t dv_ind, uint64_t *bdfid)
 Get the unique PCI device identifier associated for a device. More...
 
rsmi_status_t rsmi_topo_numa_affinity_get (uint32_t dv_ind, int32_t *numa_node)
 Get the NUMA node associated with a device. More...
 
rsmi_status_t rsmi_dev_pci_throughput_get (uint32_t dv_ind, uint64_t *sent, uint64_t *received, uint64_t *max_pkt_sz)
 Get PCIe traffic information. More...
 
rsmi_status_t rsmi_dev_pci_replay_counter_get (uint32_t dv_ind, uint64_t *counter)
 Get PCIe replay counter. More...
 

Detailed Description

These functions provide information about PCIe.

Function Documentation

◆ rsmi_dev_pci_bandwidth_get()

rsmi_status_t rsmi_dev_pci_bandwidth_get ( uint32_t  dv_ind,
rsmi_pcie_bandwidth_t bandwidth 
)

Get the list of possible PCIe bandwidths that are available.

Given a device index dv_ind and a pointer to a to an rsmi_pcie_bandwidth_t structure bandwidth, this function will fill in bandwidth with the possible T/s values and associated number of lanes, and indication of the current selection.

Parameters
[in]dv_inda device index
[in,out]bandwidtha pointer to a caller provided rsmi_pcie_bandwidth_t structure to which the frequency information will be written
Return values
RSMI_STATUS_SUCCESSis returned upon successful call.
RSMI_STATUS_UNEXPECTED_DATAData read or provided was not as expected

◆ rsmi_dev_pci_id_get()

rsmi_status_t rsmi_dev_pci_id_get ( uint32_t  dv_ind,
uint64_t *  bdfid 
)

Get the unique PCI device identifier associated for a device.

Give a device index dv_ind and a pointer to a uint64_t bdfid, this function will write the Bus/Device/Function PCI identifier (BDFID) associated with device dv_ind to the value pointed to by bdfid.

The format of bdfid will be as follows:

BDFID = ((DOMAIN & 0xFFFFFFFF) << 32) | ((Partition & 0xF) << 28)
        | ((BUS & 0xFF) << 8) | ((DEVICE & 0x1F) <<3 )
        | (FUNCTION & 0x7)

| Name | Field | KFD property KFD -> PCIe ID (uint64_t) -----------— | ----— | -------------— | -------------------------— | | Domain | [63:32] | "domain" | (DOMAIN & 0xFFFFFFFF) << 32 | | Partition id | [31:28] | "location id" | (LOCATION & 0xF0000000) | | Reserved | [27:16] | "location id" | N/A | | Bus | [15: 8] | "location id" | (LOCATION & 0xFF00) | | Device | [ 7: 3] | "location id" | (LOCATION & 0xF8) | | Function | [ 2: 0] | "location id" | (LOCATION & 0x7) |

Parameters
[in]dv_inda device index
[in,out]bdfida pointer to uint64_t to which the device bdfid value will be written If this parameter is nullptr, this function will return RSMI_STATUS_INVALID_ARGS if the function is supported with the provided, arguments and RSMI_STATUS_NOT_SUPPORTED if it is not supported with the provided arguments.
Return values
RSMI_STATUS_SUCCESScall was successful
RSMI_STATUS_NOT_SUPPORTEDinstalled software or hardware does not support this function with the given arguments
RSMI_STATUS_INVALID_ARGSthe provided arguments are not valid

◆ rsmi_topo_numa_affinity_get()

rsmi_status_t rsmi_topo_numa_affinity_get ( uint32_t  dv_ind,
int32_t *  numa_node 
)

Get the NUMA node associated with a device.

Given a device index dv_ind and a pointer to a uint32_t numa_node, this function will retrieve the NUMA node value associated with device dv_ind and store the value at location pointed to by numa_node.

Parameters
[in]dv_inda device index
[in,out]numa_nodepointer to location where NUMA node value will be written. If this parameter is nullptr, this function will return RSMI_STATUS_INVALID_ARGS if the function is supported with the provided, arguments and RSMI_STATUS_NOT_SUPPORTED if it is not supported with the provided arguments.
Return values
RSMI_STATUS_SUCCESScall was successful
RSMI_STATUS_NOT_SUPPORTEDinstalled software or hardware does not support this function with the given arguments
RSMI_STATUS_INVALID_ARGSthe provided arguments are not valid

◆ rsmi_dev_pci_throughput_get()

rsmi_status_t rsmi_dev_pci_throughput_get ( uint32_t  dv_ind,
uint64_t *  sent,
uint64_t *  received,
uint64_t *  max_pkt_sz 
)

Get PCIe traffic information.

Give a device index dv_ind and pointers to a uint64_t's, sent, received and max_pkt_sz, this function will write the number of bytes sent and received in 1 second to sent and received, respectively. The maximum possible packet size will be written to max_pkt_sz.

Parameters
[in]dv_inda device index
[in,out]senta pointer to uint64_t to which the number of bytes sent will be written in 1 second. If pointer is NULL, it will be ignored.
[in,out]receiveda pointer to uint64_t to which the number of bytes received will be written. If pointer is NULL, it will be ignored.
[in,out]max_pkt_sza pointer to uint64_t to which the maximum packet size will be written. If pointer is NULL, it will be ignored.
Return values
RSMI_STATUS_SUCCESSis returned upon successful call.
RSMI_STATUS_NOT_SUPPORTEDinstalled software or hardware does not support this function with the given arguments

◆ rsmi_dev_pci_replay_counter_get()

rsmi_status_t rsmi_dev_pci_replay_counter_get ( uint32_t  dv_ind,
uint64_t *  counter 
)

Get PCIe replay counter.

Given a device index dv_ind and a pointer to a uint64_t counter, this function will write the sum of the number of NAK's received by the GPU and the NAK's generated by the GPU to memory pointed to by counter.

Parameters
[in]dv_inda device index
[in,out]countera pointer to uint64_t to which the sum of the NAK's received and generated by the GPU is written If this parameter is nullptr, this function will return RSMI_STATUS_INVALID_ARGS if the function is supported with the provided, arguments and RSMI_STATUS_NOT_SUPPORTED if it is not supported with the provided arguments.
Return values
RSMI_STATUS_SUCCESScall was successful
RSMI_STATUS_NOT_SUPPORTEDinstalled software or hardware does not support this function with the given arguments
RSMI_STATUS_INVALID_ARGSthe provided arguments are not valid