This is an archive of the discontinued LLVM Phabricator instance.

[mlir][OpenMP] Added translation from `omp.atomic.capture` to LLVM IR
ClosedPublic

Authored by shraiysh on Mar 13 2022, 9:26 AM.

Details

Summary

This patch adds translation from omp.atomic.capture to LLVM IR. Also
added tests for the same.

Depends on D121546

Diff Detail

Event Timeline

shraiysh created this revision.Mar 13 2022, 9:26 AM
Herald added a project: Restricted Project. · View Herald Transcript
shraiysh requested review of this revision.Mar 13 2022, 9:26 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald Transcript
ftynse added inline comments.Mar 14 2022, 5:42 AM
mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
721

Most places use Operation *, let's do the same here for consistency.

773–777

Please add at least some documentation to these methods.

778–779

It's unclear to be what "x" and "v" mean in this context. Given the trivial bodies of these functions, I would just drop them in favor of getAtomicReadOp().x().

mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
1118

Concrete Ops must be passed by value.

1143–1146

Please provide a test for user-visible error messages.

mlir/test/Target/LLVMIR/openmp-llvm.mlir
1072–1073

Do we really care about this code being on the next line? If not, please drop -NEXT.

shraiysh updated this revision to Diff 416184.Mar 17 2022, 8:16 AM
shraiysh marked 5 inline comments as done.

Thanks for the review @ftynse. Addressed comments.

ftynse accepted this revision.Mar 21 2022, 2:24 AM
ftynse added inline comments.
mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
1166

Optional nit: the RHS expression ending by a cast is a legit case for using auto (inferred type is obvious from local context).

This revision is now accepted and ready to land.Mar 21 2022, 2:24 AM
shraiysh updated this revision to Diff 416884.Mar 21 2022, 3:58 AM

Thanks for the review @ftynse. Addressed comment.

This revision was landed with ongoing or failed builds.Mar 21 2022, 4:09 AM
This revision was automatically updated to reflect the committed changes.
rriddle added inline comments.Mar 28 2022, 5:46 PM
mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
1210

This is leaking memory, remove doesn't erase the instruction.

Thanks for pointing this out @rriddle. Addressed this in D122633.