This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP][Offloading] A generic and simple OpenMP target kernel interface
AbandonedPublic

Authored by jdoerfert on Jan 30 2019, 9:25 AM.

Details

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

This patch introduces an alternative OpenMP GPU kernel offloading interface called target kernel region (or TRegion),
The commit includes:

  • The Clang code generation for OpenMP target constructs based on the interface.
  • The runtime library implementation for the NVPTX device plugin, implemented mostly in terms of the existing functionality.
  • An LLVM optimization for TRegions that tries to enable SPMD-mode or use custom state machines for the kernels.

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 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.Jan 30 2019, 9:25 AM
jdoerfert updated this revision to Diff 188458.Feb 26 2019, 2:10 PM

Cleaned up clang part and interface. LLVM part still needs work

Herald added projects: Restricted Project, Restricted Project, Restricted Project. · View Herald TranscriptFeb 26 2019, 2:10 PM

I updated the patch with one that has a clean clang and runtime integration. It passes all but one OpenMP V&V test suite test (developed as part of ECP by U Del and others). The LLVM optimization gives us 30% speedup on the rodinia3.1/nw (Needleman Wunsch) benchmark (more details and a cleaned up LLVM part will follow in ~2 weeks time).

Please feel free to look through and comment on the interface (openmp/...) and clang part till then!

jdoerfert updated this revision to Diff 188460.Feb 26 2019, 2:14 PM

Remove leftover debug msgs

jdoerfert updated this revision to Diff 188461.Feb 26 2019, 2:15 PM

Remove unneeded changes

jdoerfert updated this revision to Diff 188462.Feb 26 2019, 2:17 PM

Remove more unneeded changes

Cleanup LLVM optimization part and add basic test coverage

jdoerfert retitled this revision from [WIP] Prototype a generic kernel offloading interface to A generic and simple OpenMP target kernel interface.Mar 13 2019, 12:00 PM
jdoerfert edited the summary of this revision. (Show Details)
jdoerfert retitled this revision from A generic and simple OpenMP target kernel interface to [OpenMP][Offloading] A generic and simple OpenMP target kernel interface.Mar 13 2019, 12:12 PM
jdoerfert abandoned this revision.Mar 13 2019, 2:20 PM

Patch was split, new revisions can be found here:

OpenMP: https://reviews.llvm.org/D59319
 Clang: https://reviews.llvm.org/D59328
  LLVM: https://reviews.llvm.org/D59331