From aa5a863dae85b25b5e100dfe0dee43f7461a635b Mon Sep 17 00:00:00 2001 From: Wenju He Date: Sat, 18 Jul 2026 10:12:26 +0200 Subject: [PATCH] [SYCL][Unit] Mock UR_DEVICE_INFO_PLATFORM in UrMock Fixes `SYCL_UR_TRACE=1 ninja check-sycl-unittests` crash in #22683. mock_urDeviceGetInfo() fell through to the default zero-fill case for UR_DEVICE_INFO_PLATFORM, so device::get_info() returned a platform wrapping a null UR handle. This is latent unless something queries that platform afterwards, which detail::traceDeviceSelection() does whenever SYCL_UR_TRACE is enabled, causing urPlatformGetInfo to fail with UR_RESULT_ERROR_INVALID_NULL_HANDLE and the process to abort on the uncaught exception. Co-authored-by: Claude Sonnet 5 --- sycl/unittests/helpers/UrMock.hpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sycl/unittests/helpers/UrMock.hpp b/sycl/unittests/helpers/UrMock.hpp index 7179ac5b65548..c5b3dd47515d4 100644 --- a/sycl/unittests/helpers/UrMock.hpp +++ b/sycl/unittests/helpers/UrMock.hpp @@ -177,6 +177,14 @@ inline ur_result_t mock_urDeviceGetInfo(void *pParams) { **params->ppPropSizeRet = sizeof(MockDeviceName); return UR_RESULT_SUCCESS; } + case UR_DEVICE_INFO_PLATFORM: { + if (*params->ppPropValue) + *static_cast(*params->ppPropValue) = + reinterpret_cast(1); + if (*params->ppPropSizeRet) + **params->ppPropSizeRet = sizeof(ur_platform_handle_t); + return UR_RESULT_SUCCESS; + } case UR_DEVICE_INFO_PARENT_DEVICE: { if (*params->ppPropValue) *static_cast(*params->ppPropValue) = nullptr;