Skip to content
Open
Show file tree
Hide file tree
Changes from 3 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
3 changes: 1 addition & 2 deletions clang/lib/Sema/SemaAvailability.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -621,8 +621,7 @@ static void DoEmitAvailabilityWarning(Sema &S, AvailabilityResult K,
S.getTopMostPointOfInstantiation(ReferringDecl);
bool ShouldAllowWarningInSystemHeader =
InstantiationLoc != Loc &&
!S.getSourceManager().isInSystemHeader(InstantiationLoc) &&
!S.getLangOpts().SYCLIsDevice && !S.getLangOpts().SYCLIsHost;
!S.getSourceManager().isInSystemHeader(InstantiationLoc);
struct AllowWarningInSystemHeaders {
AllowWarningInSystemHeaders(DiagnosticsEngine &E,
bool AllowWarningInSystemHeaders)
Expand Down
8 changes: 4 additions & 4 deletions sycl/include/sycl/accessor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1861,28 +1861,28 @@ class __SYCL_EBO __SYCL_SPECIAL_CLASS __SYCL_TYPE(accessor) accessor :

iterator begin() const noexcept {
return iterator::getBegin(
get_pointer(),
getPointerAdjusted(),
detail::convertToArrayOfN<AdjustedDim, 1>(getMemoryRange()),
getRange<AdjustedDim>(), getOffset<AdjustedDim>());
}

iterator end() const noexcept {
return iterator::getEnd(
get_pointer(),
getPointerAdjusted(),
detail::convertToArrayOfN<AdjustedDim, 1>(getMemoryRange()),
getRange<AdjustedDim>(), getOffset<AdjustedDim>());
}

const_iterator cbegin() const noexcept {
return const_iterator::getBegin(
get_pointer(),
getPointerAdjusted(),
detail::convertToArrayOfN<AdjustedDim, 1>(getMemoryRange()),
getRange<AdjustedDim>(), getOffset<AdjustedDim>());
}

const_iterator cend() const noexcept {
return const_iterator::getEnd(
get_pointer(),
getPointerAdjusted(),
detail::convertToArrayOfN<AdjustedDim, 1>(getMemoryRange()),
getRange<AdjustedDim>(), getOffset<AdjustedDim>());
}
Expand Down
10 changes: 8 additions & 2 deletions sycl/include/sycl/atomic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,11 @@ extern T __spirv_AtomicMax(std::atomic<T> *Ptr, __spv::Scope::Flag,

namespace sycl {
inline namespace _V1 {
namespace detail {

template <typename T, access::address_space addressSpace =
access::address_space::global_space>
class __SYCL2020_DEPRECATED(
"sycl::atomic is deprecated since SYCL 2020") atomic {
class atomic {
friend class atomic<T, access::address_space::global_space>;
static_assert(detail::IsValidAtomicType<T>::value,
"Invalid SYCL atomic type. Valid types are: int, "
Expand Down Expand Up @@ -400,6 +400,12 @@ T atomic_fetch_max(atomic<T, addressSpace> Object, T Operand,
memory_order MemoryOrder = memory_order::relaxed) {
return Object.fetch_max(Operand, MemoryOrder);
}
} // namespace detail
template <typename T, access::address_space addressSpace =
access::address_space::global_space>
using atomic
__SYCL2020_DEPRECATED("sycl::atomic is deprecated since SYCL 2020") =
detail::atomic<T, addressSpace>;

} // namespace _V1
} // namespace sycl
Expand Down
14 changes: 12 additions & 2 deletions sycl/include/sycl/detail/is_device_copyable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,24 @@ struct __SYCL2020_DEPRECATED("This type isn't device copyable in SYCL 2020")
IsDeprecatedDeviceCopyable<T[N]> : IsDeprecatedDeviceCopyable<T> {};

#ifdef __SYCL_DEVICE_ONLY__
// Helper trait to avoid instantiated the deprecated specializations of
// IsDeprecatedDeviceCopyable when is_device_copyable_v<T> is true.
template <typename T, typename = void>
struct IsDeprecatedDeviceCopyableIfNot2020 : std::false_type {};

template <typename T>
struct IsDeprecatedDeviceCopyableIfNot2020<
T, std::enable_if_t<!is_device_copyable_v<T>>>
: detail::IsDeprecatedDeviceCopyable<T> {};

// Checks that the fields of the type T with indices 0 to (NumFieldsToCheck -
// 1) are device copyable.
template <typename T, unsigned NumFieldsToCheck>
struct CheckFieldsAreDeviceCopyable
: CheckFieldsAreDeviceCopyable<T, NumFieldsToCheck - 1> {
using FieldT = decltype(__builtin_field_type(T, NumFieldsToCheck - 1));
static_assert(is_device_copyable_v<FieldT> ||
detail::IsDeprecatedDeviceCopyable<FieldT>::value,
detail::IsDeprecatedDeviceCopyableIfNot2020<FieldT>::value,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This IsDeprecatedDeviceCopyable thing was introduced 3 years ago as a transition measure to temporary preserve old behavior and avoid sudden breakages for end users.

I think it is time we let it go. I will let other reviewers to decide on which path we want to take, but we have two options here:

  • more drastic: drop this legacy check right away
  • less drastic: drop this legacy check in preview breaking changes mode

Considering that we had a deprecation message for it for a while now, I personally think that it is fine to go with the first option and just drop this thing completely right away

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any updates on this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I would prefer that we drop it in a separate patch, just to make it easier to bisect in case it breaks something unintentionally.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I would prefer that we drop it in a separate patch, just to make it easier to bisect in case it breaks something unintentionally.

I have no objections against doing that in a separate PR and I agree that it may be easier for us in a potential future bisect when some customer complains that their code doesn't compile/work anymore

"The specified type is not device copyable");
};

Expand All @@ -120,7 +130,7 @@ struct CheckBasesAreDeviceCopyable
: CheckBasesAreDeviceCopyable<T, NumBasesToCheck - 1> {
using BaseT = decltype(__builtin_base_type(T, NumBasesToCheck - 1));
static_assert(is_device_copyable_v<BaseT> ||
detail::IsDeprecatedDeviceCopyable<BaseT>::value,
detail::IsDeprecatedDeviceCopyableIfNot2020<BaseT>::value,
"The specified type is not device copyable");
};

Expand Down
3 changes: 2 additions & 1 deletion sycl/include/sycl/ext/oneapi/experimental/root_group.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ void group_barrier(ext::oneapi::experimental::root_group<dimensions> G,
// workaround that's not intended to reduce the bar for SPIR-V modules
// acceptance, but rather make a pessimistic case work until we have full
// support for the device barrier built-in from backends.
const auto ChildGroup = ext::oneapi::experimental::this_group<dimensions>();
const auto ChildGroup =
ext::oneapi::this_work_item::get_work_group<dimensions>();
if (ChildGroup.get_group_linear_range() == 1) {
group_barrier(ChildGroup);
} else {
Expand Down
2 changes: 1 addition & 1 deletion sycl/test-e2e/Basic/queue/queue_parallel_for_generic.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %{build} -o %t.out
// RUN: %{build} -Wno-error=deprecated-declarations -o %t.out
// RUN: %{run} %t.out

//=-queue_parallel_for_generic.cpp - SYCL queue parallel_for generic lambda-=//
Expand Down
2 changes: 1 addition & 1 deletion sycl/test-e2e/InorderQueue/in_order_event_release.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// RUN: %{build} -o %t.out
// RUN: %{build} -Wno-error=deprecated-declarations -o %t.out
// RUN: %{run} %t.out

// SYCL ordered queue event release shortcut test
Expand Down
2 changes: 1 addition & 1 deletion sycl/test-e2e/InorderQueue/in_order_kernels.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// RUN: %{build} -o %t.out
// RUN: %{build} -Wno-error=deprecated-declarations -o %t.out
// RUN: %{run} %t.out

// SYCL ordered queue kernel shortcut test
Expand Down
4 changes: 3 additions & 1 deletion sycl/test/warnings/sycl_2020_deprecations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ int main() {
sycl::multi_ptr<int, sycl::access::address_space::global_space,
sycl::access::decorated::yes>
a(nullptr);
// expected-warning@+1 {{'atomic<int, sycl::access::address_space::global_space>' is deprecated: sycl::atomic is deprecated since SYCL 2020}}
// expected-warning@+1 {{'atomic' is deprecated: sycl::atomic is deprecated since SYCL 2020}}
sycl::atomic<int> b(a);

sycl::group<1> group = sycl::detail::Builder::createGroup<1>({8}, {4}, {1});
Expand Down Expand Up @@ -250,6 +250,7 @@ int main() {
// expected-warning@+1{{'local' is deprecated: use `local_accessor` instead}}
sycl::accessor<int, 1, sycl::access::mode::read_write, sycl::target::local>
LocalAcc(sycl::range<1>(1), CGH);
// expected-warning@sycl/pointers.hpp:33 {{'multi_ptr<int, sycl::access::address_space::local_space, sycl::access::decorated::legacy>' is deprecated: decorated::legacy multi_ptr specialization is deprecated since SYCL 2020}}
// expected-warning@+3{{'multi_ptr' is deprecated: multi_ptr construction using target::local specialized accessor is deprecated since SYCL 2020}}
sycl::multi_ptr<int, sycl::access::address_space::local_space,
sycl::access::decorated::no>
Expand All @@ -261,6 +262,7 @@ int main() {
// expected-warning@+1{{'local' is deprecated: use `local_accessor` instead}}
sycl::accessor<const int, 1, sycl::access::mode::read, sycl::target::local>
LocalConstAcc(sycl::range<1>(1), CGH);
// expected-warning@sycl/pointers.hpp:33 {{'multi_ptr<const int, sycl::access::address_space::local_space, sycl::access::decorated::legacy>' is deprecated: decorated::legacy multi_ptr specialization is deprecated since SYCL 2020}}
// expected-warning@+3{{'multi_ptr' is deprecated: multi_ptr construction using target::local specialized accessor is deprecated since SYCL 2020}}
sycl::multi_ptr<const int, sycl::access::address_space::local_space,
sycl::access::decorated::no>
Expand Down