File tree Expand file tree Collapse file tree 3 files changed +12
-1
lines changed
include/mlir/Dialect/LLVMIR Expand file tree Collapse file tree 3 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ class LLVMFuncOp;
3434// / of the libc).
3535LLVM::LLVMFuncOp lookupOrCreatePrintI64Fn (ModuleOp moduleOp);
3636LLVM::LLVMFuncOp lookupOrCreatePrintU64Fn (ModuleOp moduleOp);
37+ LLVM::LLVMFuncOp lookupOrCreatePrintBF16Fn (ModuleOp moduleOp);
3738LLVM::LLVMFuncOp lookupOrCreatePrintF32Fn (ModuleOp moduleOp);
3839LLVM::LLVMFuncOp lookupOrCreatePrintF64Fn (ModuleOp moduleOp);
3940LLVM::LLVMFuncOp lookupOrCreatePrintOpenFn (ModuleOp moduleOp);
Original file line number Diff line number Diff line change @@ -1082,7 +1082,10 @@ class VectorPrintOpConversion : public ConvertOpToLLVMPattern<vector::PrintOp> {
10821082 VectorType vectorType = printType.dyn_cast <VectorType>();
10831083 Type eltType = vectorType ? vectorType.getElementType () : printType;
10841084 Operation *printer;
1085- if (eltType.isF32 ()) {
1085+ if (eltType.isBF16 ()) {
1086+ printer =
1087+ LLVM::lookupOrCreatePrintBF16Fn (printOp->getParentOfType <ModuleOp>());
1088+ } else if (eltType.isF32 ()) {
10861089 printer =
10871090 LLVM::lookupOrCreatePrintF32Fn (printOp->getParentOfType <ModuleOp>());
10881091 } else if (eltType.isF64 ()) {
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ using namespace mlir::LLVM;
2626// / part of the libc).
2727static constexpr llvm::StringRef kPrintI64 = " printI64" ;
2828static constexpr llvm::StringRef kPrintU64 = " printU64" ;
29+ static constexpr llvm::StringRef kPrintBF16 = " printBF16" ;
2930static constexpr llvm::StringRef kPrintF32 = " printF32" ;
3031static constexpr llvm::StringRef kPrintF64 = " printF64" ;
3132static constexpr llvm::StringRef kPrintOpen = " printOpen" ;
@@ -66,6 +67,12 @@ LLVM::LLVMFuncOp mlir::LLVM::lookupOrCreatePrintU64Fn(ModuleOp moduleOp) {
6667 LLVM::LLVMVoidType::get (moduleOp->getContext ()));
6768}
6869
70+ LLVM::LLVMFuncOp mlir::LLVM::lookupOrCreatePrintBF16Fn (ModuleOp moduleOp) {
71+ return lookupOrCreateFn (moduleOp, kPrintBF16 ,
72+ FloatType::getBF16 (moduleOp->getContext ()),
73+ LLVM::LLVMVoidType::get (moduleOp->getContext ()));
74+ }
75+
6976LLVM::LLVMFuncOp mlir::LLVM::lookupOrCreatePrintF32Fn (ModuleOp moduleOp) {
7077 return lookupOrCreateFn (moduleOp, kPrintF32 ,
7178 Float32Type::get (moduleOp->getContext ()),
You can’t perform that action at this time.
0 commit comments