This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP] Support std::complex math functions in target regions
ClosedPublic

Authored by jdoerfert on Aug 11 2020, 1:42 PM.

Details

Summary

The last (big) missing piece to get "math" working in OpenMP target
regions (that I know of) was complex math functions, e.g.,
std::sin(std::complex<double>). With this patch we overload the system
template functions for these operations with versions that have been
distilled from libcxx/include/complex. We use the same

`omp begin/end declare variant`

mechanism we use for other math functions before, except that we this
time overload templates (via D85735).

Diff Detail

Event Timeline

jdoerfert created this revision.Aug 11 2020, 1:42 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 11 2020, 1:42 PM
jdoerfert requested review of this revision.Aug 11 2020, 1:42 PM
jdoerfert updated this revision to Diff 284898.Aug 11 2020, 2:26 PM

Update test and include mock type_traits header

jdoerfert updated this revision to Diff 284954.Aug 11 2020, 7:25 PM

Reintroduce requires-target into tests

I think the test fail because D85735 was not part of the build. Works locally just fine.

JonChesterfield accepted this revision.Aug 25 2020, 4:22 PM

The duplication from libc++ doesn't feel good but I can see how it happened. Dependency breaking etc.

clang/lib/Headers/openmp_wrappers/complex_cmath.h
59

Doesn't matter hugely given inlining, but I'm surprised to see std::complex taken by const & instead of by value.

clang/test/Headers/Inputs/include/type_traits
4

In order to run the tests without libc++/libstdc++ available?

This revision is now accepted and ready to land.Aug 25 2020, 4:22 PM
jdoerfert added inline comments.Aug 25 2020, 4:36 PM
clang/lib/Headers/openmp_wrappers/complex_cmath.h
59

I took this from the libc++, I hope they know ;)

clang/test/Headers/Inputs/include/type_traits
4

yes. this allows to include the header in the test w/o any system dependence.

This revision was landed with ongoing or failed builds.Sep 16 2020, 11:40 AM
This revision was automatically updated to reflect the committed changes.