[PATCH] D101911: [OPENMP]Fix PR48851: the locals are not globalized in SPMD mode.

2021-05-10 Thread Alexey Bataev via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG230953d5771f: [OPENMP]Fix PR48851: the locals are not 
globalized in SPMD mode. (authored by ABataev).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101911

Files:
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/test/OpenMP/nvptx_SPMD_codegen.cpp


Index: clang/test/OpenMP/nvptx_SPMD_codegen.cpp
===
--- clang/test/OpenMP/nvptx_SPMD_codegen.cpp
+++ clang/test/OpenMP/nvptx_SPMD_codegen.cpp
@@ -120,10 +120,7 @@
 // CHECK-DAG: [[DISTR_LIGHT]]
 // CHECK-DAG: [[FOR_LIGHT]]
 // CHECK-DAG: [[LIGHT]]
-// CHECK: call void @__kmpc_spmd_kernel_init(i32 {{.+}}, i16 0)
-// CHECK-DAG: [[DISTR_LIGHT]]
-// CHECK-DAG: [[FOR_LIGHT]]
-// CHECK-DAG: [[LIGHT]]
+// CHECK: call void @__kmpc_kernel_init(
 // CHECK: call void @__kmpc_spmd_kernel_init(i32 {{.+}}, i16 1)
 // CHECK-DAG: [[DISTR_FULL]]
 // CHECK-DAG: [[FULL]]
