From 58f3a8ef9e73d9071076126a566f988a459fc473 Mon Sep 17 00:00:00 2001 From: Gabriel Bouffard Date: Sun, 24 May 2026 15:25:10 -0400 Subject: [PATCH] fix: disable USM compression for any multi-device context The existing peer-USM compression guard in createUnifiedMemoryAllocation is gated on device->hasAnyPeerAccess().value_or(false). That std::optional is populated lazily by initializePeerAccessForDevices at driver init and can be observed as Some(false) for the first USM device allocation in a multi-device L0 context. The disable arm is then skipped, the BO is allocated with the compression flag enabled, and any later peer-import returns the compressed bytes through dma-buf without the matching surface metadata. Use rootDeviceIndices.size() > 1 as an additional gate. That property is known synchronously at allocation time and conservatively disables compression for any BO in a multi-device context, where peer-import can happen at any subsequent point regardless of the current peer-access cache state. Verified on 2x Intel Arc Pro B70 (BMG-G31), Linux 7.1-rc4 + xe (with Leon Romanovsky's "dma-buf: Always build with DMABUF_MOVE_NOTIFY"): multi-device sycl::queue::memcpy(host, dev0_usm_ptr) executed on dev1 previously returned garbage; now returns the source data correctly. The OpenCL backend symptom (UNRECOVERABLE_IF(!allocation) at enqueue_svm.h:308) is resolved by the same fix. Related: vllm-project/vllm#41663, intel/compute-runtime#916, #921, #922. Signed-off-by: Gabriel Bouffard --- shared/source/memory_manager/unified_memory_manager.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shared/source/memory_manager/unified_memory_manager.cpp b/shared/source/memory_manager/unified_memory_manager.cpp index 7737658608068..936f5b95614b0 100644 --- a/shared/source/memory_manager/unified_memory_manager.cpp +++ b/shared/source/memory_manager/unified_memory_manager.cpp @@ -525,9 +525,10 @@ void *SVMAllocsManager::createUnifiedMemoryAllocation(size_t size, AllocationType allocationType = getGraphicsAllocationTypeAndCompressionPreference(memoryProperties, compressionEnabled); bool preferCompressed = true; + const bool multiDeviceContext = (memoryProperties.rootDeviceIndices.size() > 1); if (compressionEnabled && memoryProperties.device) { if (not memoryProperties.device->getExecutionEnvironment()->isResourceDecompressionEnabled() && - memoryProperties.device->hasAnyPeerAccess().value_or(false)) { + (memoryProperties.device->hasAnyPeerAccess().value_or(false) || multiDeviceContext)) { preferCompressed = false; } }