From 2fe2e9fb8b3e9831bb4f1b76df3e1a49ee7914e4 Mon Sep 17 00:00:00 2001 From: lonely eagle <75576166+linuxlonelyeagle@users.noreply.github.com> Date: Tue, 5 Dec 2023 19:46:19 +0800 Subject: [PATCH] [Gemmini] fix addr_len. (#252) --- .../Conversion/LowerGemmini/LowerGemminiPass.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/midend/lib/Conversion/LowerGemmini/LowerGemminiPass.cpp b/midend/lib/Conversion/LowerGemmini/LowerGemminiPass.cpp index 0d153df460..0dcecff32f 100644 --- a/midend/lib/Conversion/LowerGemmini/LowerGemminiPass.cpp +++ b/midend/lib/Conversion/LowerGemmini/LowerGemminiPass.cpp @@ -86,7 +86,8 @@ class PrintOpLowering : public ConversionPattern { rewriter.setInsertionPointToEnd(loop.getBody()); if (i != e - 1) - rewriter.create(loc, getPrintfType(context), printfRef, newLineCst); + rewriter.create(loc, getPrintfType(context), printfRef, + newLineCst); rewriter.create(loc); rewriter.setInsertionPointToStart(loop.getBody()); } @@ -101,7 +102,7 @@ class PrintOpLowering : public ConversionPattern { elementLoad = rewriter.create( loc, rewriter.getI32Type(), elementLoad); rewriter.create( - loc, getPrintfType(context) , printfRef, + loc, getPrintfType(context), printfRef, ArrayRef({formatSpecifierCst, elementLoad})); rewriter.eraseOp(op); @@ -123,7 +124,8 @@ class PrintOpLowering : public ConversionPattern { PatternRewriter::InsertionGuard insertGuard(rewriter); rewriter.setInsertionPointToStart(module.getBody()); - rewriter.create(module.getLoc(), "printf", getPrintfType(context)); + rewriter.create(module.getLoc(), "printf", + getPrintfType(context)); return SymbolRefAttr::get(context, "printf"); } @@ -145,8 +147,7 @@ class PrintOpLowering : public ConversionPattern { Value cst0 = builder.create(loc, builder.getI64Type(), builder.getIndexAttr(0)); return builder.create( - loc, - LLVM::LLVMPointerType::get(builder.getContext()), global.getType(), + loc, LLVM::LLVMPointerType::get(builder.getContext()), global.getType(), globalPtr, ArrayRef({cst0, cst0})); } }; @@ -165,7 +166,7 @@ class LowerGemminiToLLVMPass Option dim{*this, "dim", llvm::cl::desc("Size of systolic array."), llvm::cl::init(16)}; - Option addrLen{*this, "addr-len", + Option addrLen{*this, "addr_len", llvm::cl::desc("The length of address."), llvm::cl::init(32)}; Option accRows{*this, "acc_rows", llvm::cl::desc("The row of acc."),