Skip to content

Commit

Permalink
levelzero.h: fix the lookup of parent pci devices
Browse files Browse the repository at this point in the history
L0 osdevs may have subdevices, hence the PCI parent isn't always the first parent.

Signed-off-by: Brice Goglin <Brice.Goglin@inria.fr>
(cherry picked from commit 8bc2304)
  • Loading branch information
bgoglin committed Nov 13, 2024

Verified

This commit was signed with the committer’s verified signature.
nickvergessen Joas Schilling
1 parent 0334ea1 commit a27db8b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions include/hwloc/levelzero.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2021-2023 Inria. All rights reserved.
* Copyright © 2021-2024 Inria. All rights reserved.
* See COPYING in top-level directory.
*/

@@ -131,11 +131,17 @@ hwloc_levelzero_get_device_osdev(hwloc_topology_t topology, ze_device_handle_t d

osdev = NULL;
while ((osdev = hwloc_get_next_osdev(topology, osdev)) != NULL) {
hwloc_obj_t pcidev = osdev->parent;
hwloc_obj_t pcidev;

if (strncmp(osdev->name, "ze", 2))
continue;

pcidev = osdev;
while (pcidev && pcidev->type != HWLOC_OBJ_PCI_DEVICE)
pcidev = pcidev->parent;
if (!pcidev)
continue;

if (pcidev
&& pcidev->type == HWLOC_OBJ_PCI_DEVICE
&& pcidev->attr->pcidev.domain == pci.address.domain

0 comments on commit a27db8b

Please sign in to comment.