This is an archive of the discontinued LLVM Phabricator instance.

[Clang][OpenMP][OMPBuilder] (1/4) Privatize `parallel` for `OMPBuilder`
Needs ReviewPublic

Authored by fghanim on May 9 2020, 12:45 PM.

Details

Summary

Adding IMplementation of private, firstprivate, copyin clauses to
the OMPBuilder implementation of omp parallel in clang

Diff Detail

Event Timeline

fghanim created this revision.May 9 2020, 12:45 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 9 2020, 12:46 PM

Generally you copied the existing Clang logic, correct?

clang/lib/CodeGen/CGStmtOpenMP.cpp
796–797

Wasn't this part of D79675?

(btw I tried to comprehend why this is needed and it is on my list for things we replace eventually).

885

Please undo as it doesn't seem to change anything.

3449

These 4 lines can go in on their own, LGTM on them.

fghanim marked 2 inline comments as done.May 14 2020, 9:40 AM

Generally you copied the existing Clang logic, correct?

Well, Yes and no. I tried to keep as much as I can of the original implementation, however, some required more extensive changes.

The things added to emitparalleldirective are all new
Almost the latter half of the OMPBuilder version of emitfirstprivateclause
somethings in the the OMPBuilder version of emitcopyinclause
The rest had minor or smaller changes, but generally the same
the lit tests had some changes

clang/lib/CodeGen/CGStmtOpenMP.cpp
796–797

ignore - I originally wanted to use the original emitfirstprivate, before I had to make some changes. This is remaining from that code. The same comment / todo is in OMPBuilder specific version below.

I also, removed this from D79676

fghanim updated this revision to Diff 269589.Jun 9 2020, 10:09 AM
  • rebase
  • splitting patch into 4 ( this, D81482 , D81483 , D81484 )
  • addressing reviewer's comments

@jdoerfert Please suggest reviewer's for this, and I will add them to other clang related patches

fghanim retitled this revision from [clang][OpenMP][OMPIRBuilder] Adding some Privatization clauses to OpenMP `parallel` Directive to [Clang][OpenMP][OMPBuilder] (1/4) Privatize `parallel` for `OMPBuilder`.Jun 9 2020, 10:35 AM
fghanim edited the summary of this revision. (Show Details)

ping - please suggest reviewers I can add to review the clang side of things?

Thanks @fghanim for this patch. I will get to this on Friday if you can add me as a reviewer.

@kiranchandramohan You can add yourself and others ;)

Can we test this?

Is the ordering of code generation for clauses important?
copyin -> firstprivate -> barrier -> private

clang/lib/CodeGen/CGStmtOpenMP.cpp
1673

Should this change in this patch?

1729–1736

Nit: What do these three cases correspond to? A comment might be useful.

1743

Not a comment about this patch: While the context makes it clear, the name does not suggest that this function is emitting something.

fghanim marked 3 inline comments as done.Jun 30 2020, 11:34 PM

Is the ordering of code generation for clauses important?
copyin -> firstprivate -> barrier -> private

if we emitted a copyin, then prob. yes. otherwise no.

clang/lib/CodeGen/CGStmtOpenMP.cpp
1673

No, still used for shared variables.

but the todo should go away.

1729–1736

Just checks to see what to do with the terminator of the entry block.

I'll add a comment in an update

1743

you mean ForceClean()?
it forces the emission of cleanup code - instead of just as part of the Privatescope Dctor.

What is the plan for this patch?

What is the plan for this patch?

To commit it ... eventually :)
Once it (and the rest in the series) get reviewed. As it stands, I cannot commit this patch without the rest in the series, and I cannot find reviewers for the other patches.

Tests missing

I am not sure what to test here that isn't tested elsewhere in the series. This patch is the last in a series, and it represents the "usage" of the functionality added by the other patches. Each of the other patches has its test as a part of it.