diff --git a/sycl/include/sycl/handler.hpp b/sycl/include/sycl/handler.hpp index 1e5caaadd5daf..67f21bc05857f 100644 --- a/sycl/include/sycl/handler.hpp +++ b/sycl/include/sycl/handler.hpp @@ -528,6 +528,7 @@ class __SYCL_EXPORT handler { bool IsKernelCreatedFromSource, bool IsESIMD); #endif +#ifndef __INTEL_PREVIEW_BREAKING_CHANGES /// \return a string containing name of SYCL kernel. detail::ABINeutralKernelNameStrT getKernelName(); @@ -543,6 +544,7 @@ class __SYCL_EXPORT handler { detail::ABINeutralKernelNameStrT KernelName = getKernelName(); return KernelName == LambdaName; } +#endif /// Saves the location of user's code passed in \p CodeLoc for future usage in /// finalize() method. @@ -1897,6 +1899,10 @@ class __SYCL_EXPORT handler { Kernel); } +#ifndef __INTEL_PREVIEW_BREAKING_CHANGES + // Implementation for something that had to be removed long ago but now stuck + // until next major release... + /// Defines and invokes a SYCL kernel function. /// /// \param Kernel is a SYCL kernel that is executed on a SYCL device @@ -1904,6 +1910,7 @@ class __SYCL_EXPORT handler { /// \param KernelFunc is a lambda that is used if device, queue is bound to, /// is a host device. template + __SYCL_DEPRECATED("This overload isn't part of SYCL2020 and will be removed.") void single_task(kernel Kernel, const KernelType &KernelFunc) { // Ignore any set kernel bundles and use the one associated with the kernel setHandlerKernelBundle(Kernel); @@ -1931,6 +1938,7 @@ class __SYCL_EXPORT handler { detail::CheckDeviceCopyable(); #endif } +#endif // __INTEL_PREVIEW_BREAKING_CHANGES #ifndef __INTEL_PREVIEW_BREAKING_CHANGES /// Defines and invokes a SYCL kernel function for the specified range. diff --git a/sycl/source/handler.cpp b/sycl/source/handler.cpp index e9a4322a5b191..7ef92d928a1f6 100644 --- a/sycl/source/handler.cpp +++ b/sycl/source/handler.cpp @@ -1093,7 +1093,7 @@ void handler::extractArgsAndReqs() { if (impl->MKernelData.getDeviceKernelInfoPtr() == nullptr) { impl->MKernelData.setDeviceKernelInfoPtr( &detail::ProgramManager::getInstance().getOrCreateDeviceKernelInfo( - toKernelNameStrT(getKernelName()))); + detail::toKernelNameStrT(MKernel->getName()))); } #endif assert(impl->MKernelData.getDeviceKernelInfoPtr() != nullptr); @@ -1109,7 +1109,7 @@ void handler::extractArgsAndReqsFromLambda( if (impl->MKernelData.getDeviceKernelInfoPtr() == nullptr) { impl->MKernelData.setDeviceKernelInfoPtr( &detail::ProgramManager::getInstance().getOrCreateDeviceKernelInfo( - toKernelNameStrT(getKernelName()))); + detail::toKernelNameStrT(MKernel->getName()))); } impl->MKernelData.setKernelInfo(LambdaPtr, NumKernelParams, ParamDescGetter, IsESIMD, true); @@ -1158,12 +1158,14 @@ void handler::extractArgsAndReqsFromLambda( } #endif // __INTEL_PREVIEW_BREAKING_CHANGES +#ifndef __INTEL_PREVIEW_BREAKING_CHANGES // Calling methods of kernel_impl requires knowledge of class layout. // As this is impossible in header, there's a function that calls necessary // method inside the library and returns the result. detail::ABINeutralKernelNameStrT handler::getKernelName() { return MKernel->getName(); } +#endif void handler::verifyUsedKernelBundleInternal(detail::string_view KernelName) { detail::kernel_bundle_impl *UsedKernelBundleImplPtr = @@ -2239,7 +2241,7 @@ sycl::detail::CGType handler::getType() const { return impl->MCGType; } void handler::setDeviceKernelInfo(kernel &&Kernel) { MKernel = detail::getSyclObjImpl(std::move(Kernel)); - MKernelName = getKernelName(); + MKernelName = MKernel->getName(); setDeviceKernelInfoPtr(&MKernel->getDeviceKernelInfo()); setType(detail::CGType::Kernel); diff --git a/sycl/test-e2e/Basic/kernel_info.cpp b/sycl/test-e2e/Basic/kernel_info.cpp index b3814cdeb6ea3..1d769a54a2e9a 100644 --- a/sycl/test-e2e/Basic/kernel_info.cpp +++ b/sycl/test-e2e/Basic/kernel_info.cpp @@ -18,6 +18,8 @@ using namespace sycl; namespace syclex = sycl::ext::oneapi; +class SingleTask; + auto checkExceptionIsThrown = [](auto &getInfoFunc, const std::string &refErrMsg, std::error_code refErrc) { @@ -40,13 +42,13 @@ int main() { queue q; auto ctx = q.get_context(); buffer buf(range<1>(1)); - auto kernelID = sycl::get_kernel_id(); + auto kernelID = sycl::get_kernel_id(); auto kb = get_kernel_bundle(ctx, {kernelID}); kernel krn = kb.get_kernel(kernelID); q.submit([&](handler &cgh) { auto acc = buf.get_access(cgh); - cgh.single_task(krn, [=]() { acc[0] = acc[0] + 1; }); + cgh.single_task([=]() { acc[0] = acc[0] + 1; }); }); const std::string krnName = krn.get_info(); diff --git a/sycl/test-e2e/Basic/kernel_info_attr.cpp b/sycl/test-e2e/Basic/kernel_info_attr.cpp index a1a302435a83e..7299ff803b182 100644 --- a/sycl/test-e2e/Basic/kernel_info_attr.cpp +++ b/sycl/test-e2e/Basic/kernel_info_attr.cpp @@ -25,17 +25,19 @@ using namespace sycl; namespace syclex = sycl::ext::oneapi; +class SingleTask; + int main() { queue q; auto ctx = q.get_context(); buffer buf(range<1>(1)); - auto KernelID = sycl::get_kernel_id(); + auto KernelID = sycl::get_kernel_id(); auto KB = get_kernel_bundle(ctx, {KernelID}); kernel krn = KB.get_kernel(KernelID); q.submit([&](handler &cgh) { auto acc = buf.get_access(cgh); - cgh.single_task(krn, [=]() { acc[0] = acc[0] + 1; }); + cgh.single_task([=]() { acc[0] = acc[0] + 1; }); }); const std::string krnAttr = krn.get_info(); diff --git a/sycl/test-e2e/DeviceCodeSplit/Inputs/split-per-source-second-file.cpp b/sycl/test-e2e/DeviceCodeSplit/Inputs/split-per-source-second-file.cpp index d5ee857ec4df3..67d5a1f752b24 100644 --- a/sycl/test-e2e/DeviceCodeSplit/Inputs/split-per-source-second-file.cpp +++ b/sycl/test-e2e/DeviceCodeSplit/Inputs/split-per-source-second-file.cpp @@ -16,7 +16,7 @@ void runKernelsFromFile2() { Q.submit([&](sycl::handler &Cgh) { auto Acc = Buf.get_access(Cgh); - Cgh.single_task(Krn, [=]() { Acc[0] = 3; }); + Cgh.single_task([=]() { Acc[0] = 3; }); }); } assert(Data == 3); diff --git a/sycl/test-e2e/DeviceCodeSplit/split-per-kernel.cpp b/sycl/test-e2e/DeviceCodeSplit/split-per-kernel.cpp index 15677a64ea5e5..7503ef6db464b 100644 --- a/sycl/test-e2e/DeviceCodeSplit/split-per-kernel.cpp +++ b/sycl/test-e2e/DeviceCodeSplit/split-per-kernel.cpp @@ -26,7 +26,7 @@ int main() { Q.submit([&](sycl::handler &Cgh) { auto Acc = Buf.get_access(Cgh); - Cgh.single_task(Krn, [=]() { Acc[0] = 1; }); + Cgh.single_task([=]() { Acc[0] = 1; }); }); } assert(Data == 1); @@ -45,7 +45,7 @@ int main() { Q.submit([&](sycl::handler &Cgh) { auto Acc = Buf.get_access(Cgh); - Cgh.single_task(Krn, [=]() { Acc[0] = 2; }); + Cgh.single_task([=]() { Acc[0] = 2; }); }); } assert(Data == 2); @@ -64,7 +64,7 @@ int main() { Q.submit([&](sycl::handler &Cgh) { auto Acc = Buf.get_access(Cgh); - Cgh.single_task(Krn, [=]() { Acc[0] = 3; }); + Cgh.single_task([=]() { Acc[0] = 3; }); }); } assert(Data == 3); diff --git a/sycl/test-e2e/DeviceCodeSplit/split-per-source-main.cpp b/sycl/test-e2e/DeviceCodeSplit/split-per-source-main.cpp index 29c6102f71284..ed498fa8e8d52 100644 --- a/sycl/test-e2e/DeviceCodeSplit/split-per-source-main.cpp +++ b/sycl/test-e2e/DeviceCodeSplit/split-per-source-main.cpp @@ -31,7 +31,7 @@ int main() { sycl::buffer Buf(&Data, sycl::range<1>(1)); Q.submit([&](sycl::handler &Cgh) { auto Acc = Buf.get_access(Cgh); - Cgh.single_task(Krn1, [=]() { Acc[0] = 1; }); + Cgh.single_task([=]() { Acc[0] = 1; }); }); } assert(Data == 1); @@ -40,7 +40,7 @@ int main() { sycl::buffer Buf(&Data, sycl::range<1>(1)); Q.submit([&](sycl::handler &Cgh) { auto Acc = Buf.get_access(Cgh); - Cgh.single_task(Krn2, [=]() { Acc[0] = 2; }); + Cgh.single_task([=]() { Acc[0] = 2; }); }); } assert(Data == 2); diff --git a/sycl/test-e2e/DeviceImageBackendContent/CUDA_interop_test.cpp b/sycl/test-e2e/DeviceImageBackendContent/CUDA_interop_test.cpp index 3ecf862130665..fda63b24cfbc7 100644 --- a/sycl/test-e2e/DeviceImageBackendContent/CUDA_interop_test.cpp +++ b/sycl/test-e2e/DeviceImageBackendContent/CUDA_interop_test.cpp @@ -7,10 +7,12 @@ #include #include +class mykernel; + int main() { sycl::queue q; sycl::context ctxt = q.get_context(); - sycl::kernel_id k_id = sycl::get_kernel_id(); + sycl::kernel_id k_id = sycl::get_kernel_id(); auto bundle = sycl::get_kernel_bundle(ctxt, {k_id}); assert(!bundle.empty()); @@ -18,7 +20,7 @@ int main() { sycl::buffer buf(sycl::range<1>(1)); q.submit([&](sycl::handler &cgh) { sycl::accessor acc(buf, cgh); - cgh.single_task(krn, [=]() { acc[0] = 42; }); + cgh.single_task([=]() { acc[0] = 42; }); }); const auto img = *(bundle.begin()); const auto bytes = img.ext_oneapi_get_backend_content(); diff --git a/sycl/test-e2e/DeviceImageBackendContent/basic_test.cpp b/sycl/test-e2e/DeviceImageBackendContent/basic_test.cpp index 83539aa41c1ec..b2cbcb8b0c0dc 100644 --- a/sycl/test-e2e/DeviceImageBackendContent/basic_test.cpp +++ b/sycl/test-e2e/DeviceImageBackendContent/basic_test.cpp @@ -5,18 +5,20 @@ #include #include +class mykernel; + int main() { sycl::queue q; sycl::context ctxt = q.get_context(); sycl::buffer buf(sycl::range<1>(1)); - sycl::kernel_id k_id = sycl::get_kernel_id(); + sycl::kernel_id k_id = sycl::get_kernel_id(); auto bundle = sycl::get_kernel_bundle(ctxt, {k_id}); assert(!bundle.empty()); sycl::kernel krn = bundle.get_kernel(k_id); q.submit([&](sycl::handler &cgh) { sycl::accessor acc(buf, cgh); - cgh.single_task(krn, [=]() { acc[0] = 42; }); + cgh.single_task([=]() { acc[0] = 42; }); }); sycl::backend backend; std::vector bytes; diff --git a/sycl/test-e2e/NewOffloadDriver/Inputs/split-per-source-second-file.cpp b/sycl/test-e2e/NewOffloadDriver/Inputs/split-per-source-second-file.cpp index d5ee857ec4df3..67d5a1f752b24 100644 --- a/sycl/test-e2e/NewOffloadDriver/Inputs/split-per-source-second-file.cpp +++ b/sycl/test-e2e/NewOffloadDriver/Inputs/split-per-source-second-file.cpp @@ -16,7 +16,7 @@ void runKernelsFromFile2() { Q.submit([&](sycl::handler &Cgh) { auto Acc = Buf.get_access(Cgh); - Cgh.single_task(Krn, [=]() { Acc[0] = 3; }); + Cgh.single_task([=]() { Acc[0] = 3; }); }); } assert(Data == 3); diff --git a/sycl/test-e2e/NewOffloadDriver/split-per-source-main.cpp b/sycl/test-e2e/NewOffloadDriver/split-per-source-main.cpp index fc08e94aee467..d78c39f7bdfd1 100644 --- a/sycl/test-e2e/NewOffloadDriver/split-per-source-main.cpp +++ b/sycl/test-e2e/NewOffloadDriver/split-per-source-main.cpp @@ -31,7 +31,7 @@ int main() { sycl::buffer Buf(&Data, sycl::range<1>(1)); Q.submit([&](sycl::handler &Cgh) { auto Acc = Buf.get_access(Cgh); - Cgh.single_task(Krn1, [=]() { Acc[0] = 1; }); + Cgh.single_task([=]() { Acc[0] = 1; }); }); } assert(Data == 1); @@ -40,7 +40,7 @@ int main() { sycl::buffer Buf(&Data, sycl::range<1>(1)); Q.submit([&](sycl::handler &Cgh) { auto Acc = Buf.get_access(Cgh); - Cgh.single_task(Krn2, [=]() { Acc[0] = 2; }); + Cgh.single_task([=]() { Acc[0] = 2; }); }); } assert(Data == 2); diff --git a/sycl/test/warnings/deprecated_get_backend_info.cpp b/sycl/test/warnings/deprecated_get_backend_info.cpp index 1932fc910fc68..7bc24d835d3bb 100644 --- a/sycl/test/warnings/deprecated_get_backend_info.cpp +++ b/sycl/test/warnings/deprecated_get_backend_info.cpp @@ -6,6 +6,8 @@ using namespace sycl; +class SingleTask; + int main() { #if (defined(_GLIBCXX_USE_CXX11_ABI) && _GLIBCXX_USE_CXX11_ABI != 0) || \ !defined(_GLIBCXX_USE_CXX11_ABI) || TEST_ERRORS @@ -77,13 +79,13 @@ int main() { // Test get_backend_info for sycl::kernel // Trivial kernel simply for testing buffer buf(range<1>(1)); - auto KernelID = sycl::get_kernel_id(); + auto KernelID = sycl::get_kernel_id(); auto KB = get_kernel_bundle(q.get_context(), {KernelID}); kernel krn = KB.get_kernel(KernelID); q.submit([&](handler &cgh) { auto acc = buf.get_access(cgh); - cgh.single_task(krn, [=]() { acc[0] = acc[0] + 1; }); + cgh.single_task([=]() { acc[0] = acc[0] + 1; }); }); // expected-warning@+3 {{'get_backend_info' is deprecated: All current implementations of get_backend_info() are to be removed. Use respective variants of get_info() instead.}} // expected-warning@+2 {{'get_backend_info' is deprecated: All current implementations of get_backend_info() are to be removed. Use respective variants of get_info() instead.}}