PCI Properties Extension

Contents

PCI Properties Extension#

API#

PCI Properties#

Accelerator devices connected to the host CPU over a PCI root complex can be located in the PCI switch fabric using a bus:device:function (BDF) address. This is useful, e.g., to determine which PCI devices are located close to each other in the PCI switch fabric. The ze_pci_address_ext_t struct returned via ze_pci_ext_properties_t by the call to zeDevicePciGetPropertiesExt contains the BDF address of the device.

The choice of the optimal algorithm to use for a given computation may be dependent on the access speed, i.e., bandwidth at which data can be transferred over PCI to the device. The ze_pci_speed_ext_t struct returned via ze_pci_ext_properties_t by the call to zeDevicePciGetPropertiesExt contains the theoretical PCI BW for accessing the device.

The following psuedo-code demonstrates a sequence for obtaining the BDF address & PCI BW of a device:

...
// Create a PCI address struct
ze_pci_address_ext_t devAddr = {
    0, // domain
    0, // bus
    0, // device
    0  // function
};
// Create a PCI speed struct
ze_pci_speed_ext_t devSpeed = {
    0, // gen
    0, // width
    0  // maxBandwidth
};

// Create a PCI Properties struct
ze_pci_ext_properties_t devPCIProps = {
    ZE_STRUCTURE_TYPE_PCI_EXT_PROPERTIES,
    nullptr,
    devAddr,
    devSpeed
};

// Get the PCI Address & Speed
ze_result_t result = zeDevicePciGetPropertiesExt(dev, &devPCIProps);