kenba
kenba

Reputation: 4539

OpenCL Device Vendor Ids

The OpenCL clGetDeviceInfo function returns a device vendor identifier when called with CL_DEVICE_VENDOR_ID. For CL_DEVICE_VENDOR_ID, the OpenCL spec states: "A unique device vendor identifier. An example of a unique device identifier could be the PCIe ID".

On this system, the Intel and AMD GPUs are both returning their PCIe ID (0x8086 and 0x1002 respectively. So, the question is: do all OpenCL devices return their PCIe IDs as their "unique device vendor identifier"? If so, are the PCIe vendor IDs listed in a header file somewhere?

Upvotes: 0

Views: 1337

Answers (3)

aland
aland

Reputation: 5144

While in OpenCL 2.x PCIe ID is only an example of a possible device vendor identifier, OpenCL 3.0 made it mandatory to use PCI Vendor ID when the vendor has it (even if the current device does not use PCIe):

If the vendor has a PCI vendor ID, the low 16 bits must contain that PCI vendor ID, and the remaining bits must be set to zero. Otherwise, the value returned must be a valid Khronos vendor ID represented by type cl_khronos_vendor_id. Khronos vendor IDs are allocated starting at 0x10000, to distinguish them from the PCI vendor ID namespace.

Upvotes: 1

mogu
mogu

Reputation: 1119

do all OpenCL devices return their PCIe IDs

The answer is no. It's very easy on x86 where you're almost guaranteed to have a PCI bus, and only 3 possible vendors; but in the ARM world, many (most?) don't have a PCI bus at all, and there is no official way to get any sort of vendor ID (at least AFAIK).

Upvotes: 1

noma
noma

Reputation: 1229

According to the standard, there is no guarantee for it to be an PCIe device ID, so I wouldn't count on it. I'd expect it from hardware vendor's implementations, but not from open source implementations like PoCL. Even if all implementations currently did, the next one might not and your code would stop being portable.

In a Linux environment, you can use lspci and lspci -n to query your computer's device's, the latter just showing the IDs instead of names. The data seems to come from this file according to the manpage /usr/share/hwdata/pci.ids.

Hope that helps.

Upvotes: 1

Related Questions