Skip to content

[SYCL] Don't release sub-devices on Linux OpenCL either - #22897

Open
wenju-he wants to merge 1 commit into
intel:syclfrom
wenju-he:fix/opencl-subdevice-late-shutdown-crash
Open

[SYCL] Don't release sub-devices on Linux OpenCL either#22897
wenju-he wants to merge 1 commit into
intel:syclfrom
wenju-he:fix/opencl-subdevice-late-shutdown-crash

Conversation

@wenju-he

@wenju-he wenju-he commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Releasing temporary sub-device handles at the end of device_impl::create_sub_devices (introduced in 8456b01, "[SYCL] Fix memory leak for sub-devices (#20370)") can crash during late shutdown: shutdown_late() releases the platform's cached device_impls after the OpenCL ICD may have already begun tearing down, so clReleaseDevice() fails and trips assert(Res == CL_SUCCESS) in the opencl adapter's ur_device_handle_t_ destructor, aborting the process.

bdfa20b worked around this for Windows OpenCL only. Extend the same workaround to the OpenCL backend regardless of OS, and update DeviceRefCounter unit test accordingly.

Fixes: SYCL :: PlatformDeviceIndex/sycl_ext_oneapi_platform_device_index.cpp

CMPLRLLVM-77426

Releasing temporary sub-device handles at the end of
device_impl::create_sub_devices (introduced in 8456b01, "[SYCL]
Fix memory leak for sub-devices (intel#20370)") can crash during late
shutdown: shutdown_late() releases the platform's cached device_impls
after the OpenCL ICD may have already begun tearing down, so
clReleaseDevice() fails and trips assert(Res == CL_SUCCESS) in the
opencl adapter's ur_device_handle_t_ destructor, aborting the process.

bdfa20b worked around this for Windows OpenCL only. Extend the
same workaround to the OpenCL backend regardless of OS, and update
DeviceRefCounter unit test accordingly.

Fixes: SYCL :: PlatformDeviceIndex/sycl_ext_oneapi_platform_device_index.cpp

CMPLRLLVM-77426

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@wenju-he
wenju-he requested a review from a team as a code owner August 7, 2026 07:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant