This is an archive of the discontinued LLVM Phabricator instance.

[mlir][llvm] Add extra attributes to the atomic ops.
ClosedPublic

Authored by gysit on Feb 7 2023, 11:20 PM.

Details

Summary

The revision adds a number of extra arguments to the
atomic read modify write and compare and exchange
operations. The extra arguments include the volatile,
weak, syncscope, and alignment attributes.

The implementation also adapts the fence operation to use
a assembly format and generalizes the helper used
to obtain the syncscope name.

Diff Detail

Event Timeline

gysit created this revision.Feb 7 2023, 11:20 PM
Herald added a project: Restricted Project. · View Herald Transcript
gysit requested review of this revision.Feb 7 2023, 11:20 PM
Dinistro added inline comments.Feb 8 2023, 1:50 AM
mlir/lib/Target/LLVMIR/ModuleImport.cpp
107

Might it make sense to change the return type to std::optional<StringRef> to make it clear that some instructions do not have a syncscope?

gysit added inline comments.Feb 8 2023, 2:12 AM
mlir/lib/Target/LLVMIR/ModuleImport.cpp
107

I originally implemented a variant of the method that returns an optional StringRef. However, LLVM uses the empty string to model system level synchronization. I thus decided to consistently use the empty string as "no syncscope" value which is also inline with the already existing fence operation implementation.

I can add a comment that clarifies that the default value of the syncscope name is the empty string and that we do not want to print this default value.

gysit updated this revision to Diff 495774.Feb 8 2023, 2:36 AM

Rebase and add comment addressing the review concern.

Dinistro accepted this revision.Feb 8 2023, 3:34 AM

Thanks for clarifying the syncscope handling. LGTM!

This revision is now accepted and ready to land.Feb 8 2023, 3:34 AM
This revision was automatically updated to reflect the committed changes.