Skip to content

Commit 4f7a404

Browse files
committed
chore: Update isIntegratedGPU for readability
Signed-off-by: Evan Lezar <elezar@nvidia.com>
1 parent f991238 commit 4f7a404

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

pkg/nvcdi/lib-csv.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,12 @@ func isOrinGPUID(id device.Identifier) bool {
373373
}
374374

375375
// isIntegratedGPU checks whether the specified device is an integrated GPU.
376-
// As a proxy we check the PCI Bus if for thes
376+
// The following heuristic is followed:
377+
// - If the device does not support getting PCI bus information, we fall back to
378+
// checking the device name and consider Orin and Thor devices iGPUs.
379+
// - If the device does support PCI bus information, we check for a specific
380+
// bus ID that is associated with Thor devices.
381+
//
377382
// TODO: This should be replaced by an explicit NVML call once available.
378383
func isIntegratedGPU(d nvml.Device) (bool, error) {
379384
pciInfo, ret := d.GetPciInfo()
@@ -387,7 +392,11 @@ func isIntegratedGPU(d nvml.Device) (bool, error) {
387392
if ret != nvml.SUCCESS {
388393
return false, fmt.Errorf("failed to get PCI info: %v", ret)
389394
}
390-
395+
// On Thor-based systems, the iGPU always has the PCI bus ID '0000:01:00.0'.
396+
// We explicitly handle this case.
397+
if pciInfo.Domain == 0 && pciInfo.Bus == 1 && pciInfo.Device == 0 {
398+
return true, nil
399+
}
391400
if pciInfo.Domain != 0 {
392401
return false, nil
393402
}

0 commit comments

Comments
 (0)