Skip to content

Commit 1f19761

Browse files
authored
Enable peering among all devices on the system. (#19555)
We have to do this for models that are using multiple devices but are not using them as a single logical device. Signed-off-by: Andrew Woloszyn <[email protected]>
1 parent 0184eee commit 1f19761

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

runtime/src/iree/hal/drivers/hip/hip_device.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -455,13 +455,16 @@ iree_status_t iree_hal_hip_device_create(
455455
}
456456

457457
if (iree_status_is_ok(status)) {
458-
for (iree_host_size_t j = 0;
459-
j < device_count && iree_status_is_ok(status); ++j) {
460-
if (i == j) {
458+
int hip_device_count = 0;
459+
status = IREE_HIP_CALL_TO_STATUS(
460+
symbols, hipGetDeviceCount(&hip_device_count), "hipGetDeviceCount");
461+
462+
for (int j = 0; j < hip_device_count && iree_status_is_ok(status); ++j) {
463+
if (j == device->devices[i].hip_device) {
461464
continue;
462465
}
463-
status = IREE_HIP_CALL_TO_STATUS(
464-
symbols, hipDeviceEnablePeerAccess(devices[j], 0));
466+
status =
467+
IREE_HIP_CALL_TO_STATUS(symbols, hipDeviceEnablePeerAccess(j, 0));
465468
}
466469
}
467470
}

0 commit comments

Comments
 (0)