This is an archive of the discontinued LLVM Phabricator instance.

[HIP][Clang][Preprocessor][RFC] Add preprocessor support for C++ Parallel Algorithm Offload
ClosedPublic

Authored by AlexVlx on Jul 20 2023, 5:37 AM.

Details

Summary

This patch adds the Preprocessor changes needed by the standard algorithm offload feature being proposed here: https://discourse.llvm.org/t/rfc-adding-c-parallel-algorithm-offload-support-to-clang-llvm/72159/1. The verbose documentation is included in the head of the patch series. This change merely adds two macros to inform user space if we are compiling in stdpar mode and, respectively, if the optional allocation interposition mode has been requested, as well as associated minimal tests. The macros can be used by the runtime implementation of offload to drive conditional compilation, and are only defined if the HIP language has been enabled.

Diff Detail

Event Timeline

AlexVlx created this revision.Jul 20 2023, 5:37 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 20 2023, 5:37 AM
AlexVlx requested review of this revision.Jul 20 2023, 5:37 AM
AlexVlx edited the summary of this revision. (Show Details)Jul 20 2023, 5:48 AM
AlexVlx updated this revision to Diff 552561.Aug 22 2023, 6:40 PM
AlexVlx retitled this revision from [Clang][Preprocessor][RFC] Add preprocessor support for C++ Parallel Algorithm Offload to [HIP][Clang][Preprocessor][RFC] Add preprocessor support for C++ Parallel Algorithm Offload.

Updating this to reflect the outcome of the RFC, which is that this will be added as a HIP extension exclusively.

yaxunl added inline comments.Aug 23 2023, 7:47 AM
clang/lib/Frontend/InitPreprocessor.cpp
590

We usually prefer defining the macro consistently in host and device compilation to avoid the chance of violation of ODR.

AlexVlx updated this revision to Diff 552952.Aug 23 2023, 6:58 PM

Define the interpose macro iff in interpose mode.

AlexVlx marked an inline comment as done.Aug 23 2023, 6:59 PM
yaxunl accepted this revision.Aug 23 2023, 7:36 PM

LGTM. Thanks

This revision is now accepted and ready to land.Aug 23 2023, 7:36 PM
This revision was landed with ongoing or failed builds.Oct 3 2023, 5:18 AM
This revision was automatically updated to reflect the committed changes.