From f590b045c7f1520139e6a9ff3220ad2a796616ab Mon Sep 17 00:00:00 2001 From: Artur Gainullin Date: Tue, 2 Dec 2025 11:42:08 -0800 Subject: [PATCH] [SYCL][ABI-breaking] Promote breaking changes related to code location --- sycl/include/sycl/detail/common.hpp | 26 --------------- .../ext/oneapi/experimental/cuda/builtins.hpp | 1 + sycl/source/detail/common.cpp | 32 ++----------------- sycl/test/abi/layout_handler.cpp | 8 ++--- sycl/test/abi/layout_tls_code_loc_t.cpp | 7 ++-- sycl/test/abi/sycl_symbols_windows.dump | 1 - sycl/test/abi/symbol_size_alignment.cpp | 4 --- 7 files changed, 11 insertions(+), 68 deletions(-) diff --git a/sycl/include/sycl/detail/common.hpp b/sycl/include/sycl/detail/common.hpp index a0476e21657a7..27e2b0560e81e 100644 --- a/sycl/include/sycl/detail/common.hpp +++ b/sycl/include/sycl/detail/common.hpp @@ -8,11 +8,6 @@ #pragma once -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES -#ifndef __SYCL_DEVICE_ONLY__ -#include -#endif -#endif // #ifndef __INTEL_PREVIEW_BREAKING_CHANGES #include // for __SYCL_ALWAYS_INLINE #include // for __SYCL_EXPORT @@ -101,14 +96,8 @@ struct code_location { private: const char *MFileName; const char *MFunctionName; -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES - // For preserving layout of handler class - unsigned long MLineNo; - unsigned long MColumnNo; -#else uint32_t MLineNo; uint32_t MColumnNo; -#endif }; /// @brief Data type that manages the code_location information in TLS @@ -151,22 +140,9 @@ class __SYCL_EXPORT tls_code_loc_t { /// @param CodeLoc The code location information to set up the TLS slot with. tls_code_loc_t(const detail::code_location &CodeLoc); -#ifdef __INTEL_PREVIEW_BREAKING_CHANGES // Used to maintain global state (GCodeLocTLS), so we do not want to copy tls_code_loc_t(const tls_code_loc_t &) = delete; tls_code_loc_t &operator=(const tls_code_loc_t &) = delete; -#else - tls_code_loc_t &operator=(const tls_code_loc_t &) { - // Should never be called. In PREVIEW we marked it as deleted, but - // before ABI breaking change we need to keep it for backward compatibility. - assert(false && "tls_code_loc_t should not be copied"); -#ifndef __SYCL_DEVICE_ONLY__ - throw sycl::exception(sycl::make_error_code(sycl::errc::invalid), - "tls_code_loc_t should not be copied"); -#endif - return *this; - } -#endif // __INTEL_PREVIEW_BREAKING_CHANGES /// If the code location is set up by this instance, reset it. ~tls_code_loc_t(); @@ -179,10 +155,8 @@ class __SYCL_EXPORT tls_code_loc_t { bool isToplevel() const { return !MLocalScope; } private: -#ifdef __INTEL_PREVIEW_BREAKING_CHANGES // Cache the TLS location to decrease amount of TLS accesses. detail::code_location &CodeLocTLSRef; -#endif // __INTEL_PREVIEW_BREAKING_CHANGES // The flag that is used to determine if the object is in a local scope or in // the top level scope. bool MLocalScope = true; diff --git a/sycl/include/sycl/ext/oneapi/experimental/cuda/builtins.hpp b/sycl/include/sycl/ext/oneapi/experimental/cuda/builtins.hpp index e0b8fbb861e0a..fc9638c382cc5 100644 --- a/sycl/include/sycl/ext/oneapi/experimental/cuda/builtins.hpp +++ b/sycl/include/sycl/ext/oneapi/experimental/cuda/builtins.hpp @@ -10,6 +10,7 @@ #define SYCL_EXT_ONEAPI_CUDA_TEX_CACHE_READ 1 +#include #include #if defined(_WIN32) || defined(_WIN64) diff --git a/sycl/source/detail/common.cpp b/sycl/source/detail/common.cpp index f05b37d9986ce..1c7669bbf3652 100644 --- a/sycl/source/detail/common.cpp +++ b/sycl/source/detail/common.cpp @@ -24,18 +24,10 @@ static thread_local detail::code_location GCodeLocTLS = {}; /// check and see if code location object is available. If not, continue with /// instrumentation as needed tls_code_loc_t::tls_code_loc_t() -#ifdef __INTEL_PREVIEW_BREAKING_CHANGES : CodeLocTLSRef(GCodeLocTLS), // Check TLS to see if a previously stashed code_location object is // available; if so, we are in a local scope. - MLocalScope(CodeLocTLSRef.fileName() && CodeLocTLSRef.functionName()) -#else - : // Check TLS to see if a previously stashed code_location object is - // available; if so, we are in a local scope. - MLocalScope(GCodeLocTLS.fileName() && GCodeLocTLS.functionName()) -#endif // __INTEL_PREVIEW_BREAKING_CHANGES -{ -} + MLocalScope(CodeLocTLSRef.fileName() && CodeLocTLSRef.functionName()) {} ur_code_location_t codeLocationCallback(void *) { ur_code_location_t codeloc; @@ -53,7 +45,6 @@ ur_code_location_t codeLocationCallback(void *) { /// location has been stashed in the TLS at a higher level. If not, we have the /// code location information that must be active for the current calling scope. tls_code_loc_t::tls_code_loc_t(const detail::code_location &CodeLoc) -#ifdef __INTEL_PREVIEW_BREAKING_CHANGES : CodeLocTLSRef(GCodeLocTLS), // Check TLS to see if a previously stashed code_location object is // available; if so, then don't overwrite the previous information as we @@ -62,36 +53,17 @@ tls_code_loc_t::tls_code_loc_t(const detail::code_location &CodeLoc) if (!MLocalScope) // Update the TLS information with the code_location information CodeLocTLSRef = CodeLoc; -#else - : // Check TLS to see if a previously stashed code_location object is - // available; if so, then don't overwrite the previous information as we - // are still in scope of the instrumented function. - MLocalScope(GCodeLocTLS.fileName() && GCodeLocTLS.functionName()) { - if (!MLocalScope) - // Update the TLS information with the code_location information - GCodeLocTLS = CodeLoc; -#endif // __INTEL_PREVIEW_BREAKING_CHANGES } /// @brief If we are the top lovel scope, reset the code location info tls_code_loc_t::~tls_code_loc_t() { // Only reset the TLS data if the top level function is going out of scope if (!MLocalScope) { -#ifdef __INTEL_PREVIEW_BREAKING_CHANGES CodeLocTLSRef = {}; -#else - GCodeLocTLS = {}; -#endif // __INTEL_PREVIEW_BREAKING_CHANGES } } -const detail::code_location &tls_code_loc_t::query() { -#ifdef __INTEL_PREVIEW_BREAKING_CHANGES - return CodeLocTLSRef; -#else - return GCodeLocTLS; -#endif // __INTEL_PREVIEW_BREAKING_CHANGES -} +const detail::code_location &tls_code_loc_t::query() { return CodeLocTLSRef; } } // namespace detail } // namespace _V1 diff --git a/sycl/test/abi/layout_handler.cpp b/sycl/test/abi/layout_handler.cpp index 8c749786fd67e..7f4cb8248530a 100644 --- a/sycl/test/abi/layout_handler.cpp +++ b/sycl/test/abi/layout_handler.cpp @@ -65,8 +65,8 @@ void foo() { // CHECK-NEXT: 144 | struct sycl::detail::code_location MCodeLoc // CHECK-NEXT: 144 | const char * MFileName // CHECK-NEXT: 152 | const char * MFunctionName -// CHECK-NEXT: 160 | unsigned long MLineNo -// CHECK-NEXT: 168 | unsigned long MColumnNo -// CHECK-NEXT: | [sizeof=176, dsize=176, align=8, -// CHECK-NEXT: | nvsize=176, nvalign=8] +// CHECK-NEXT: 160 | uint32_t MLineNo +// CHECK-NEXT: 164 | uint32_t MColumnNo +// CHECK-NEXT: | [sizeof=168, dsize=168, align=8, +// CHECK-NEXT: | nvsize=168, nvalign=8] // clang-format on \ No newline at end of file diff --git a/sycl/test/abi/layout_tls_code_loc_t.cpp b/sycl/test/abi/layout_tls_code_loc_t.cpp index ec1ffc18feb97..0c5dfd8f6ee8e 100644 --- a/sycl/test/abi/layout_tls_code_loc_t.cpp +++ b/sycl/test/abi/layout_tls_code_loc_t.cpp @@ -9,6 +9,7 @@ void foo(sycl::detail::tls_code_loc_t) {} // CHECK: 0 | class sycl::detail::tls_code_loc_t -// CHECK-NEXT: 0 | _Bool MLocalScope -// CHECK-NEXT: | [sizeof=1, dsize=1, align=1, -// CHECK-NEXT: | nvsize=1, nvalign=1] +// CHECK-NEXT: 0 | detail::code_location & CodeLocTLSRef +// CHECK-NEXT: 8 | _Bool MLocalScope +// CHECK-NEXT: | [sizeof=16, dsize=9, align=8, +// CHECK-NEXT: | nvsize=9, nvalign=8] diff --git a/sycl/test/abi/sycl_symbols_windows.dump b/sycl/test/abi/sycl_symbols_windows.dump index cac88ba890cfd..3c88d2e374a7c 100644 --- a/sycl/test/abi/sycl_symbols_windows.dump +++ b/sycl/test/abi/sycl_symbols_windows.dump @@ -627,7 +627,6 @@ ??4sampler@_V1@sycl@@QEAAAEAV012@AEBV012@@Z ??4stream@_V1@sycl@@QEAAAEAV012@$$QEAV012@@Z ??4stream@_V1@sycl@@QEAAAEAV012@AEBV012@@Z -??4tls_code_loc_t@detail@_V1@sycl@@QEAAAEAV0123@AEBV0123@@Z ??8context@_V1@sycl@@QEBA_NAEBV012@@Z ??8device@_V1@sycl@@QEBA_NAEBV012@@Z ??8device_image_plain@detail@_V1@sycl@@QEBA_NAEBV0123@@Z diff --git a/sycl/test/abi/symbol_size_alignment.cpp b/sycl/test/abi/symbol_size_alignment.cpp index 5f0279580e657..41466d5dd6b2a 100644 --- a/sycl/test/abi/symbol_size_alignment.cpp +++ b/sycl/test/abi/symbol_size_alignment.cpp @@ -52,11 +52,7 @@ int main() { check(); check(); check(); -#ifdef _MSC_VER check(); -#else - check(); -#endif check, 16, 8>(); check(); check();