================
@@ -5930,6 +5917,49 @@ void populateCIRToLLVMPasses(mlir::OpPassManager &pm,
bool enableOpenMP) {
pm.addPass(mlir::omp::createHostOpFilteringPass());
}
+// Expand calls to the internal __cir_amdgpu_printf marker CIRGen emits for a
+// device-side printf into the real AMDGPU sequence.
+void expandAMDGPUDevicePrintf(llvm::Module &module) {
+ llvm::Function *marker = module.getFunction("__cir_amdgpu_printf");
+ if (!marker)
+ return;
+
+ // CIR records the requested lowering as a module flag.
+ bool isBuffered = false;
+ if (llvm::Metadata *md =
+ module.getModuleFlag(cir::CIRDialect::getAMDGPUPrintfKindAttrName()))
+ if (auto *mdStr = llvm::dyn_cast<llvm::MDString>(md))
----------------
skc7 wrote:
AFAIU, this code runs after the CIR has been translated to llvmir.
`amendModule` in `LowerToLLVMIR.pp` already sees a `cir.amdgpu_printf_kind` and
attaches `amdgpu_printf_kind` module flag. So, querying the module flag
`amdgpu_printf_kind` would work here rather than the cir attr.
https://github.com/llvm/llvm-project/pull/226435
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits