sameerds added inline comments.

================
Comment at: clang/lib/CodeGen/TargetInfo.cpp:9381
+      M.getTarget().getTargetOpts().CodeObjectVersion != 500) {
+    F->addFnAttr("amdgpu-no-hostcall-ptr");
+  }
----------------
The frontend does not need to worry about this attribute. See the comment in 
the MetadataStreamer. A worthwhile check would be to generate an error if we 
are able to detect that some hostcall service is being used in OpenCL on 
code-object-v4 or lower. None exists right now, but we should add the check if 
such services show up. But those checks are likely to be in a different place. 
For example, enabling asan on OpenCL for code-object-v4 should result in an 
error in the place where asan commandline options are parsed.


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUHSAMetadataStreamer.cpp:406-408
     if (Func.getParent()->getNamedMetadata("llvm.printf.fmts"))
       emitKernelArg(DL, Int8PtrTy, Align(8), ValueKind::HiddenPrintfBuffer);
+    else if (!Func.hasFnAttribute("amdgpu-no-hostcall-ptr"))
----------------
I would structure this differently: If this is code-object-v4 or lower, then if 
 "llvm.printf.fmts" is present, then this kernel clearly contains OpenCL bits, 
and cannot use hostcall. So it's okay to just assume that the no-hostcall-ptr 
attribute is always present in this situation, which means the only metadata 
generated is for ValueKind::HiddenPrintfBuffer. Else if this is code-object-v5, 
then proceed to emit both metadata.




Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121951

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

Reply via email to