Index: clang/lib/CodeGen/CGOpenMPRuntime.cpp
===
--- clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -6561,7 +6561,7 @@
 continue;
   // Analyze declarations.
   if (const auto *DS = dyn_cast(S)) {
-if (llvm::all_of(DS->decls(), [&Ctx](const Decl *D) {
+if (llvm::all_of(DS->decls(), [](const Decl *D) {
   if (isa(D) || isa(D) ||
   isa(D) || isa(D) ||
   isa(D) || isa(D) ||
@@ -6572,10 +6572,7 @@
   const auto *VD = dyn_cast(D);
   if (!VD)
 return false;
-  return VD->isConstexpr() ||
- ((VD->getType().isTrivialType(Ctx) ||
-   VD->getType()->isReferenceType()) &&
-  (!VD->hasInit() || isTrivial(Ctx, VD->getInit(;
+  return VD->hasGlobalStorage() || !VD->isUsed();
 }))
   continue;
   }


Index: clang/test/OpenMP/nvptx_SPMD_codegen.cpp
===
--- clang/test/OpenMP/nvptx_SPMD_codegen.cpp
+++ clang/test/OpenMP/nvptx_SPMD_codegen.cpp
@@ -120,10 +120,7 @@
 // CHECK-DAG: [[DISTR_LIGHT]]
 // CHECK-DAG: [[FOR_LIGHT]]
 // CHECK-DAG: [[LIGHT]]
-// CHECK: call void @__kmpc_spmd_kernel_init(i32 {{.+}}, i16 0)
-// CHECK-DAG: [[DISTR_LIGHT]]
-// CHECK-DAG: [[FOR_LIGHT]]
-// CHECK-DAG: [[LIGHT]]
+// CHECK: call void @__kmpc_kernel_init(
 // CHECK: call void @__kmpc_spmd_kernel_init(i32 {{.+}}, i16 1)
 // CHECK-DAG: [[DISTR_FULL]]
 // CHECK-DAG: [[FULL]]
Index: clang/lib/CodeGen/CGOpenMPRuntime.cpp
===
--- clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -6561,7 +6561,7 @@
 continue;
   // Analyze declarations.
   if (const auto *DS = dyn_cast(S)) {
-if (llvm::all_of(DS->decls(), [&Ctx](const Decl *D) {
+if (llvm::all_of(DS->decls(), [](const Decl *D) {
   if (isa(D) || isa(D) ||
   isa(D) || isa(D) ||
   isa(D) || isa(D) ||
@@ -6572,10 +6572,7 @@
   const auto *VD = dyn_cast(D);
   if (!VD)
 return false;
-  return VD->isConstexpr() ||
- ((VD->getType().isTrivialType(Ctx) ||
-   VD->getType()->isReferenceType()) &&
-  (!VD->hasInit() || isTrivial(Ctx, VD->getInit(;
+  return VD->hasGlobalStorage() || !VD->isUsed();
 }))
   continue;
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D101911: [OPENMP]Fix PR48851: the locals are not globalized in SPMD mode.

2021-05-07 Thread Ethan Stewart via Phabricator via cfe-commits
estewart08 accepted this revision.
estewart08 added a comment.
This revision is now accepted and ready to land.

LGTM as a temporary workaround until SPMD properly assigns team private 
variables.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101911

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D101911: [OPENMP]Fix PR48851: the locals are not globalized in SPMD mode.

2021-05-07 Thread Ethan Stewart via Phabricator via cfe-commits
estewart08 added a comment.

In D101911#2738994 , @ABataev wrote:

> Hi Ethan, try this patch if it fixes the issue.

Tested this on gfx906 and v100, the main reproducer now passes.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101911

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D101911: [OPENMP]Fix PR48851: the locals are not globalized in SPMD mode.

2021-05-05 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added a comment.

Hi Ethan, try this patch if it fixes the issue.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101911

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D101911: [OPENMP]Fix PR48851: the locals are not globalized in SPMD mode.

2021-05-05 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev created this revision.
ABataev added reviewers: jdoerfert, estewart08.
Herald added subscribers: guansong, yaxunl.
ABataev requested review of this revision.
Herald added a subscriber: sstefan1.
Herald added a project: clang.

Follow the more general patch for now, do not try to SPMDize the kernel
if the variable is used and local.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101911

Files:
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/test/OpenMP/nvptx_SPMD_codegen.cpp


Index: clang/test/OpenMP/nvptx_SPMD_codegen.cpp
===
--- clang/test/OpenMP/nvptx_SPMD_codegen.cpp
+++ clang/test/OpenMP/nvptx_SPMD_codegen.cpp
@@ -120,10 +120,7 @@
 // CHECK-DAG: [[DISTR_LIGHT]]
 // CHECK-DAG: [[FOR_LIGHT]]
 // CHECK-DAG: [[LIGHT]]
-// CHECK: call void @__kmpc_spmd_kernel_init(i32 {{.+}}, i16 0)
-// CHECK-DAG: [[DISTR_LIGHT]]
-// CHECK-DAG: [[FOR_LIGHT]]
-// CHECK-DAG: [[LIGHT]]
+// CHECK: call void @__kmpc_kernel_init(
 // CHECK: call void @__kmpc_spmd_kernel_init(i32 {{.+}}, i16 1)
 // CHECK-DAG: [[DISTR_FULL]]
 // CHECK-DAG: [[FULL]]
Index: clang/lib/CodeGen/CGOpenMPRuntime.cpp
===
--- clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -6565,7 +6565,7 @@
 continue;
   // Analyze declarations.
   if (const auto *DS = dyn_cast(S)) {
-if (llvm::all_of(DS->decls(), [&Ctx](const Decl *D) {
+if (llvm::all_of(DS->decls(), [](const Decl *D) {
   if (isa(D) || isa(D) ||
   isa(D) || isa(D) ||
   isa(D) || isa(D) ||
@@ -6576,10 +6576,7 @@
   const auto *VD = dyn_cast(D);
   if (!VD)
 return false;
-  return VD->isConstexpr() ||
- ((VD->getType().isTrivialType(Ctx) ||
-   VD->getType()->isReferenceType()) &&
-  (!VD->hasInit() || isTrivial(Ctx, VD->getInit(;
+  return VD->hasGlobalStorage() || !VD->isUsed();
 }))
   continue;
   }


Index: clang/test/OpenMP/nvptx_SPMD_codegen.cpp
===
--- clang/test/OpenMP/nvptx_SPMD_codegen.cpp
+++ clang/test/OpenMP/nvptx_SPMD_codegen.cpp
@@ -120,10 +120,7 @@
 // CHECK-DAG: [[DISTR_LIGHT]]
 // CHECK-DAG: [[FOR_LIGHT]]
 // CHECK-DAG: [[LIGHT]]
-// CHECK: call void @__kmpc_spmd_kernel_init(i32 {{.+}}, i16 0)
-// CHECK-DAG: [[DISTR_LIGHT]]
-// CHECK-DAG: [[FOR_LIGHT]]
-// CHECK-DAG: [[LIGHT]]
+// CHECK: call void @__kmpc_kernel_init(
 // CHECK: call void @__kmpc_spmd_kernel_init(i32 {{.+}}, i16 1)
 // CHECK-DAG: [[DISTR_FULL]]
 // CHECK-DAG: [[FULL]]
Index: clang/lib/CodeGen/CGOpenMPRuntime.cpp
===
--- clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -6565,7 +6565,7 @@
 continue;
   // Analyze declarations.
   if (const auto *DS = dyn_cast(S)) {
-if (llvm::all_of(DS->decls(), [&Ctx](const Decl *D) {
+if (llvm::all_of(DS->decls(), [](const Decl *D) {
   if (isa(D) || isa(D) ||
   isa(D) || isa(D) ||
   isa(D) || isa(D) ||
@@ -6576,10 +6576,7 @@
   const auto *VD = dyn_cast(D);
   if (!VD)
 return false;
-  return VD->isConstexpr() ||
- ((VD->getType().isTrivialType(Ctx) ||
-   VD->getType()->isReferenceType()) &&
-  (!VD->hasInit() || isTrivial(Ctx, VD->getInit(;
+  return VD->hasGlobalStorage() || !VD->isUsed();
 }))
   continue;
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits