This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP][IRBuilder] Handle floats for atomic update and fix AllocaIP for update/capture
ClosedPublic

Authored by shraiysh on Jan 26 2022, 1:40 AM.

Details

Summary

This patch fixes createAtomicUpdate for lowering with float types.
Test added for the same.

This patch also changes the alloca argument for createAtomicUpdate and
createAtomicCapture from Instruction* to InsertPointTy. This is in
line with the other functions of the OpenMPIRBuilder class which take
AllocaIP as an InsertPointTy.

Diff Detail

Event Timeline

shraiysh created this revision.Jan 26 2022, 1:40 AM
shraiysh requested review of this revision.Jan 26 2022, 1:40 AM
Herald added a project: Restricted Project. · View Herald Transcript

This is actually a WIP. (Apologies for adding all the reviewers so early). As I am working on the lowering for omp.atomic.update in the OpenMP Dialect (MLIR), I might find other issues with the createAtomicUpdate function along the way. I will ping this thread once it is ready for review. Thanks!

Meinersbur retitled this revision from [OpenMP][IRBuilder] Fix AllocIP for atomic update and capture to [OpenMP][IRBuilder] Fix AllocIP for atomic update and capture [WIP].Jan 27 2022, 7:22 AM

I added a [WIP] into the title. Please remove it once you think it is ready.

shraiysh updated this revision to Diff 405614.EditedFeb 3 2022, 6:30 AM

Fix createAtomicUpdate for lowering float types. This fix is now ready for review.

shraiysh retitled this revision from [OpenMP][IRBuilder] Fix AllocIP for atomic update and capture [WIP] to [OpenMP][IRBuilder] Fix AllocIP for atomic update and capture.Feb 3 2022, 6:31 AM
shraiysh edited the summary of this revision. (Show Details)

The title is "Fix AllocIP for atomic update and capture", but reading the summary the main motivation seems to be to fix createAtomicUpdate for floats.

llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
3301–3303

Is this move relevant?

If this is due to AllocaIP and Loc.IP being the same, you could take the occasion and check that they are different since is would be ambiguous which one is "first". See isConflictIP in D117226.

shraiysh updated this revision to Diff 406354.Feb 7 2022, 1:53 AM

Addressed comments. Thanks for the review @Meinersbur.

shraiysh retitled this revision from [OpenMP][IRBuilder] Fix AllocIP for atomic update and capture to [OpenMP][IRBuilder] Fix AllocaIP for update/capture and handle floats for atomic update..Feb 7 2022, 1:54 AM
shraiysh retitled this revision from [OpenMP][IRBuilder] Fix AllocaIP for update/capture and handle floats for atomic update. to [OpenMP][IRBuilder] Handle floats for atomic update and fix AllocaIP for update/capture.
shraiysh added inline comments.Feb 7 2022, 2:14 AM
llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
3301–3303

Good point. I have added the check for ambiguous IPs in the createAtomicUpdate function now. This move is however unrelated. This is just to do generate all the ContBB instructions later without having to switch IPs for creating alloca. The move is simply to avoid RestoreIP and SaveIP.

This revision is now accepted and ready to land.Feb 7 2022, 3:44 PM
shraiysh updated this revision to Diff 406700.Feb 7 2022, 9:31 PM

Rebase with main.

The failures are unrelated and are timeout failures. Should I go ahead with the merge @Meinersbur?

shraiysh updated this revision to Diff 407390.Feb 9 2022, 9:27 PM

Rebase with main. Hope the builds pass.

This revision was landed with ongoing or failed builds.Feb 9 2022, 11:46 PM
This revision was automatically updated to reflect the committed changes.