[PATCH] D153883: [Clang][OpenMP] Delay emission of __kmpc_alloc_shared for escaped VLAs

Gheorghe-Teodor Bercea via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 30 09:25:27 PDT 2023


doru1004 marked 3 inline comments as done.
doru1004 added inline comments.


================
Comment at: clang/lib/CodeGen/CGDecl.cpp:1605-1609
+        (CGM.getContext().getTargetInfo().getTriple().isAMDGPU() ||
+         CGM.getContext().getTargetInfo().getTriple().isNVPTX())) {
+      CGOpenMPRuntimeGPU &RT =
+          *(static_cast<CGOpenMPRuntimeGPU *>(&CGM.getOpenMPRuntime()));
+      if (RT.isDelayedVariableLengthDecl(*this, &D)) {
----------------
ABataev wrote:
> doru1004 wrote:
> > ABataev wrote:
> > > I think you can drop triple checks and rely completely on RT.isDelayedVariableLengthDecl(*this, &D) result here
> > I tried it but there is a lit test (which I cannot identify) that hangs when offloading to the host (I think) so it has to be an actual GPU. Any ideas?
> Make isDelayedVariableLengthDecl virtual in base OpenMPRuntime and make it return false by default, and true in base implementation for GPU. This should fix the problem, I hope
It worked thank you for the suggestion!! 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D153883/new/

https://reviews.llvm.org/D153883



More information about the cfe-commits mailing list