-
Notifications
You must be signed in to change notification settings - Fork 744
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SYCL] Enabling depreacate warnings for sycl #15342
base: sycl
Are you sure you want to change the base?
[SYCL] Enabling depreacate warnings for sycl #15342
Conversation
// 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, |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any updates on this?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FE change LGTM. It is strange that the original commit (reverted here) did not have a FE test though.
@intel/llvm-reviewers-runtime Could you review? |
I think PR description needs to provide more high-level details about what's being done and the history about this change. |
sycl/include/sycl/atomic.hpp
Outdated
template <typename T, access::address_space addressSpace = | ||
access::address_space::global_space> | ||
using atomic __SYCL2020_DEPRECATED("use sycl::atomic_ref instead") = | ||
detail::atomic<T, addressSpace>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs a comment on what issues we're avoiding by introducing this alias.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added comment explaining introduction of this alias.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why can't we switch accessor to use atomic_ref
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
atomic
is deprecated in SYCL 2020 but is still part of the specification. The interfaces in accessor
that use atomic
are also part of the specification and are also deprecated, but because atomic
is deprecated it will cause deprecation warnings as soon as accessor
is instantiated, even if the user does not intend to use the interfaces that use atomic
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure it's the right way forward. @DYNIO-INTEL , can you please extract the current pattern used in the accessor similar to the unit-test from llvm/llvm-project#70353 ? I hope it would be generic enough to fix in the clang itself (without any SYCL specifics). Once done, let @AaronBallman take a look at it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may be able to use if constexpr
to work around the issue, but there are no pragmas or attributes that can help here (that I'm aware of).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the biggest issue is this implicit conversion function as it requires type of atomic
and its instantiated for diagnostic which produces deprecated warning. Is there any way to avoid it? @AaronBallman @aelovikov-intel
template <int Dims = Dimensions,
typename = std::enable_if_t<Dims == 0 &&
AccessMode == access::mode::atomic>>
operator
#ifdef __ENABLE_USM_ADDR_SPACE__
atomic<DataT>
#else
atomic<DataT, AS>
#endif
() const {
const size_t LinearIndex = getLinearIndex(id<AdjustedDim>());
return Test(multi_ptr<DataT, AS, access::decorated::yes>(getQualifiedPtr() +
LinearIndex));
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you provide a standalone godbolt link showing the issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, here it's https://godbolt.org/z/czzMx6Gze
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only answer I have is pretty unsatisfying. I couldn't find a way to do this with if constexpr
because it's really based on the declaration of the member function more than anything. The only thing I could think of is to not deprecate the class but to instead deprecate the interfaces which use the class: https://godbolt.org/z/WzY5cq86G
It's not ideal, but trying to change the behavior to not diagnose the attribute until after overload resolution would be a pretty big undertaking (as I understand it), without a clear path towards how to do it.
// 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, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any updates on this?
This change reverts 8cc6e9e and addresses warnings generated by the SYCL headers as a result.