[PATCH] D155833: [Clang][Sema][RFC] Add Sema support for C++ Parallel Algorithm Offload

Alex Voicu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 20 06:07:00 PDT 2023


AlexVlx created this revision.
AlexVlx added reviewers: yaxunl, jlebar, tra.
AlexVlx added a project: clang.
Herald added subscribers: ChuanqiXu, s.egerton, simoncook, asb, dschuff.
Herald added a project: All.
AlexVlx requested review of this revision.
Herald added subscribers: cfe-commits, wangpc, jplehr, sstefan1, aheejin.
Herald added a reviewer: jdoerfert.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D155833

Files:
  clang/lib/Sema/SemaCUDA.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/test/SemaStdPar/Inputs/stdpar_lib.hpp
  clang/test/SemaStdPar/device-can-call-host.cpp
  stdpar_sema.patch



More information about the cfe-commits mailing list