[PATCH] D150427: [AMDGPU] Non hostcall printf support for HIP

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 12 09:28:19 PDT 2023


yaxunl added inline comments.


================
Comment at: clang/include/clang/Basic/LangOptions.def:274
 LANGOPT(OffloadingNewDriver, 1, 0, "use the new driver for generating offloading code.")
+ENUM_LANGOPT(AMDGPUPrintfKindVal, AMDGPUPrintfKind, 2, AMDGPUPrintfKind::Buffered, "printf lowering scheme to be used, hostcall or buffer based")
 
----------------
This should be a target option like https://reviews.llvm.org/D91546 instead of a language option since it is target specific.


================
Comment at: clang/lib/Driver/ToolChains/Clang.cpp:4663-4664
+
+    if (JA.isDeviceOffloading(Action::OFK_HIP) &&
+        (types::isHIP(Input.getType()) || types::isLLVMIR(Input.getType()))) {
+      // Device side compilation printf
----------------
You can check whether target triple is amdgpu instead.


================
Comment at: llvm/lib/Transforms/Utils/AMDGPUEmitPrintf.cpp:416
+
 Value *llvm::emitAMDGPUPrintfCall(IRBuilder<> &Builder,
+                                  ArrayRef<Value *> Args, bool isBuffered) {
----------------
Please add some comments about the transformations done for buffered and non-buffered cases. Better provide a simple example.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150427



More information about the cfe-commits mailing list