Skip to content
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

Open
wants to merge 19 commits into
base: sycl
Choose a base branch
from

Conversation

DYNIO-INTEL
Copy link
Contributor

This change reverts 8cc6e9e and addresses warnings generated by the SYCL headers as a result.

sycl/test/warnings/sycl_2020_deprecations.cpp Outdated Show resolved Hide resolved
// 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

@DYNIO-INTEL DYNIO-INTEL marked this pull request as ready for review September 16, 2024 11:54
@DYNIO-INTEL DYNIO-INTEL requested review from a team as code owners September 16, 2024 11:54
Copy link
Contributor

@elizabethandrews elizabethandrews left a 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.

@DYNIO-INTEL
Copy link
Contributor Author

@intel/llvm-reviewers-runtime Could you review?

@aelovikov-intel
Copy link
Contributor

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/accessor.hpp Show resolved Hide resolved
Comment on lines 404 to 407
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>;
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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?

Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Contributor

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).

Copy link
Contributor Author

@DYNIO-INTEL DYNIO-INTEL Nov 7, 2024

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));
  }

Copy link
Contributor

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?

Copy link
Contributor Author

@DYNIO-INTEL DYNIO-INTEL Nov 7, 2024

Choose a reason for hiding this comment

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

Copy link
Contributor

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,
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?

sycl/test-e2e/SubGroup/sub_group_as_vec.cpp Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants