This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP][flang]Lower NUM_THREADS clause for parallel construct
ClosedPublic

Authored by SouraVX on Sep 17 2020, 10:57 AM.

Diff Detail

Event Timeline

SouraVX created this revision.Sep 17 2020, 10:57 AM
SouraVX requested review of this revision.Sep 17 2020, 10:57 AM
clementval added inline comments.Sep 17 2020, 5:07 PM
flang/unittests/Lower/OpenMPLoweringTest.cpp
86 ↗(On Diff #292566)

What is the plan with those unit tests once the bridge and lit test will be upstream. As I said previously, I don't think those test are testing the actual lowering and the API they use is probably tested in the respective MLIR tests. Are we going to delete them once we have the lit one or do we have to maintain both?

SouraVX added inline comments.Sep 17 2020, 9:43 PM
flang/unittests/Lower/OpenMPLoweringTest.cpp
86 ↗(On Diff #292566)

What is the plan with those unit tests once the bridge and lit test will be upstream. As I said previously, I don't think those test are testing the actual lowering and the API they use is probably tested in the respective MLIR tests.

The plan is to continue this way(if people have nothing against this (including you)). Later at some point when we have the bridge, all we have to do is switch the builder and integrate the API.
Doing all this in one-step(when bridge is up) doesn't sound good.

Are we going to delete them once we have the lit one or do we have to maintain both?

These are just unit-tests, can/should be extended when a new Op is introduced or lowered. There won't be much of a maintenance issue that I can think of.
But at the same time if community decides/thinks these won't add much value, once regression tests are up and running. Deleting them would be a trivial task, only one file, no associated dependencies and all.

clementval added inline comments.
flang/unittests/Lower/OpenMPLoweringTest.cpp
86 ↗(On Diff #292566)

My biggest concern is that these tests are disconnected from the actual code in flang/lib/Lower/OpenMP.cpp. I think @jeanPerier raised some concern in the past about those tests as well. If others are happy with them I'll follow the crowd but I have a hard time understanding what those tests are bringing in.

SouraVX added inline comments.Sep 18 2020, 2:08 PM
flang/unittests/Lower/OpenMPLoweringTest.cpp
86 ↗(On Diff #292566)

Thanks for bringing more audience. Let's make a decision here as to whether we want this or not.
If not, I'm okay with that :) too.
If we decide against it, I'll take the responsibility of the cleanup:)

jeanPerier added inline comments.Sep 22 2020, 12:08 AM
flang/unittests/Lower/OpenMPLoweringTest.cpp
86 ↗(On Diff #292566)

I share @clementval opinion here. These tests do not verify lowering, they verify properties of the parse-tree and mlir and belong better there. Here, they may give fake confidence to someone modifying genOMP that he did not break it.

The best would be to test genOMP here, though I agree it is easier said than done since that would require a lot of boilerplate and be harder to maintain than lit tests while not necessarily bringing much more confidence.

IMHO, if you want to keep these tests, they should be moved under an "OpenMP" directory under https://github.com/llvm/llvm-project/tree/master/mlir/unittests/Dialect (but for the tests like EXPECT_EQ(barrierDirective.v, llvm::omp::Directive::OMPD_barrier); that are parse-tree unit tests and would not fit under mlir unit tests. But I feel you can just skip that part that the lit tests will better cover instead).

Thanks @jeanPerier for reviewing this!

Here's the things on my TODO list:

  • I'll revise this revision removing this test.
  • Then after the patch lands, I'll do a patch for removal of the unit-test(Would it be necessary to file a separate review ?, IMHO this can be without bothering anyone.)

Please, let me know if you guys have any suggestion or anything.

flang/unittests/Lower/OpenMPLoweringTest.cpp
86 ↗(On Diff #292566)

I share @clementval opinion here.

Okay, Thanks for letting us know.

These tests do not verify lowering, they verify properties of the parse-tree and mlir and belong better there. Here, they may give fake confidence to someone modifying genOMP that he did not break it.

Agreed!

The best would be to test genOMP

We investigated this before putting these tests, cannot happen till the some missing pieces of Bridge are in place.

IMHO, if you want to keep these tests, they should be moved under an "OpenMP" directory under ..

Sounds good! but at-least out of the purview of this patch.

SouraVX updated this revision to Diff 293369.Sep 22 2020, 12:57 AM
jeanPerier accepted this revision.Sep 23 2020, 5:20 AM

LGTM regarding my comment for the unit test.

This revision is now accepted and ready to land.Sep 23 2020, 5:20 AM
SouraVX edited the summary of this revision. (Show Details)Sep 23 2020, 5:25 AM