Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 0 additions & 26 deletions sycl/include/sycl/detail/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@

#pragma once

#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
#ifndef __SYCL_DEVICE_ONLY__
#include <sycl/exception.hpp>
#endif
#endif // #ifndef __INTEL_PREVIEW_BREAKING_CHANGES
#include <sycl/detail/defines_elementary.hpp> // for __SYCL_ALWAYS_INLINE
#include <sycl/detail/export.hpp> // for __SYCL_EXPORT

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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();
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#define SYCL_EXT_ONEAPI_CUDA_TEX_CACHE_READ 1

#include <sycl/exception.hpp>
#include <sycl/vector.hpp>

#if defined(_WIN32) || defined(_WIN64)
Expand Down
32 changes: 2 additions & 30 deletions sycl/source/detail/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions sycl/test/abi/layout_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 4 additions & 3 deletions sycl/test/abi/layout_tls_code_loc_t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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]
1 change: 0 additions & 1 deletion sycl/test/abi/sycl_symbols_windows.dump
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions sycl/test/abi/symbol_size_alignment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,7 @@ int main() {
check<device_selector, 8, 8>();
check<event, 16, 8>();
check<gpu_selector, 8, 8>();
#ifdef _MSC_VER
check<handler, 168, 8>();
#else
check<handler, 176, 8>();
#endif
check<image<1>, 16, 8>();
check<kernel, 16, 8>();
check<detail::nd_range_view, 32, 8>();
Expand Down