This is an archive of the discontinued LLVM Phabricator instance.

[Driver][OpenMP] Create tool chains for OpenMP offloading kind.
ClosedPublic

Authored by sfantao on Jun 29 2016, 10:13 AM.

Details

Summary

This patch adds new logic to create the necessary tool chains to support offloading for OpenMP. The OpenMP related options are checked and the tool chains created accordingly. Diagnostics are emitted in case the options are illegal or express unknown targets.

Diff Detail

Event Timeline

sfantao updated this revision to Diff 62235.Jun 29 2016, 10:13 AM
sfantao retitled this revision from to [Driver][OpenMP] Create tool chains for OpenMP offloading kind..
sfantao updated this object.
mkuron added a subscriber: mkuron.Jun 29 2016, 12:58 PM
ABataev added inline comments.Jun 29 2016, 7:48 PM
lib/Driver/Driver.cpp
490–494

I don't like the fact that we have similar string comparisons in different files. This must be handled in a single place.

sfantao updated this revision to Diff 62516.Jul 1 2016, 11:30 AM
sfantao marked an inline comment as done.
  • Check the OpenMP flags only in one place for purposes of obtaining the runtime kind.

Hi Alexey,

Thanks for the review!

lib/Driver/Driver.cpp
490–494

Ok, that makes sense. I moved the ownership of OpenMPRuntimeKind to the Driver, given that the Driver was being retrieved in Tools.cpp in order to emit the diagnostics.

sfantao updated this revision to Diff 62518.Jul 1 2016, 11:58 AM
  • Add code dropped accidently in the previous diff.
sfantao updated this revision to Diff 62577.Jul 1 2016, 5:07 PM
  • Rebase
sfantao updated this revision to Diff 63683.Jul 12 2016, 8:18 AM
  • Rebase.
sfantao updated this revision to Diff 66018.Jul 28 2016, 2:49 PM
  • Rebase.
sfantao updated this revision to Diff 72119.Sep 21 2016, 3:46 PM
  • Rebase.
hfinkel added inline comments.Sep 28 2016, 11:47 AM
include/clang/Basic/DiagnosticDriverKinds.td
159

This message does not tell the user how they might make their -fopenmp option "compatible with offloading." Please make sure the message does, or is has an associated hint message which does.

sfantao updated this revision to Diff 75705.Oct 25 2016, 7:59 AM
sfantao marked an inline comment as done.
sfantao edited edge metadata.
  • Address Hal Finkel comments - make diagnostic message more informative.

Hi Hal,

Thanks for the review!

include/clang/Basic/DiagnosticDriverKinds.td
159

Ok, the message is now: The option -fopenmp-targets must be used in conjunction with a -fopenmp option compatible with offloading, please use -fopenmp=libomp or -fopenmp=libiomp5.

hfinkel accepted this revision.Oct 26 2016, 3:11 PM
hfinkel edited edge metadata.

LGTM

This revision is now accepted and ready to land.Oct 26 2016, 3:11 PM
sfantao closed this revision.Oct 27 2016, 9:47 AM