Skip to content

Commit f7b4310

Browse files
committed
Add explanation on why calling convention and function name needs to support customization.
1 parent f363c23 commit f7b4310

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

mlir/lib/Conversion/GPUCommon/GPUOpsLowering.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,13 @@ struct GPUPrintfOpToHIPLowering : public ConvertOpToLLVMPattern<gpu::PrintfOp> {
144144
/// and separate out the format strings into global constants. For some
145145
/// runtimes, such as OpenCL on AMD, this is sufficient setup, as the compiler
146146
/// will lower printf calls to appropriate device-side code.
147-
/// callingConvention and funcName can be adjusted as needed.
147+
/// However not all backends use the same calling convention and function
148+
/// naming.
149+
/// For example, the LLVM SPIRV backend requires calling convention
150+
/// LLVM::cconv::CConv::SPIR_FUNC and function name needs to be
151+
/// mangled as "_Z6printfPU3AS2Kcz".
152+
/// Default callingConvention is LLVM::cconv::CConv::C and
153+
/// funcName is "printf" but they can be customized as needed.
148154
struct GPUPrintfOpToLLVMCallLowering
149155
: public ConvertOpToLLVMPattern<gpu::PrintfOp> {
150156
GPUPrintfOpToLLVMCallLowering(

0 commit comments

Comments
 (0)