Skip to content

Commit 90fbcb1

Browse files
authored
[SYCL][ABI-break] Promote breaking changes related to code location (#20802)
1 parent fe61680 commit 90fbcb1

File tree

7 files changed

+11
-68
lines changed

7 files changed

+11
-68
lines changed

sycl/include/sycl/detail/common.hpp

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@
88

99
#pragma once
1010

11-
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
12-
#ifndef __SYCL_DEVICE_ONLY__
13-
#include <sycl/exception.hpp>
14-
#endif
15-
#endif // #ifndef __INTEL_PREVIEW_BREAKING_CHANGES
1611
#include <sycl/detail/defines_elementary.hpp> // for __SYCL_ALWAYS_INLINE
1712
#include <sycl/detail/export.hpp> // for __SYCL_EXPORT
1813

@@ -101,14 +96,8 @@ struct code_location {
10196
private:
10297
const char *MFileName;
10398
const char *MFunctionName;
104-
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
105-
// For preserving layout of handler class
106-
unsigned long MLineNo;
107-
unsigned long MColumnNo;
108-
#else
10999
uint32_t MLineNo;
110100
uint32_t MColumnNo;
111-
#endif
112101
};
113102

114103
/// @brief Data type that manages the code_location information in TLS
@@ -151,22 +140,9 @@ class __SYCL_EXPORT tls_code_loc_t {
151140
/// @param CodeLoc The code location information to set up the TLS slot with.
152141
tls_code_loc_t(const detail::code_location &CodeLoc);
153142

154-
#ifdef __INTEL_PREVIEW_BREAKING_CHANGES
155143
// Used to maintain global state (GCodeLocTLS), so we do not want to copy
156144
tls_code_loc_t(const tls_code_loc_t &) = delete;
157145
tls_code_loc_t &operator=(const tls_code_loc_t &) = delete;
158-
#else
159-
tls_code_loc_t &operator=(const tls_code_loc_t &) {
160-
// Should never be called. In PREVIEW we marked it as deleted, but
161-
// before ABI breaking change we need to keep it for backward compatibility.
162-
assert(false && "tls_code_loc_t should not be copied");
163-
#ifndef __SYCL_DEVICE_ONLY__
164-
throw sycl::exception(sycl::make_error_code(sycl::errc::invalid),
165-
"tls_code_loc_t should not be copied");
166-
#endif
167-
return *this;
168-
}
169-
#endif // __INTEL_PREVIEW_BREAKING_CHANGES
170146

171147
/// If the code location is set up by this instance, reset it.
172148
~tls_code_loc_t();
@@ -179,10 +155,8 @@ class __SYCL_EXPORT tls_code_loc_t {
179155
bool isToplevel() const { return !MLocalScope; }
180156

181157
private:
182-
#ifdef __INTEL_PREVIEW_BREAKING_CHANGES
183158
// Cache the TLS location to decrease amount of TLS accesses.
184159
detail::code_location &CodeLocTLSRef;
185-
#endif // __INTEL_PREVIEW_BREAKING_CHANGES
186160
// The flag that is used to determine if the object is in a local scope or in
187161
// the top level scope.
188162
bool MLocalScope = true;

sycl/include/sycl/ext/oneapi/experimental/cuda/builtins.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
#define SYCL_EXT_ONEAPI_CUDA_TEX_CACHE_READ 1
1212

13+
#include <sycl/exception.hpp>
1314
#include <sycl/vector.hpp>
1415

1516
#if defined(_WIN32) || defined(_WIN64)

sycl/source/detail/common.cpp

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,10 @@ static thread_local detail::code_location GCodeLocTLS = {};
2424
/// check and see if code location object is available. If not, continue with
2525
/// instrumentation as needed
2626
tls_code_loc_t::tls_code_loc_t()
27-
#ifdef __INTEL_PREVIEW_BREAKING_CHANGES
2827
: CodeLocTLSRef(GCodeLocTLS),
2928
// Check TLS to see if a previously stashed code_location object is
3029
// available; if so, we are in a local scope.
31-
MLocalScope(CodeLocTLSRef.fileName() && CodeLocTLSRef.functionName())
32-
#else
33-
: // Check TLS to see if a previously stashed code_location object is
34-
// available; if so, we are in a local scope.
35-
MLocalScope(GCodeLocTLS.fileName() && GCodeLocTLS.functionName())
36-
#endif // __INTEL_PREVIEW_BREAKING_CHANGES
37-
{
38-
}
30+
MLocalScope(CodeLocTLSRef.fileName() && CodeLocTLSRef.functionName()) {}
3931

4032
ur_code_location_t codeLocationCallback(void *) {
4133
ur_code_location_t codeloc;
@@ -53,7 +45,6 @@ ur_code_location_t codeLocationCallback(void *) {
5345
/// location has been stashed in the TLS at a higher level. If not, we have the
5446
/// code location information that must be active for the current calling scope.
5547
tls_code_loc_t::tls_code_loc_t(const detail::code_location &CodeLoc)
56-
#ifdef __INTEL_PREVIEW_BREAKING_CHANGES
5748
: CodeLocTLSRef(GCodeLocTLS),
5849
// Check TLS to see if a previously stashed code_location object is
5950
// 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)
6253
if (!MLocalScope)
6354
// Update the TLS information with the code_location information
6455
CodeLocTLSRef = CodeLoc;
65-
#else
66-
: // Check TLS to see if a previously stashed code_location object is
67-
// available; if so, then don't overwrite the previous information as we
68-
// are still in scope of the instrumented function.
69-
MLocalScope(GCodeLocTLS.fileName() && GCodeLocTLS.functionName()) {
70-
if (!MLocalScope)
71-
// Update the TLS information with the code_location information
72-
GCodeLocTLS = CodeLoc;
73-
#endif // __INTEL_PREVIEW_BREAKING_CHANGES
7456
}
7557

7658
/// @brief If we are the top lovel scope, reset the code location info
7759
tls_code_loc_t::~tls_code_loc_t() {
7860
// Only reset the TLS data if the top level function is going out of scope
7961
if (!MLocalScope) {
80-
#ifdef __INTEL_PREVIEW_BREAKING_CHANGES
8162
CodeLocTLSRef = {};
82-
#else
83-
GCodeLocTLS = {};
84-
#endif // __INTEL_PREVIEW_BREAKING_CHANGES
8563
}
8664
}
8765

88-
const detail::code_location &tls_code_loc_t::query() {
89-
#ifdef __INTEL_PREVIEW_BREAKING_CHANGES
90-
return CodeLocTLSRef;
91-
#else
92-
return GCodeLocTLS;
93-
#endif // __INTEL_PREVIEW_BREAKING_CHANGES
94-
}
66+
const detail::code_location &tls_code_loc_t::query() { return CodeLocTLSRef; }
9567

9668
} // namespace detail
9769
} // namespace _V1

sycl/test/abi/layout_handler.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ void foo() {
6565
// CHECK-NEXT: 144 | struct sycl::detail::code_location MCodeLoc
6666
// CHECK-NEXT: 144 | const char * MFileName
6767
// CHECK-NEXT: 152 | const char * MFunctionName
68-
// CHECK-NEXT: 160 | unsigned long MLineNo
69-
// CHECK-NEXT: 168 | unsigned long MColumnNo
70-
// CHECK-NEXT: | [sizeof=176, dsize=176, align=8,
71-
// CHECK-NEXT: | nvsize=176, nvalign=8]
68+
// CHECK-NEXT: 160 | uint32_t MLineNo
69+
// CHECK-NEXT: 164 | uint32_t MColumnNo
70+
// CHECK-NEXT: | [sizeof=168, dsize=168, align=8,
71+
// CHECK-NEXT: | nvsize=168, nvalign=8]
7272
// clang-format on

sycl/test/abi/layout_tls_code_loc_t.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
void foo(sycl::detail::tls_code_loc_t) {}
1010

1111
// CHECK: 0 | class sycl::detail::tls_code_loc_t
12-
// CHECK-NEXT: 0 | _Bool MLocalScope
13-
// CHECK-NEXT: | [sizeof=1, dsize=1, align=1,
14-
// CHECK-NEXT: | nvsize=1, nvalign=1]
12+
// CHECK-NEXT: 0 | detail::code_location & CodeLocTLSRef
13+
// CHECK-NEXT: 8 | _Bool MLocalScope
14+
// CHECK-NEXT: | [sizeof=16, dsize=9, align=8,
15+
// CHECK-NEXT: | nvsize=9, nvalign=8]

sycl/test/abi/sycl_symbols_windows.dump

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,6 @@
586586
??4sampler@_V1@sycl@@QEAAAEAV012@AEBV012@@Z
587587
??4stream@_V1@sycl@@QEAAAEAV012@$$QEAV012@@Z
588588
??4stream@_V1@sycl@@QEAAAEAV012@AEBV012@@Z
589-
??4tls_code_loc_t@detail@_V1@sycl@@QEAAAEAV0123@AEBV0123@@Z
590589
??8context@_V1@sycl@@QEBA_NAEBV012@@Z
591590
??8device@_V1@sycl@@QEBA_NAEBV012@@Z
592591
??8device_image_plain@detail@_V1@sycl@@QEBA_NAEBV0123@@Z

sycl/test/abi/symbol_size_alignment.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,7 @@ int main() {
5252
check<device_selector, 8, 8>();
5353
check<event, 16, 8>();
5454
check<gpu_selector, 8, 8>();
55-
#ifdef _MSC_VER
5655
check<handler, 168, 8>();
57-
#else
58-
check<handler, 176, 8>();
59-
#endif
6056
check<image<1>, 16, 8>();
6157
check<kernel, 16, 8>();
6258
check<detail::nd_range_view, 32, 8>();

0 commit comments

Comments
 (0)