This is an archive of the discontinued LLVM Phabricator instance.

[OpenMPOpt][WIP] Structure for unittests
Needs ReviewPublic

Authored by hamax97 on Jul 7 2020, 8:52 AM.

Details

Summary

Basic structure for adding new unittests to the OpenMPOpt optimizations.

Diff Detail

Event Timeline

hamax97 created this revision.Jul 7 2020, 8:52 AM

Should we merge the test header into the test cpp?

We need an actual unit test that runs :)

Should we merge the test header into the test cpp?

We need an actual unit test that runs :)

Sure sure, I had an external problem and couldn't finish uploading the patches.

hamax97 updated this revision to Diff 279016.Jul 18 2020, 11:52 AM

Unit test for getValuesInOfflArrays working.

Wow, this required more machinery than I expected.. thanks!

Should we merge this with the MemoryTransfer logic so we can test it?

llvm/unittests/Transforms/IPO/OpenMPOpt/HideMemTransferLatencyTest.cpp
126

Don't compare the names. Go through the module and locate the value you want and compare it against the llvm::Value.

hamax97 added a comment.EditedJul 18 2020, 8:10 PM

Wow, this required more machinery than I expected.. thanks!

Should we merge this with the MemoryTransfer logic so we can test it?

I already tested it. When we agree on D82719, we should commit that first and then this I guess. Or do you mean adding this patch to that one before commiting?

Wow, this required more machinery than I expected.. thanks!

Should we merge this with the MemoryTransfer logic so we can test it?

I already tested it. When we agree on D82719, we should commit that first and then this I guess. Or do you mean adding this patch to that one before commiting?

I mean merging them into one and commiting them together.

I'm not totally sure about this. There's a lot of test setup relative to the test case itself, and I can't work out by reading the test itself what it's checking. What are all the mock classes for?

I'm wondering if we would be better off refactoring the code it intends to test so that it needs less setup.

I'm not totally sure about this. There's a lot of test setup relative to the test case itself, and I can't work out by reading the test itself what it's checking. What are all the mock classes for?

I'm wondering if we would be better off refactoring the code it intends to test so that it needs less setup.

Regarding the mock classes. I forgot to remove MockFunctionPass and MockModulePass. But MockSCCPass is used for later using EXPECT_CALL inside the unit test itself.

Regarding refactoring the code, I think it can be done. We would have to traverse manually the function until reaching the runtime call needed. But, don't you think that all this setup might be useful for other OpenMP optimizations?, or perhaps we should wait until we have them, idk.