[PATCH] D86097: [OpenMP][AMDGCN] Generate global variables and attributes for AMDGCN

Alexey Bataev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 17 12:19:37 PDT 2020


ABataev added inline comments.


================
Comment at: clang/lib/CodeGen/CGOpenMPRuntime.h:499
+
+  QualType TgtAttributeStructQTy;
   class OffloadEntriesInfoManagerTy {
----------------
Cab this type and corresponding functions be made AMDGCN-specific only?


================
Comment at: clang/lib/CodeGen/CGOpenMPRuntimeAMDGCN.cpp:116
+                                             bool IsGeneric) {
+  if (!CGM.getTriple().isAMDGCN())
+    return;
----------------
Is this possible?


================
Comment at: clang/lib/CodeGen/CGOpenMPRuntimeAMDGCN.cpp:119
+  int FlatAttr = 0;
+  bool flatAttrEmitted = false;
+  unsigned DefaultWorkGroupSz =
----------------
`FlatAttrEmitted`


================
Comment at: clang/lib/CodeGen/CGOpenMPRuntimeAMDGCN.cpp:129
+        CGM.getTarget().getGridValue(llvm::omp::GVIDX::GV_Max_WG_Size);
+    unsigned compileTimeThreadLimit = 0;
+    // Only one of thread_limit or num_threads is used, cant do it for both
----------------
`CompileTimeThreadLimit`


================
Comment at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp:1390-1392
+  auto *GVMode = new llvm::GlobalVariable(
+      CGM.getModule(), CGM.Int8Ty,
+      /*isConstant=*/true, llvm::GlobalValue::WeakAnyLinkage,
----------------
Restore original formatting.


================
Comment at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.h:215-243
+  /// Emit outlined function specialized for the Single Program
+  /// Multiple Data programming model for applicable target directives on the
+  /// NVPTX device.
+  /// \param D Directive to emit.
+  /// \param ParentName Name of the function that encloses the target region.
+  /// \param OutlinedFn Outlined function value to be defined by this call.
+  /// \param OutlinedFnID Outlined function ID value to be defined by this call.
----------------
Make them protected, not public if possible. Try the same for other new functions.


================
Comment at: clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.h:40-65
+  virtual llvm::GlobalVariable *
+  allocateTransferMediumGlobal(CodeGenModule &CGM, llvm::ArrayType *Ty,
+                               StringRef Name) override;
+
+  /// Allocate global variable for SharedStaticRD
+  virtual llvm::GlobalVariable *
+  allocateSharedStaticRDGlobal(CodeGenModule &CGM,
----------------
No need to add `virtual`, `override` is enough


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86097



More information about the cfe-commits mailing list