This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by AlexVlx on Jul 20 2023, 6:06 AM.

Details

Summary

This patch adds the Sema 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 impacts the CUDA / HIP language specific checks, and only manifests if compiling in stdpar mode. In this case, we essentially do two things:

  1. Allow device side callers to call host side callees - since the user visible HLL would be standard C++, with no annotations / restriction mechanisms, we cannot unambiguously establish that such a call is an error, so we conservatively allow all such calls, deferring actual cleanup to a subsequent pass over IR;
  2. Allow host formed lambdas to capture by reference;
  3. Allow device functions to use host global variables.

Please note that host and device here are used to match existing nomenclature, they would not be present in user code.

Diff Detail

Event Timeline

AlexVlx created this revision.Jul 20 2023, 6:06 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 20 2023, 6:06 AM
AlexVlx requested review of this revision.Jul 20 2023, 6:06 AM
AlexVlx updated this revision to Diff 549113.Aug 10 2023, 11:10 AM
AlexVlx removed a reviewer: jdoerfert.

Remove noise / unintended file. Add support for dealing with unsupported ASM.

AlexVlx updated this revision to Diff 549117.Aug 10 2023, 11:16 AM

Fix typo.

yaxunl added inline comments.Aug 10 2023, 3:02 PM
clang/test/SemaStdPar/device-can-call-host.cpp
1 ↗(On Diff #549117)

can we use %clang_cc1 and omit the stdpar path options?

AlexVlx updated this revision to Diff 550391.Aug 15 2023, 10:40 AM

Update test.

AlexVlx marked an inline comment as done.Aug 15 2023, 10:41 AM
yaxunl accepted this revision.Aug 16 2023, 8:12 AM

LGTM. Thanks.

This revision is now accepted and ready to land.Aug 16 2023, 8:12 AM
AlexVlx updated this revision to Diff 552568.Aug 22 2023, 6:50 PM
AlexVlx retitled this revision from [Clang][Sema][RFC] Add Sema support for C++ Parallel Algorithm Offload to [HIP][Clang][Sema][RFC] Add Sema support for C++ Parallel Algorithm Offload.

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

This revision was landed with ongoing or failed builds.Oct 3 2023, 5:29 AM
This revision was automatically updated to reflect the committed changes.