From ed5ff8b1ee8cdc436cf02bc304cf7a89d2d664a0 Mon Sep 17 00:00:00 2001 From: Udit Agarwal <16324601+uditagarwal97@users.noreply.github.com> Date: Mon, 4 Mar 2024 15:29:48 -0800 Subject: [PATCH] [SYCL][E2E] Fix Plugin/level_zero_usm_residency.cpp on Multi-card PVC (#12844) **Problem:** Plugin/level_zero_usm_residency.cpp fails on **Multi-card PVC** due to unexpected number of calls to zeContextMakeMemoryResident. The test was expecting just one call to zeContextMakeMemoryResident upon piextUSMDeviceAlloc. However, `// RUN: env SYCL_PI_TRACE=-1 UR_L0_DEBUG=-1 %{l0_leak_check} %{run} %t.out 2>&1` produces two calls to zeContextMakeMemoryResident. ``` ---> piextUSMDeviceAlloc( : 0x7ffc41c1d888 : 0x3086680 : 0x3084230 : 0x7ffc41c1d8b0 : 4 : 4 ZE ---> zeMemAllocDevice(Context->ZeContext, &ZeDesc, Size, Alignment, Device->ZeDevice, ResultPtr) ZE ---> zeDeviceCanAccessPeer(D->ZeDevice, Device->ZeDevice, &P2P) ZE ---> zeContextMakeMemoryResident(Context->ZeContext, D->ZeDevice, Ptr, Size) ZE ---> zeContextMakeMemoryResident(Context->ZeContext, D->ZeDevice, Ptr, Size) ) ---> pi_result : PI_SUCCESS [out] ** : 0x7ffc41c1d888[ 0xff00fffffffe0000 ... ] ``` **Solution**: The default value of SYCL_PI_LEVEL_ZERO_USM_RESIDENT is 0x002, which makes memory residence on all devices, which IIUC, means on all tiles of a multi-card PVC. That's why we see two calls to zeContextMakeMemoryResident, one for each tile of a multi-tile PVC. This doesn't look like a bug in the code, but in the test instead. This PR updates the test case to also accept more than one calls to zeContextMakeMemoryResident for device allocations. --- sycl/test-e2e/Plugin/level_zero_usm_residency.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/sycl/test-e2e/Plugin/level_zero_usm_residency.cpp b/sycl/test-e2e/Plugin/level_zero_usm_residency.cpp index 00091b4e257c4..97522316cce28 100644 --- a/sycl/test-e2e/Plugin/level_zero_usm_residency.cpp +++ b/sycl/test-e2e/Plugin/level_zero_usm_residency.cpp @@ -23,7 +23,6 @@ int main(int argc, char *argv[]) { // DEVICE: ---> piextUSMDeviceAlloc // DEVICE: ZE ---> zeMemAllocDevice // DEVICE: ZE ---> zeContextMakeMemoryResident - // DEVICE-NOT: ZE ---> zeContextMakeMemoryResident auto ptr2 = malloc_shared(1, Q); // SHARED: ---> piextUSMSharedAlloc