This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC][AIX] Enable quadword atomics by default for AIX
ClosedPublic

Authored by lkail on May 24 2023, 2:05 AM.

Details

Summary

On AIX, a libatomic supporting inline quadword atomic operations has been released, so that compatibility is not an issue now, we can enable quadword atomics by default.

Diff Detail

Event Timeline

lkail created this revision.May 24 2023, 2:05 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 24 2023, 2:05 AM
lkail requested review of this revision.May 24 2023, 2:05 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 24 2023, 2:05 AM
llvm/lib/Target/PowerPC/PPCISelLowering.cpp
18476–18477

With this, turning off EnableQuadwordAtomics will have an effect for non-AIX platforms. I think this function should be left alone (except for updating the comment to say that the ability to turn off quadword atomics for AIX is a historical artifact).

lkail added inline comments.Jul 3 2023, 9:54 PM
llvm/lib/Target/PowerPC/PPCISelLowering.cpp
18476–18477

That's a good point. Will update the comment.

lkail updated this revision to Diff 536951.Jul 3 2023, 10:19 PM

Address comments.

llvm/lib/Target/PowerPC/PPCISelLowering.cpp
18476–18477

I meant that perhaps the functionality should be left the same as before? Otherwise, the scope of the patch is bigger than necessary (and tests may need expansion).

lkail added inline comments.Jul 3 2023, 11:06 PM
llvm/lib/Target/PowerPC/PPCISelLowering.cpp
18476–18477

Is it still necessary to keep EnableQuadwordAtomics(and defaults to true) for AIX? Since the updated libatomic is already delivered, I don't see the essentiality to keep it.

lkail updated this revision to Diff 536971.Jul 4 2023, 12:19 AM
llvm/lib/Target/PowerPC/PPCISelLowering.cpp
18476–18477

It is my understanding that the minimum requirements for the libatomic that has lock-free quadword atomics enabled is the same as that for Clang/LLVM on AIX in general, right? I would then agree that we may not need EnableQuadwordAtomics anymore; however, I think the patch here should update the LLVM release notes to indicate what version of the libatomic library in required.

If I am not mistaken, the libatomic functionality that is needed is (at least currently) available only as part of the (redistributable) IBM Open XL runtimes.

lkail added inline comments.Jul 4 2023, 7:24 PM
llvm/lib/Target/PowerPC/PPCISelLowering.cpp
18476–18477

the minimum requirements for the libatomic that has lock-free quadword atomics enabled is the same as that for Clang/LLVM on AIX in general, right?

Yes. Should be at least 64-bit AIX and power8 cpu.

the libatomic functionality that is needed is (at least currently) available only as part of the (redistributable) IBM Open XL runtimes.

Yes, the libatomic in the context is the one in IBM Open XL runtimes. Is it appropriate to mention this libatomic, which is IBM branded, in LLVM's release notes?

llvm/lib/Target/PowerPC/PPCISelLowering.cpp
18476–18477

the minimum requirements for the libatomic that has lock-free quadword atomics enabled is the same as that for Clang/LLVM on AIX in general, right?

Yes. Should be at least 64-bit AIX and power8 cpu.

I meant whether the libatomic would install on AIX 7.2 TL5 SP3.

the libatomic functionality that is needed is (at least currently) available only as part of the (redistributable) IBM Open XL runtimes.

Yes, the libatomic in the context is the one in IBM Open XL runtimes. Is it appropriate to mention this libatomic, which is IBM branded, in LLVM's release notes?

I don't see how it would be different than saying that you need some version of AIX or higher.

lkail updated this revision to Diff 537203.Jul 4 2023, 8:19 PM

Removed -ppc-quadword-atomics and updated release notes.

llvm/docs/ReleaseNotes.rst
223–224

Can you add info on package name and version needed?

lkail updated this revision to Diff 537210.Jul 4 2023, 9:26 PM

Add package name and version.

llvm/docs/ReleaseNotes.rst
223

Minor nit: s/os/OS;

llvm/lib/Target/PowerPC/PPCISelLowering.cpp
18477–18478

Comment can now be removed entirely. It speaks to code that is no longer present.

lkail updated this revision to Diff 537215.Jul 4 2023, 10:03 PM

Removed comment.

@lkail, I have no further comments (but I have not reviewed the instruction sequences generated). Can you find another reviewer to review the instruction sequences? Otherwise, if you are confident that the instruction sequences are well-tested (e.g., because libatomic dependent upon these sequences has been deployed), I am willing to approve with your confirmation.

brad added a subscriber: brad.Jul 22 2023, 10:42 PM

It would be nice to get this in for 17.

This revision is now accepted and ready to land.Jul 23 2023, 11:53 PM
lkail added a comment.Jul 24 2023, 4:52 AM

@nemanjai Much appreciated! Gentle ping @hubert.reinterpretcast. I've also tested it via compiler-rt/test/builtins/Unit/atomic_test.c which passed.

As I said, I had no further comments. Please go ahead and land since the patch has been approved.

This revision was landed with ongoing or failed builds.Jul 24 2023, 5:21 PM
This revision was automatically updated to reflect the committed changes.