This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP] Implement GOMP doacross compatibility
ClosedPublic

Authored by jlpeyton on Jul 26 2018, 8:22 AM.

Details

Summary

This change introduces GOMP doacross compatibility. There are 12 new interface
functions 6 for long type and 6 for unsigned long long type:
GOMP_doacross_post, GOMP_doacross_wait, GOMP_loop_doacross_[schedule]_start
where schedule can be static, dynamic, guided, or runtime.

These functions just translate the parameters if necessary and send them
to the corresponding kmp function.
E.g., GOMP_doacross_post() -> __kmpc_doacross_post()

For the GOMP_doacross_post function, there is template specialization to
account for when long is a four byte vs an eight byte type. If it is a
four byte type, then a temporary array has to be created to convert the
four byte integers into eight byte integers and then sending that into
__kmpc_doacross_post(). Because GOMP_doacross_wait uses varargs, it
always needs a temporary array and does not need template specialization.

Diff Detail

Repository
rOMP OpenMP

Event Timeline

jlpeyton created this revision.Jul 26 2018, 8:22 AM
This revision is now accepted and ready to land.Jul 26 2018, 11:56 AM
This revision was automatically updated to reflect the committed changes.

I'm not sure why but this seems to have broken worksharing/for/kmp_doacross_check.c with GCC. That's weird because this test calls the __kmpc_doacross_* functions directly, investigating...

Hahnfeld added inline comments.Jul 30 2018, 12:50 PM
runtime/src/kmp_gsupport.cpp
615

This statement seems to cause the harm. I think this makes all threads free their doacross buffer after processing their last iteration, right?

That's breaking runtime/test/worksharing/for/kmp_doacross_check.c which has its own call to __kmpc_doacross_fini at line 46 :-(

I can create a typical 2D wavefront testcase that uses the actual doacross clauses, and we can omit gcc from kmp_doacross_check.c. Does this suffice?

I can create a typical 2D wavefront testcase that uses the actual doacross clauses, and we can omit gcc from kmp_doacross_check.c. Does this suffice?

I think it's good to have an end-to-end test now that the library has interfaces for all compilers.

For kmp_doacross_check.c another possibility would be to guard the call to __kmpc_doacross_fini in #ifndef __GNUC__. I'm not sure if this is elegant though...

I can create a typical 2D wavefront testcase that uses the actual doacross clauses, and we can omit gcc from kmp_doacross_check.c. Does this suffice?

I think it's good to have an end-to-end test now that the library has interfaces for all compilers.

For kmp_doacross_check.c another possibility would be to guard the call to __kmpc_doacross_fini in #ifndef __GNUC__. I'm not sure if this is elegant though...

Intel compiler defines GNUC to express compatibility I guess, so it is safer to disable the whole test.