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] Change vec operators to be friends #12396

Merged
merged 8 commits into from
Feb 8, 2024

Conversation

steffenlarsen
Copy link
Contributor

This commit changes operators for sycl::vec to be defined like they are in the SYCL specification, i.e. friend functions instead of members.

This commit changes operators for sycl::vec to be defined like they are
in the SYCL specification, i.e. friend functions instead of members.

Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
// RUN: %{run} %t.out

// This test currently fails on AMD HIP due to an unresolved memcmp function.
// XFAIL: hip_amd
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@npmiller - It seems that this test fails on AMD HIP due to memcmp. I suspect it might be the vector comparison operators, but I have not reproduced it locally. Once this is merged I will open an issue for it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is that a stdlib memcmp? We haven't added libcxx support for AMD yet so that would make sense.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The error was:

# .---command stderr------------
# | lld: error: undefined hidden symbol: memcmp
# | >>> referenced by lto.tmp:(typeinfo name for main::'lambda163'(sycl::_V1::handler&)::operator()(sycl::_V1::handler&) const::'lambda'())
# | >>> referenced by lto.tmp:(typeinfo name for main::'lambda163'(sycl::_V1::handler&)::operator()(sycl::_V1::handler&) const::'lambda'())
# | >>> referenced by lto.tmp:(typeinfo name for main::'lambda263'(sycl::_V1::handler&)::operator()(sycl::_V1::handler&) const::'lambda'())
# | >>> referenced 1 more times
# | llvm-foreach: 
# | clang++: error: amdgcn-link command failed with exit code 1 (use -v to see invocation)
# `-----------------------------

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah that sounds like it, it's fine to keep it as XFAIL

sycl/test/basic_tests/types.cpp Outdated Show resolved Hide resolved
sycl/include/sycl/types.hpp Show resolved Hide resolved
sycl/test-e2e/Basic/vector/vec_binary_scalar_order.cpp Outdated Show resolved Hide resolved
@steffenlarsen
Copy link
Contributor Author

Friendly ping @intel/llvm-reviewers-runtime @cperkinsintel

1 similar comment
@steffenlarsen
Copy link
Contributor Author

Friendly ping @intel/llvm-reviewers-runtime @cperkinsintel

}
#endif // defined(__INTEL_PREVIEW_BREAKING_CHANGES)

#if !defined(__INTEL_PREVIEW_BREAKING_CHANGES)
Copy link
Contributor

@cperkinsintel cperkinsintel Feb 6, 2024

Choose a reason for hiding this comment

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

we are trying to avoid using #else for long blocks. It makes the closing comment easier to understand.

For example, you've changed this so now it ends like so:

#endif // defined(__INTEL_PREVIEW_BREAKING_CHANGES)

Which would lead the casual reader to think ('oh, this block above is for the preview") which is wrong. The block immediately above is the ELSE clause of the preview.

I know it seems pedantic, but especially with this preview stuff where we have long blocks of semi-repeating code, let's try to avoid #else in long blocks

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Personally, I disagree with that, but it is not a hill I want to die on. We could simply change the comment on the #endif to make it clearer and the #else, I would argue, makes the association clearer between the two blocks. Either way, I've split them up.

Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
@steffenlarsen steffenlarsen merged commit 96073b9 into intel:sycl Feb 8, 2024
12 checks passed
steffenlarsen added a commit to steffenlarsen/llvm that referenced this pull request Feb 9, 2024
This commit does a partial revert of intel#12396
as it is unclear from the specification how these operators should
behave for swizzles.

Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
steffenlarsen added a commit that referenced this pull request Feb 15, 2024
…#12682)

This commit does a partial revert of
#12396. This is to avoid an issue
where the new friend operators wouldn't accept the arguments as l-value
references.

---------

Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
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.

4 participants