From afe14682b743484aba0d483543e623118d06faba Mon Sep 17 00:00:00 2001 From: Maosu Zhao Date: Fri, 12 Sep 2025 13:53:42 +0800 Subject: [PATCH] [DevASAN] Report more detailed message if enqueue kernel failed (#20010) If user used all SLM, enqueue kernel will failed with out of device memory. We'd better report more detailed messages then user will not confuse about this error. --- .../loader/layers/sanitizer/asan/asan_ddi.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/unified-runtime/source/loader/layers/sanitizer/asan/asan_ddi.cpp b/unified-runtime/source/loader/layers/sanitizer/asan/asan_ddi.cpp index 899ff6a850dbe..012aa1422cfa1 100644 --- a/unified-runtime/source/loader/layers/sanitizer/asan/asan_ddi.cpp +++ b/unified-runtime/source/loader/layers/sanitizer/asan/asan_ddi.cpp @@ -520,10 +520,19 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueKernelLaunch( UR_CALL(getAsanInterceptor()->preLaunchKernel(hKernel, hQueue, LaunchInfo)); - UR_CALL(getContext()->urDdiTable.Enqueue.pfnKernelLaunch( + ur_result_t UrRes = getContext()->urDdiTable.Enqueue.pfnKernelLaunch( hQueue, hKernel, workDim, pGlobalWorkOffset, pGlobalWorkSize, LaunchInfo.LocalWorkSize.data(), numPropsInLaunchPropList, launchPropList, - numEventsInWaitList, phEventWaitList, phEvent)); + numEventsInWaitList, phEventWaitList, phEvent); + if (UrRes != UR_RESULT_SUCCESS) { + if (UrRes == UR_RESULT_ERROR_OUT_OF_DEVICE_MEMORY) { + UR_LOG_L( + getContext()->logger, ERR, + "urEnqueueKernelLaunch failed due to out of device memory, maybe " + "SLM is fully used."); + } + return UrRes; + } UR_CALL(getAsanInterceptor()->postLaunchKernel(hKernel, hQueue, LaunchInfo));