From abafa7ad4cc8aba526a724c9d8777617c7161e52 Mon Sep 17 00:00:00 2001 From: Chris Perkins Date: Tue, 26 Aug 2025 16:55:58 -0700 Subject: [PATCH 1/6] ~queue destructor is supposed to call asynchronous exception handler. Presently we do this in ~queue_impl, which isn't exactly compliant with spec, because it's possible that queue_impl may outlive queue because of shared pointer. Signed-off-by: Chris Perkins --- sycl/include/sycl/queue.hpp | 2 ++ sycl/source/detail/queue_impl.hpp | 2 +- sycl/source/queue.cpp | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/sycl/include/sycl/queue.hpp b/sycl/include/sycl/queue.hpp index 36006ac341bb6..534c36b32316f 100644 --- a/sycl/include/sycl/queue.hpp +++ b/sycl/include/sycl/queue.hpp @@ -359,6 +359,8 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase { queue(queue &&RHS) = default; + ~queue(); + queue &operator=(const queue &RHS) = default; queue &operator=(queue &&RHS) = default; diff --git a/sycl/source/detail/queue_impl.hpp b/sycl/source/detail/queue_impl.hpp index 6066ed6b3de50..1324155416789 100644 --- a/sycl/source/detail/queue_impl.hpp +++ b/sycl/source/detail/queue_impl.hpp @@ -255,7 +255,7 @@ class queue_impl : public std::enable_shared_from_this { // notification and destroy the trace event for this queue. destructorNotification(); #endif - throw_asynchronous(); + auto status = getAdapter().call_nocheck(MQueue); // If loader is already closed, it'll return a not-initialized status diff --git a/sycl/source/queue.cpp b/sycl/source/queue.cpp index f4e0824391fd1..26e39446e00b8 100644 --- a/sycl/source/queue.cpp +++ b/sycl/source/queue.cpp @@ -105,6 +105,10 @@ queue::queue(cl_command_queue clQueue, const context &SyclContext, *detail::getSyclObjImpl(SyclContext), AsyncHandler, PropList); } +queue::~queue() { + impl->throw_asynchronous(); // <-- this should be safe in a noexcept context. +} + cl_command_queue queue::get() const { return impl->get(); } context queue::get_context() const { return impl->get_context(); } From 81f1835e1b4e88a858942a894b6e36d7806f7be6 Mon Sep 17 00:00:00 2001 From: Chris Perkins Date: Wed, 27 Aug 2025 10:10:58 -0700 Subject: [PATCH 2/6] lin symbols Signed-off-by: Chris Perkins --- sycl/test/abi/sycl_symbols_linux.dump | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sycl/test/abi/sycl_symbols_linux.dump b/sycl/test/abi/sycl_symbols_linux.dump index f41c07ee394b7..1007a671c7ac4 100644 --- a/sycl/test/abi/sycl_symbols_linux.dump +++ b/sycl/test/abi/sycl_symbols_linux.dump @@ -3198,6 +3198,8 @@ _ZN4sycl3_V15queueC2ERKNS0_7contextERKNS0_15device_selectorERKNS0_13property_lis _ZN4sycl3_V15queueC2ERKNS0_7contextERKNS0_15device_selectorERKSt8functionIFvNS0_14exception_listEEERKNS0_13property_listE _ZN4sycl3_V15queueC2ERKNS0_7contextERKNS0_6deviceERKNS0_13property_listE _ZN4sycl3_V15queueC2ERKNS0_7contextERKNS0_6deviceERKSt8functionIFvNS0_14exception_listEEERKNS0_13property_listE +_ZN4sycl3_V15queueD1Ev +_ZN4sycl3_V15queueD2Ev _ZN4sycl3_V16ONEAPI15filter_selectorC1ENS0_6detail11string_viewE _ZN4sycl3_V16ONEAPI15filter_selectorC2ENS0_6detail11string_viewE _ZN4sycl3_V16detail10build_implERKNS0_13kernel_bundleILNS0_12bundle_stateE0EEERKSt6vectorINS0_6deviceESaIS8_EERKNS0_13property_listE @@ -3334,6 +3336,7 @@ _ZN4sycl3_V16detail21LocalAccessorBaseHost7getSizeEv _ZN4sycl3_V16detail21LocalAccessorBaseHostC1ENS0_5rangeILi3EEEiiRKNS0_13property_listE _ZN4sycl3_V16detail21LocalAccessorBaseHostC2ENS0_5rangeILi3EEEiiRKNS0_13property_listE _ZN4sycl3_V16detail22addHostAccessorAndWaitEPNS1_16AccessorImplHostE +_ZN4sycl3_V16detail22free_function_info_map3addEPKPKcPKjj _ZN4sycl3_V16detail22get_kernel_bundle_implERKNS0_7contextERKSt6vectorINS0_6deviceESaIS6_EENS0_12bundle_stateE _ZN4sycl3_V16detail22get_kernel_bundle_implERKNS0_7contextERKSt6vectorINS0_6deviceESaIS6_EENS0_12bundle_stateERKSt8functionIFbRKSt10shared_ptrINS1_17device_image_implEEEE _ZN4sycl3_V16detail22get_kernel_bundle_implERKNS0_7contextERKSt6vectorINS0_6deviceESaIS6_EERKNS0_4spanIcLm18446744073709551615EEENS0_12bundle_stateE @@ -3850,7 +3853,6 @@ _ZNK4sycl3_V16detail19kernel_bundle_plain5emptyEv _ZNK4sycl3_V16detail21LocalAccessorBaseHost11getPropListEv _ZNK4sycl3_V16detail21LocalAccessorBaseHost6getPtrEv _ZNK4sycl3_V16detail21LocalAccessorBaseHost7getSizeEv -_ZN4sycl3_V16detail22free_function_info_map3addEPKPKcPKjj _ZNK4sycl3_V16detail28SampledImageAccessorBaseHost10getSamplerEv _ZNK4sycl3_V16detail28SampledImageAccessorBaseHost11getPropListEv _ZNK4sycl3_V16detail28SampledImageAccessorBaseHost12getNumOfDimsEv From 02900e193db749345fad00a266fd0fb0e3aaaa1c Mon Sep 17 00:00:00 2001 From: Chris Perkins Date: Wed, 27 Aug 2025 10:44:59 -0700 Subject: [PATCH 3/6] guard Signed-off-by: Chris Perkins --- sycl/source/queue.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sycl/source/queue.cpp b/sycl/source/queue.cpp index 26e39446e00b8..ae7df25dd5ea0 100644 --- a/sycl/source/queue.cpp +++ b/sycl/source/queue.cpp @@ -106,7 +106,9 @@ queue::queue(cl_command_queue clQueue, const context &SyclContext, } queue::~queue() { - impl->throw_asynchronous(); // <-- this should be safe in a noexcept context. + if(impl){ + impl->throw_asynchronous(); // <-- this should be safe in a noexcept context. + } } cl_command_queue queue::get() const { return impl->get(); } From db0508dd14c3b1f342c08df572e7bc8da9885161 Mon Sep 17 00:00:00 2001 From: "Perkins, Chris" Date: Wed, 27 Aug 2025 11:00:26 -0700 Subject: [PATCH 4/6] win sym for the win (sym) Signed-off-by: Perkins, Chris --- sycl/test/abi/sycl_symbols_windows.dump | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sycl/test/abi/sycl_symbols_windows.dump b/sycl/test/abi/sycl_symbols_windows.dump index 8d6235784776e..b88ec7a42694b 100644 --- a/sycl/test/abi/sycl_symbols_windows.dump +++ b/sycl/test/abi/sycl_symbols_windows.dump @@ -229,9 +229,9 @@ ??$get_info_impl@Unative_vector_width_int@device@info@_V1@sycl@@@device@_V1@sycl@@AEBAIXZ ??$get_info_impl@Unative_vector_width_long@device@info@_V1@sycl@@@device@_V1@sycl@@AEBAIXZ ??$get_info_impl@Unative_vector_width_short@device@info@_V1@sycl@@@device@_V1@sycl@@AEBAIXZ +??$get_info_impl@Unode_mask@device@info@intel@ext@_V1@sycl@@@device@_V1@sycl@@AEBAIXZ ??$get_info_impl@Unum_args@kernel@info@_V1@sycl@@@kernel@_V1@sycl@@AEBAIXZ ??$get_info_impl@Unum_compute_units@device@info@oneapi@ext@_V1@sycl@@@device@_V1@sycl@@AEBA_KXZ -??$get_info_impl@Unode_mask@device@info@intel@ext@_V1@sycl@@@device@_V1@sycl@@AEBAIXZ ??$get_info_impl@Uopencl_c_version@device@info@_V1@sycl@@@device@_V1@sycl@@AEBA?AVstring@detail@12@XZ ??$get_info_impl@Uparent_device@device@info@_V1@sycl@@@device@_V1@sycl@@AEBA?AV012@XZ ??$get_info_impl@Upartition_affinity_domains@device@info@_V1@sycl@@@device@_V1@sycl@@AEBA?AV?$vector@W4partition_affinity_domain@info@_V1@sycl@@V?$allocator@W4partition_affinity_domain@info@_V1@sycl@@@std@@@std@@XZ @@ -4188,8 +4188,8 @@ ?get_impl@handler@_V1@sycl@@AEAAPEAVhandler_impl@detail@23@XZ ?get_kernel@kernel_bundle_plain@detail@_V1@sycl@@IEBA?AVkernel@34@AEBVkernel_id@34@@Z ?get_kernel_bundle@kernel@_V1@sycl@@QEBA?AV?$kernel_bundle@$01@23@XZ -?get_kernel_bundle_impl@detail@_V1@sycl@@YA?AV?$shared_ptr@Vkernel_bundle_impl@detail@_V1@sycl@@@std@@AEBVcontext@23@AEBV?$vector@Vdevice@_V1@sycl@@V?$allocator@Vdevice@_V1@sycl@@@std@@@5@AEBV?$vector@Vkernel_id@_V1@sycl@@V?$allocator@Vkernel_id@_V1@sycl@@@std@@@5@W4bundle_state@23@@Z ?get_kernel_bundle_impl@detail@_V1@sycl@@YA?AV?$shared_ptr@Vkernel_bundle_impl@detail@_V1@sycl@@@std@@AEBVcontext@23@AEBV?$vector@Vdevice@_V1@sycl@@V?$allocator@Vdevice@_V1@sycl@@@std@@@5@AEBV?$span@D$0?0@23@W4bundle_state@23@@Z +?get_kernel_bundle_impl@detail@_V1@sycl@@YA?AV?$shared_ptr@Vkernel_bundle_impl@detail@_V1@sycl@@@std@@AEBVcontext@23@AEBV?$vector@Vdevice@_V1@sycl@@V?$allocator@Vdevice@_V1@sycl@@@std@@@5@AEBV?$vector@Vkernel_id@_V1@sycl@@V?$allocator@Vkernel_id@_V1@sycl@@@std@@@5@W4bundle_state@23@@Z ?get_kernel_bundle_impl@detail@_V1@sycl@@YA?AV?$shared_ptr@Vkernel_bundle_impl@detail@_V1@sycl@@@std@@AEBVcontext@23@AEBV?$vector@Vdevice@_V1@sycl@@V?$allocator@Vdevice@_V1@sycl@@@std@@@5@W4bundle_state@23@@Z ?get_kernel_bundle_impl@detail@_V1@sycl@@YA?AV?$shared_ptr@Vkernel_bundle_impl@detail@_V1@sycl@@@std@@AEBVcontext@23@AEBV?$vector@Vdevice@_V1@sycl@@V?$allocator@Vdevice@_V1@sycl@@@std@@@5@W4bundle_state@23@AEBV?$function@$$A6A_NAEBV?$shared_ptr@Vdevice_image_impl@detail@_V1@sycl@@@std@@@Z@5@@Z ?get_kernel_id_impl@detail@_V1@sycl@@YA?AVkernel_id@23@Vstring_view@123@@Z @@ -4429,8 +4429,8 @@ ?setNDRangeDescriptor@handler@_V1@sycl@@AEAAXV?$range@$02@23@0V?$id@$02@23@@Z ?setNDRangeDescriptor@handler@_V1@sycl@@AEAAXV?$range@$02@23@V?$id@$02@23@@Z ?setNDRangeDescriptor@handler@_V1@sycl@@AEAAXV?$range@$02@23@_N@Z -?setNDRangeDescriptorPadded@handler@_V1@sycl@@AEAAXV?$range@$02@23@V?$id@$02@23@H@Z ?setNDRangeDescriptorPadded@handler@_V1@sycl@@AEAAXV?$range@$02@23@0V?$id@$02@23@H@Z +?setNDRangeDescriptorPadded@handler@_V1@sycl@@AEAAXV?$range@$02@23@V?$id@$02@23@H@Z ?setNDRangeDescriptorPadded@handler@_V1@sycl@@AEAAXV?$range@$02@23@_NH@Z ?setNDRangeUsed@handler@_V1@sycl@@AEAAX_N@Z ?setStateExplicitKernelBundle@handler@_V1@sycl@@AEAAXXZ From 47d889f6b5b65f692a60c2931c0b49c96f2485fd Mon Sep 17 00:00:00 2001 From: Chris Perkins Date: Wed, 27 Aug 2025 11:30:47 -0700 Subject: [PATCH 5/6] clang formation Signed-off-by: Chris Perkins --- sycl/source/queue.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sycl/source/queue.cpp b/sycl/source/queue.cpp index ae7df25dd5ea0..09d6409eba9a7 100644 --- a/sycl/source/queue.cpp +++ b/sycl/source/queue.cpp @@ -107,7 +107,7 @@ queue::queue(cl_command_queue clQueue, const context &SyclContext, queue::~queue() { if(impl){ - impl->throw_asynchronous(); // <-- this should be safe in a noexcept context. + impl->throw_asynchronous(); } } From 9311a5053420ff017ed699d7c7b2f57359a16639 Mon Sep 17 00:00:00 2001 From: Chris Perkins Date: Wed, 27 Aug 2025 13:30:59 -0700 Subject: [PATCH 6/6] more clang-format? why wasn't it caught before? Signed-off-by: Chris Perkins --- sycl/source/queue.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sycl/source/queue.cpp b/sycl/source/queue.cpp index 09d6409eba9a7..27d2b5b721dce 100644 --- a/sycl/source/queue.cpp +++ b/sycl/source/queue.cpp @@ -106,7 +106,7 @@ queue::queue(cl_command_queue clQueue, const context &SyclContext, } queue::~queue() { - if(impl){ + if (impl) { impl->throw_asynchronous(); } }