Skip to content

Commit

Permalink
[Gemmini] fix addr_len. (#252)
Browse files Browse the repository at this point in the history
  • Loading branch information
linuxlonelyeagle authored Dec 5, 2023
1 parent cbdfc44 commit 2fe2e9f
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions midend/lib/Conversion/LowerGemmini/LowerGemminiPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ class PrintOpLowering : public ConversionPattern {
rewriter.setInsertionPointToEnd(loop.getBody());

if (i != e - 1)
rewriter.create<LLVM::CallOp>(loc, getPrintfType(context), printfRef, newLineCst);
rewriter.create<LLVM::CallOp>(loc, getPrintfType(context), printfRef,
newLineCst);
rewriter.create<scf::YieldOp>(loc);
rewriter.setInsertionPointToStart(loop.getBody());
}
Expand All @@ -101,7 +102,7 @@ class PrintOpLowering : public ConversionPattern {
elementLoad = rewriter.create<mlir::LLVM::SExtOp>(
loc, rewriter.getI32Type(), elementLoad);
rewriter.create<LLVM::CallOp>(
loc, getPrintfType(context) , printfRef,
loc, getPrintfType(context), printfRef,
ArrayRef<Value>({formatSpecifierCst, elementLoad}));

rewriter.eraseOp(op);
Expand All @@ -123,7 +124,8 @@ class PrintOpLowering : public ConversionPattern {

PatternRewriter::InsertionGuard insertGuard(rewriter);
rewriter.setInsertionPointToStart(module.getBody());
rewriter.create<LLVM::LLVMFuncOp>(module.getLoc(), "printf", getPrintfType(context));
rewriter.create<LLVM::LLVMFuncOp>(module.getLoc(), "printf",
getPrintfType(context));
return SymbolRefAttr::get(context, "printf");
}

Expand All @@ -145,8 +147,7 @@ class PrintOpLowering : public ConversionPattern {
Value cst0 = builder.create<LLVM::ConstantOp>(loc, builder.getI64Type(),
builder.getIndexAttr(0));
return builder.create<LLVM::GEPOp>(
loc,
LLVM::LLVMPointerType::get(builder.getContext()), global.getType(),
loc, LLVM::LLVMPointerType::get(builder.getContext()), global.getType(),
globalPtr, ArrayRef<Value>({cst0, cst0}));
}
};
Expand All @@ -165,7 +166,7 @@ class LowerGemminiToLLVMPass

Option<int64_t> dim{*this, "dim", llvm::cl::desc("Size of systolic array."),
llvm::cl::init(16)};
Option<int64_t> addrLen{*this, "addr-len",
Option<int64_t> addrLen{*this, "addr_len",
llvm::cl::desc("The length of address."),
llvm::cl::init(32)};
Option<int64_t> accRows{*this, "acc_rows", llvm::cl::desc("The row of acc."),
Expand Down

0 comments on commit 2fe2e9f

Please sign in to comment.