From e396ed7cfdcf2e660428bf965b1369bfd47a757d Mon Sep 17 00:00:00 2001 From: "Agarwal, Udit" Date: Fri, 22 Aug 2025 19:33:57 +0200 Subject: [PATCH 1/3] [SYCL] Deprecate syclcompat --- sycl/doc/syclcompat/README.md | 4 ++ sycl/include/syclcompat/atomic.hpp | 2 +- sycl/include/syclcompat/defs.hpp | 2 +- sycl/include/syclcompat/device.hpp | 2 +- sycl/include/syclcompat/dims.hpp | 2 +- sycl/include/syclcompat/group_utils.hpp | 2 +- sycl/include/syclcompat/id_query.hpp | 2 +- sycl/include/syclcompat/kernel.hpp | 2 +- sycl/include/syclcompat/launch.hpp | 10 ++-- sycl/include/syclcompat/launch_policy.hpp | 2 +- sycl/include/syclcompat/math.hpp | 2 +- sycl/include/syclcompat/memory.hpp | 2 +- sycl/include/syclcompat/syclcompat.hpp | 18 +++++++ sycl/include/syclcompat/traits.hpp | 2 +- sycl/include/syclcompat/util.hpp | 2 +- sycl/test/syclcompat/warnings_deprecated.cpp | 49 +++++++++++++++++++ .../syclcompat/warnings_deprecated_msvc.cpp | 7 +++ 17 files changed, 95 insertions(+), 17 deletions(-) create mode 100644 sycl/test/syclcompat/warnings_deprecated.cpp create mode 100644 sycl/test/syclcompat/warnings_deprecated_msvc.cpp diff --git a/sycl/doc/syclcompat/README.md b/sycl/doc/syclcompat/README.md index 00d99e6c919f7..9835d325a966d 100644 --- a/sycl/doc/syclcompat/README.md +++ b/sycl/doc/syclcompat/README.md @@ -1,3 +1,7 @@ +**⚠️ DEPRECATION NOTICE ⚠️** + +**SYCLcompat is deprecated and will be removed in a future release. Users are encouraged to migrate to native SYCL APIs or alternative compatibility solutions. The `syclcompat` namespace has been marked with `[[deprecated]]` attribute.** + # SYCLcompat SYCLcompat is a header-only library that intends to help developers familiar diff --git a/sycl/include/syclcompat/atomic.hpp b/sycl/include/syclcompat/atomic.hpp index 4273b42795a16..85f5dab65f7f1 100644 --- a/sycl/include/syclcompat/atomic.hpp +++ b/sycl/include/syclcompat/atomic.hpp @@ -40,7 +40,7 @@ #include -namespace syclcompat { +namespace [[deprecated("syclcompat is deprecated")]] syclcompat { /// Atomically add the value operand to the value at the addr and assign the /// result to the value at addr. diff --git a/sycl/include/syclcompat/defs.hpp b/sycl/include/syclcompat/defs.hpp index 94758786a67cc..32f0c2197bde7 100644 --- a/sycl/include/syclcompat/defs.hpp +++ b/sycl/include/syclcompat/defs.hpp @@ -66,7 +66,7 @@ template class syclcompat_kernel_scalar; SYCLCOMPAT_MAKE_VERSION(SYCLCOMPAT_MAJOR_VERSION, SYCLCOMPAT_MINOR_VERSION, \ SYCLCOMPAT_PATCH_VERSION) -namespace syclcompat { +namespace [[deprecated("syclcompat is deprecated")]] syclcompat { enum error_code { success = 0, backend_error = 1, default_error = 999 }; /// A dummy function introduced to assist auto migration. /// The SYCLomatic user should replace it with a real error-handling function. diff --git a/sycl/include/syclcompat/device.hpp b/sycl/include/syclcompat/device.hpp index d31fb4ef1650a..5951b4fc6492c 100644 --- a/sycl/include/syclcompat/device.hpp +++ b/sycl/include/syclcompat/device.hpp @@ -56,7 +56,7 @@ #include #include -namespace syclcompat { +namespace [[deprecated("syclcompat is deprecated")]] syclcompat { namespace detail { static void parse_version_string(const std::string &ver, int &major, diff --git a/sycl/include/syclcompat/dims.hpp b/sycl/include/syclcompat/dims.hpp index 1ae9ae62877f7..0497cc7f6ebb4 100644 --- a/sycl/include/syclcompat/dims.hpp +++ b/sycl/include/syclcompat/dims.hpp @@ -26,7 +26,7 @@ #include -namespace syclcompat { +namespace [[deprecated("syclcompat is deprecated")]] syclcompat { class dim3 { public: diff --git a/sycl/include/syclcompat/group_utils.hpp b/sycl/include/syclcompat/group_utils.hpp index fdc68f5d279d1..52376fe7b45d7 100644 --- a/sycl/include/syclcompat/group_utils.hpp +++ b/sycl/include/syclcompat/group_utils.hpp @@ -38,7 +38,7 @@ #include #include -namespace syclcompat { +namespace [[deprecated("syclcompat is deprecated")]] syclcompat { namespace group { namespace detail { diff --git a/sycl/include/syclcompat/id_query.hpp b/sycl/include/syclcompat/id_query.hpp index fd61e554d8c17..2a61ac7c2127f 100644 --- a/sycl/include/syclcompat/id_query.hpp +++ b/sycl/include/syclcompat/id_query.hpp @@ -25,7 +25,7 @@ #include #include -namespace syclcompat { +namespace [[deprecated("syclcompat is deprecated")]] syclcompat { using sycl::ext::oneapi::this_work_item::get_nd_item; diff --git a/sycl/include/syclcompat/kernel.hpp b/sycl/include/syclcompat/kernel.hpp index 511adf8c679f6..286761fe343ce 100644 --- a/sycl/include/syclcompat/kernel.hpp +++ b/sycl/include/syclcompat/kernel.hpp @@ -54,7 +54,7 @@ #include #include -namespace syclcompat { +namespace [[deprecated("syclcompat is deprecated")]] syclcompat { typedef void (*kernel_functor)(sycl::queue &, const sycl::nd_range<3> &, unsigned int, void **, void **); diff --git a/sycl/include/syclcompat/launch.hpp b/sycl/include/syclcompat/launch.hpp index eb5d774bc12d3..83234182c8fee 100644 --- a/sycl/include/syclcompat/launch.hpp +++ b/sycl/include/syclcompat/launch.hpp @@ -33,7 +33,7 @@ #include #include -namespace syclcompat { +namespace [[deprecated("syclcompat is deprecated")]] syclcompat { namespace detail { @@ -120,8 +120,8 @@ launch(const dim3 &grid, const dim3 &threads, Args... args) { } // namespace syclcompat -namespace syclcompat::experimental { - +namespace [[deprecated("syclcompat is deprecated")]] syclcompat { +namespace experimental { namespace detail { template @@ -145,7 +145,6 @@ sycl::event launch(LaunchPolicy launch_policy, sycl::queue q, Args... args) { } }); } - } @@ -161,4 +160,5 @@ sycl::event launch(LaunchPolicy launch_policy, Args... args) { return launch(launch_policy, get_default_queue(), args...); } -} // namespace syclcompat::experimental +} // namespace experimental +} // namespace syclcompat diff --git a/sycl/include/syclcompat/launch_policy.hpp b/sycl/include/syclcompat/launch_policy.hpp index eca71e9ba4393..13980d03c93c9 100644 --- a/sycl/include/syclcompat/launch_policy.hpp +++ b/sycl/include/syclcompat/launch_policy.hpp @@ -34,7 +34,7 @@ #include #include -namespace syclcompat { +namespace [[deprecated("syclcompat is deprecated")]] syclcompat { namespace experimental { namespace sycl_exp = sycl::ext::oneapi::experimental; diff --git a/sycl/include/syclcompat/math.hpp b/sycl/include/syclcompat/math.hpp index eb82c98f445c1..f70a2b0dcb085 100644 --- a/sycl/include/syclcompat/math.hpp +++ b/sycl/include/syclcompat/math.hpp @@ -46,7 +46,7 @@ #include #include -namespace syclcompat { +namespace [[deprecated("syclcompat is deprecated")]] syclcompat { namespace detail { namespace complex_namespace = sycl::ext::oneapi::experimental; diff --git a/sycl/include/syclcompat/memory.hpp b/sycl/include/syclcompat/memory.hpp index 200d80247ec64..7fc21fec8d2d4 100644 --- a/sycl/include/syclcompat/memory.hpp +++ b/sycl/include/syclcompat/memory.hpp @@ -66,7 +66,7 @@ #error "Only support Windows and Linux." #endif -namespace syclcompat { +namespace [[deprecated("syclcompat is deprecated")]] syclcompat { template #ifdef __SYCL_DEVICE_ONLY__ diff --git a/sycl/include/syclcompat/syclcompat.hpp b/sycl/include/syclcompat/syclcompat.hpp index c4c3274ca8dee..93a3eb81d0f15 100644 --- a/sycl/include/syclcompat/syclcompat.hpp +++ b/sycl/include/syclcompat/syclcompat.hpp @@ -22,6 +22,24 @@ #pragma once +// MSVC ignores [[deprecated]] attribute on namespace unless compiled with +// /W3 or above. +#ifdef _MSC_VER +#define __SYCLCOMPAT_STRINGIFY(x) #x +#define __SYCLCOMPAT_TOSTRING(x) __SYCLCOMPAT_STRINGIFY(x) + +#define __SYCLCOMPAT_WARNING(msg) \ + __pragma(message(__FILE__ \ + "(" __SYCLCOMPAT_TOSTRING(__LINE__) "): warning: " msg)) + +__SYCLCOMPAT_WARNING("syclcompat is deprecated and the deprecation warnings " + "are ignored unless compiled with /W3 or above.") + +#undef __SYCLCOMPAT_WARNING +#undef __SYCLCOMPAT_TOSTRING +#undef __SYCLCOMPAT_STRINGIFY +#endif + #include #include #include diff --git a/sycl/include/syclcompat/traits.hpp b/sycl/include/syclcompat/traits.hpp index 30719b376ae43..f50521471b7ee 100644 --- a/sycl/include/syclcompat/traits.hpp +++ b/sycl/include/syclcompat/traits.hpp @@ -33,7 +33,7 @@ #include #include -namespace syclcompat { +namespace [[deprecated("syclcompat is deprecated")]] syclcompat { // Equivalent to C++20's std::type_identity (used to create non-deduced // contexts) diff --git a/sycl/include/syclcompat/util.hpp b/sycl/include/syclcompat/util.hpp index 61d805b1bd84b..9d87e365b2140 100644 --- a/sycl/include/syclcompat/util.hpp +++ b/sycl/include/syclcompat/util.hpp @@ -65,7 +65,7 @@ __SYCL_CONVERGENT__ extern SYCL_EXTERNAL __SYCL_EXPORT __spirv_GroupNonUniformShuffleUp(__spv::Scope::Flag, T, unsigned) noexcept; #endif -namespace syclcompat { +namespace [[deprecated("syclcompat is deprecated")]] syclcompat { namespace detail { diff --git a/sycl/test/syclcompat/warnings_deprecated.cpp b/sycl/test/syclcompat/warnings_deprecated.cpp new file mode 100644 index 0000000000000..7feb1d1fab1f1 --- /dev/null +++ b/sycl/test/syclcompat/warnings_deprecated.cpp @@ -0,0 +1,49 @@ +// Test to verify that syclcompat namespace and APIs generate deprecation warnings. + +// REQUIRES: linux +// RUN: %clangxx -fsycl -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note,warning %s -Wall -Wextra + +#include + +int main() { + // Test deprecated namespace + // expected-warning@+1{{'syclcompat' is deprecated}} + syclcompat::dim3 grid(1, 1, 1); + + // expected-warning@+1{{'syclcompat' is deprecated}} + auto queue = syclcompat::get_default_queue(); + + // Test deprecated memory APIs + // expected-warning@+1{{'syclcompat' is deprecated}} + void* ptr = syclcompat::malloc(1024); + + // expected-warning@+1{{'syclcompat' is deprecated}} + syclcompat::free(ptr); + + // Test deprecated utility APIs + // expected-warning@+1{{'syclcompat' is deprecated}} + auto device_count = syclcompat::device_count(); + + // expected-warning@+1{{'syclcompat' is deprecated}} + syclcompat::wait(); + + // Test deprecated atomic APIs + int value = 42; + int operand = 10; + // expected-warning@+1{{'syclcompat' is deprecated}} + syclcompat::atomic_fetch_add(&value, operand); + + // Test deprecated math APIs + // expected-warning@+1{{'syclcompat' is deprecated}} + auto result = syclcompat::max(1, 2); + + // Test deprecated device APIs + // expected-warning@+1{{'syclcompat' is deprecated}} + syclcompat::device_info info; + + // Test deprecated experimental APIs + // expected-warning@+1{{'syclcompat' is deprecated}} + syclcompat::experimental::launch_policy my_config(sycl::nd_range<1>{{32}, {32}}); + + return 0; +} diff --git a/sycl/test/syclcompat/warnings_deprecated_msvc.cpp b/sycl/test/syclcompat/warnings_deprecated_msvc.cpp new file mode 100644 index 0000000000000..3d78ff5fa7aaf --- /dev/null +++ b/sycl/test/syclcompat/warnings_deprecated_msvc.cpp @@ -0,0 +1,7 @@ +// Test to verify that syclcompat namespace and APIs generate deprecation warnings. + +// REQUIRES: windows +// RUN: %clangxx -fsycl -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note,warning %s -Wall -Wextra + +// expected-warning@+1{{warning: syclcompat is deprecated and the deprecation warnings are ignored unless compiled with /W3 or above.}} +#include From a83b784d8917f33ea0301f72b2d789ec77a8fc4e Mon Sep 17 00:00:00 2001 From: "Agarwal, Udit" Date: Fri, 22 Aug 2025 19:45:24 +0200 Subject: [PATCH 2/3] git clang format --- sycl/test/syclcompat/warnings_deprecated.cpp | 12 +++++++----- sycl/test/syclcompat/warnings_deprecated_msvc.cpp | 3 ++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/sycl/test/syclcompat/warnings_deprecated.cpp b/sycl/test/syclcompat/warnings_deprecated.cpp index 7feb1d1fab1f1..69937371d78ed 100644 --- a/sycl/test/syclcompat/warnings_deprecated.cpp +++ b/sycl/test/syclcompat/warnings_deprecated.cpp @@ -1,4 +1,5 @@ -// Test to verify that syclcompat namespace and APIs generate deprecation warnings. +// Test to verify that syclcompat namespace and APIs generate deprecation +// warnings. // REQUIRES: linux // RUN: %clangxx -fsycl -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note,warning %s -Wall -Wextra @@ -15,15 +16,15 @@ int main() { // Test deprecated memory APIs // expected-warning@+1{{'syclcompat' is deprecated}} - void* ptr = syclcompat::malloc(1024); - + void *ptr = syclcompat::malloc(1024); + // expected-warning@+1{{'syclcompat' is deprecated}} syclcompat::free(ptr); // Test deprecated utility APIs // expected-warning@+1{{'syclcompat' is deprecated}} auto device_count = syclcompat::device_count(); - + // expected-warning@+1{{'syclcompat' is deprecated}} syclcompat::wait(); @@ -43,7 +44,8 @@ int main() { // Test deprecated experimental APIs // expected-warning@+1{{'syclcompat' is deprecated}} - syclcompat::experimental::launch_policy my_config(sycl::nd_range<1>{{32}, {32}}); + syclcompat::experimental::launch_policy my_config( + sycl::nd_range<1>{{32}, {32}}); return 0; } diff --git a/sycl/test/syclcompat/warnings_deprecated_msvc.cpp b/sycl/test/syclcompat/warnings_deprecated_msvc.cpp index 3d78ff5fa7aaf..d64be96d286f9 100644 --- a/sycl/test/syclcompat/warnings_deprecated_msvc.cpp +++ b/sycl/test/syclcompat/warnings_deprecated_msvc.cpp @@ -1,4 +1,5 @@ -// Test to verify that syclcompat namespace and APIs generate deprecation warnings. +// Test to verify that syclcompat namespace and APIs generate deprecation +// warnings. // REQUIRES: windows // RUN: %clangxx -fsycl -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note,warning %s -Wall -Wextra From 8c1ebd580fd6cc56b5f0a61f0452dac3b3978100 Mon Sep 17 00:00:00 2001 From: "Agarwal, Udit" Date: Mon, 25 Aug 2025 12:40:26 -0700 Subject: [PATCH 3/3] Enable warnings_deprecated.cpp test for windows and remove warnings_deprecated_msvc.cpp test. --- sycl/test/syclcompat/warnings_deprecated.cpp | 1 - sycl/test/syclcompat/warnings_deprecated_msvc.cpp | 8 -------- 2 files changed, 9 deletions(-) delete mode 100644 sycl/test/syclcompat/warnings_deprecated_msvc.cpp diff --git a/sycl/test/syclcompat/warnings_deprecated.cpp b/sycl/test/syclcompat/warnings_deprecated.cpp index 69937371d78ed..65ff03173148e 100644 --- a/sycl/test/syclcompat/warnings_deprecated.cpp +++ b/sycl/test/syclcompat/warnings_deprecated.cpp @@ -1,7 +1,6 @@ // Test to verify that syclcompat namespace and APIs generate deprecation // warnings. -// REQUIRES: linux // RUN: %clangxx -fsycl -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note,warning %s -Wall -Wextra #include diff --git a/sycl/test/syclcompat/warnings_deprecated_msvc.cpp b/sycl/test/syclcompat/warnings_deprecated_msvc.cpp deleted file mode 100644 index d64be96d286f9..0000000000000 --- a/sycl/test/syclcompat/warnings_deprecated_msvc.cpp +++ /dev/null @@ -1,8 +0,0 @@ -// Test to verify that syclcompat namespace and APIs generate deprecation -// warnings. - -// REQUIRES: windows -// RUN: %clangxx -fsycl -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note,warning %s -Wall -Wextra - -// expected-warning@+1{{warning: syclcompat is deprecated and the deprecation warnings are ignored unless compiled with /W3 or above.}} -#include