JonChesterfield added a comment.

Changing to getGridValue would be useful for sharing parts of this with amdgcn.

The aomp toolchain handles codegen for amdgcn by adding if (isAMDGCN) to this 
file. Until such time as tregions obsoletes this code, I think we should go 
with layers instead of scattered conditionals.

I.e. rename CGOpenMPRuntimeNVPTX to CGOpenMPRuntimeGPU which contains code that 
is common to nvptx and amdgcn. That probably uses getGridValue() as a way to 
abstract over minor differences. Derive CGOpenMPRuntimeAMDGCN and 
CGOpenMPRuntimeNVPTX from CGOpenMPRuntimeGPU to implement (virtual) functions 
which are different between the two.



================
Comment at: clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp:628
 static llvm::Value *getNVPTXWarpSize(CodeGenFunction &CGF) {
+  if (CGF.getTarget().getTriple().isAMDGCN()) {
+    CGBuilderTy &Bld = CGF.Builder;
----------------
This looks unrelated to using the constants. Amdgcn doesn't have an 
nvvm_read_ptx_sreg_warpsize so does need a different means of accessing the 
wave size, but that's not directly related to using OMPGridValues


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83492



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

Reply via email to