[clang] [CIR][AMDGPU] Route printf in device code through the OpenCL runtime (PR #226435)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Sep 27 22:55:35 PDT 2026
================
@@ -65,8 +65,12 @@ lowerFromCIRToLLVMIR(mlir::ModuleOp MLIRModule, llvm::LLVMContext &LLVMCtx,
bool EnableOpenMP,
llvm::StringRef mlirSaveTempsOutFile = {},
llvm::vfs::FileSystem *fs = nullptr) {
- return direct::lowerDirectlyFromCIRToLLVMIR(MLIRModule, LLVMCtx, EnableOpenMP,
- mlirSaveTempsOutFile, fs);
+ std::unique_ptr<llvm::Module> LLVMModule =
+ direct::lowerDirectlyFromCIRToLLVMIR(MLIRModule, LLVMCtx, EnableOpenMP,
+ mlirSaveTempsOutFile, fs);
+ if (LLVMModule)
+ direct::expandAMDGPUDevicePrintf(*LLVMModule);
----------------
skc7 wrote:
The expansion is only wired into `CIRGenAction, but `cir-translate` also calls `lowerDirectlyFromCIRToLLVMIR` and would leave an undefined @__cir_amdgpu_printf. Could it run at the end of `lowerDirectlyFromCIRToLLVMIR`?
https://github.com/llvm/llvm-project/pull/226435
More information about the cfe-commits
mailing list