This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP][Offloading][3/3] OpenMP GPU kernel optimizations
Needs ReviewPublic

Authored by jdoerfert on Mar 13 2019, 1:59 PM.

Details

Summary
NOTE: Also see the '[RFC] Late (OpenMP) GPU code "SPMD-zation"' email thread.

This patch introduces an LLVM optimization for target regions (TRegions)
that tries to enable SPMD-mode or use custom state machines for the
kernels.

TRegion have been introduced in https://reviews.llvm.org/D59319 .

The interface is deliberately simple to be easily analyzable in the
middle end. Design decisions included:

  • Hide all (complex) implementation choices in the runtime library but allow complete removal of the abstraction once the runtime is inlined.
  • Provide all runtime calls with sufficient, easy encoded information.
  • Make the LLVM optimization, even though tied to the TRegion interface, as general as possible.

Positive and negative examples for the LLVM optimization are provided in the

`llvm/test/Transforms/OpenMP/to_SPMD_mode.ll`

and

`llvm/test/Transforms/OpenMP/no_SPMD_mode.ll`

test files.

Event Timeline

jdoerfert created this revision.Mar 13 2019, 1:59 PM

Fix minor problems, syncronize types, update parallel mode flags, deal with external calls