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
Fix Clang compilation error with Lib ATen for ppc64le #106446
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/106446
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (1 Unrelated Failure)As of commit 5e03048 with merge base acd595e (): UNSTABLE - The following job failed but was likely due to flakiness present on trunk and has been marked as unstable:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
@malfet @XiaobingSuper Hi, please let me know if there is any suggestion or change/comment |
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.
Few remakrs:
- Please specify clang version in PR description and reference some doc explaining why
__attribute((altivec(vector__))
does not work for clang, but works for gcc , and vice versa (i.e. if say gcc-9+ supports__attribute__((vector_size(16))
as alternative to altivec attribute, perhaps entire code can be changed to it - Please explain why
vint64
needs to be defined assigned long long
rather thansigned long
or evenint64_t
? (This would also avoid force castingvec_splats
, wouldn't it?)
#if defined(__clang__) | ||
#if !defined(vec_splats) |
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.
Is there a reason not to combine the two?
#if defined(__clang__) | |
#if !defined(vec_splats) | |
#if defined(__clang__) && !defined(vec_splats) |
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.
No, I will combine it.
#if defined(__clang__) | ||
#if !defined(vec_splats) | ||
C10_ALWAYS_INLINE vint64 vec_splats(const int64_t& a) { | ||
return vec_splats(static_cast<signed long long>(a)); |
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.
Please check that int64_t
and signed long long
are different types, otherwise it feels like a tail recursion.
return vec_splats(static_cast<signed long long>(a)); | |
static_assert(!std::is_same_v<int64_t, signed long long>, "Cast is meaningless here"); | |
return vec_splats(static_cast<signed long long>(a)); |
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.
No it is not different. I will remove the casting.
@@ -37,7 +38,7 @@ class Vectorized<int64_t> { | |||
C10_ALWAYS_INLINE Vectorized(vint64 v1, vint64 v2) : _vec0{v1}, _vec1{v2} {} | |||
C10_ALWAYS_INLINE Vectorized(vbool64 v1, vbool64 v2) : _vecb0{v1}, _vecb1{v2} {} | |||
C10_ALWAYS_INLINE Vectorized(int64_t scalar) | |||
: _vec0{vec_splats(scalar)}, _vec1{vec_splats(scalar)} {} | |||
: _vec0{vec_splats((ElementType)scalar)}, _vec1{(vint64)vec_splats((ElementType)scalar)} {} |
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.
Those casts feel unnecessary after you've defined an overload in vsx_helpers.h
aren't they?
In that case, please remove them
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 have removed them.
@pratiklp00 |
@malfet Hi, I have made the required changes Please review it. |
@pratiklp00 at the very list current form of the change break CI all over the place, can you please fix it? |
@pytorchbot rebase |
@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here |
Successfully rebased |
5a1c00d
to
499f13f
Compare
@pytorchbot merge |
Merge failedReason: This PR needs a If not, please add the To add a label, you can comment to pytorchbot, for example For more information, see Details for Dev Infra teamRaised by workflow job |
@pytorchbot merge -f "Lint is green" |
Merge startedYour change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Please use Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
This patch fixes error while compiling with Clang for ppc64le I have used clang version 15.0.7 Errors are as follow: ``` No matching function for call to 'vec_sel’ No matching function for call to 'vec_splats' Excess elements in scalar initializer Use of undeclared identifier 'vec_vsubudm' Fix for multiple error within int64_t DEFINE_MEMBER_OP_AND_ONE ``` References: - https://releases.llvm.org/9.0.0/tools/clang/docs/AttributeReference.html - https://reviews.llvm.org/D81083 Co-authored-by: Nikita Shulga <2453524+malfet@users.noreply.github.com> Pull Request resolved: pytorch#106446 Approved by: https://github.com/malfet
This patch fixes error while compiling with Clang for ppc64le
I have used clang version 15.0.7
Errors are as follow:
References:
cc @jgong5 @mingfeima @XiaobingSuper @sanchitintel @ashokei @jingxu10