This is an archive of the discontinued LLVM Phabricator instance.

[mlir][llvm] Add atomic support to the StoreOp.
ClosedPublic

Authored by gysit on Feb 16 2023, 9:07 AM.

Details

Summary

This revision adds atomic support to the StoreOp. It chooses
to print the atomic keywords together with the syncscope and
ordering arguments. The revision also implements verifiers to
ensure the constraints that apply to atomic store operations
are checked.

Depends on D144112

Diff Detail

Event Timeline

gysit created this revision.Feb 16 2023, 9:07 AM
Herald added a project: Restricted Project. · View Herald Transcript
gysit requested review of this revision.Feb 16 2023, 9:07 AM
Dinistro added inline comments.Feb 16 2023, 11:52 PM
mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
918–931

Couldn't this be shared with the load verifier through a helper function? This could be done by passing in a set of parameters or by templating the function, I guess.

gysit added inline comments.Feb 16 2023, 11:56 PM
mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
918–931

I tried to do that. Note that the set of unsupported atomic orderings is different and that the error messages are also custom. Additionally, we can access all the arguments directly. Overall, it seemed nicer to have separate functions in this case.

gysit updated this revision to Diff 498334.Feb 17 2023, 4:42 AM

Factor out some of the verification logic that LoadOp and StoreOp share.

gysit marked an inline comment as done.Feb 17 2023, 4:43 AM
Dinistro accepted this revision.Feb 17 2023, 5:21 AM

LGTM module minor comment.

mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
852

NIT: If I'm not mistaken. ArrayRefs can also be constructed from initialiser lists, correct me if I'm wrong. Assuming this is indeed the case, it would be cleaner to replace SmallVector with ArrayRef here.

919

As above.

This revision is now accepted and ready to land.Feb 17 2023, 5:21 AM
gysit updated this revision to Diff 498377.Feb 17 2023, 7:55 AM

Use initializer lists.

gysit marked 2 inline comments as done.Feb 17 2023, 7:56 AM
This revision was automatically updated to reflect the committed changes.