From 34b66fda1e32c5c8d1bd048e5b56202180d7fa76 Mon Sep 17 00:00:00 2001 From: Rafal Bielski Date: Fri, 1 Nov 2024 16:23:48 +0000 Subject: [PATCH] Set the right HIP device before creating base event counter Without any default device in the current thread, all base events were associated with device 0, causing failures when used on other devices. Fix this by calling hipSetDevice before recording the event. --- source/adapters/hip/platform.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/source/adapters/hip/platform.cpp b/source/adapters/hip/platform.cpp index ebfd422a3b..23aee0000b 100644 --- a/source/adapters/hip/platform.cpp +++ b/source/adapters/hip/platform.cpp @@ -77,6 +77,7 @@ urPlatformGet(ur_adapter_handle_t *, uint32_t, uint32_t NumEntries, for (auto i = 0u; i < static_cast(NumDevices); ++i) { hipDevice_t Device; UR_CHECK_ERROR(hipDeviceGet(&Device, i)); + UR_CHECK_ERROR(hipSetDevice(i)); hipEvent_t EvBase; UR_CHECK_ERROR(hipEventCreate(&EvBase));