Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Gemmini Dialect] Gemmini Dialect enhancement on tiled_matmul #178

Merged
merged 51 commits into from
Oct 30, 2023

Conversation

Xinyu302
Copy link
Contributor

@Xinyu302 Xinyu302 commented Jul 10, 2023

Add matmul running in OS mode;
Add activation support for matmul-ws, tested on igelu.

Copy link
Member

@linuxlonelyeagle linuxlonelyeagle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a few minor details.

@Xinyu302 Xinyu302 closed this Oct 26, 2023
@Xinyu302 Xinyu302 reopened this Oct 26, 2023
Copy link
Member

@linuxlonelyeagle linuxlonelyeagle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here are some minor issues.

home/sen/buddy/midend/lib/Dialect/Gemmini/Transforms/LegalizeForLLVMExport.cpp:1256:39: warning: comparison of integer expressions of different signedness: 'const int' and 'long unsigned int' [-Wsign-compare]
 1256 |       const int maxOchsPerMvin = ochs < maxBlockLenAcc * dim ? ochs :
      |                                  ~~~~~^~~~~~~~~~~~~~~~~~~~~~
/home/sen/buddy/midend/lib/Dialect/Gemmini/Transforms/LegalizeForLLVMExport.cpp:1277:32: warning: comparison of integer expressions of different signedness: 'const int' and 'long unsigned int' [-Wsign-compare]
 1277 |       int maxChsPerMvin = ichs < maxBlockLen * dim ? ichs :
      |                           ~~~~~^~~~~~~~~~~~~~~~~~~
/home/sen/buddy/midend/lib/Dialect/Gemmini/Transforms/LegalizeForLLVMExport.cpp:1280:33: warning: comparison of integer expressions of different signedness: 'int' and 'long unsigned int' [-Wsign-compare]
 1280 |         maxChsPerMvin = batches < maxBlockLen * dim ? batches :
      |                         ~~~~~~~~^~~~~~~~~~~~~~~~~~~
/home/sen/buddy/midend/lib/Dialect/Gemmini/Transforms/LegalizeForLLVMExport.cpp:1333:35: warning: comparison of integer expressions of different signedness: 'const int' and 'long unsigned int' [-Wsign-compare]
 1333 |       int max_chs_per_mvin = ochs < maxBlockLen * dim ? ochs :
      |                              ~~~~~^~~~~~~~~~~~~~~~~~~
/home/sen/buddy/midend/lib/Dialect/Gemmini/Transforms/LegalizeForLLVMExport.cpp:1336:33: warning: comparison of integer expressions of different signedness: 'int' and 'long unsigned int' [-Wsign-compare]
 1336 |         max_chs_per_mvin = kchs < maxBlockLen * dim ? kchs :
      |                            ~~~~~^~~~~~~~~~~~~~~~~~~
/home/sen/buddy/midend/lib/Dialect/Gemmini/Transforms/LegalizeForLLVMExport.cpp:1469:27: warning: variable 'dimOp' set but not used [-Wunused-but-set-variable]
 1469 |                     Value dimOp = rewriter.create<arith::ConstantOp>(loc, rewriter.getI64IntegerAttr(dim));
      |                           ^~~~~
/home/sen/buddy/midend/lib/Dialect/Gemmini/Transforms/LegalizeForLLVMExport.cpp: In member function 'void GemminiTileConvLowering::tiledConv(int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, bool, bool, bool, bool, bool, int, int, int, int, int, int, int, const mlir::Value&, const mlir::Value&, const mlir::Value&, mlir::Value&, int, acc_scale_t, int, int, int, buddy::gemmini::TileConvOp&, mlir::ConversionPatternRewriter&) const':
/home/sen/buddy/midend/lib/Dialect/Gemmini/Transforms/LegalizeForLLVMExport.cpp:1572:12: warning: unused variable 'aSpadId' [-Wunused-variable]
 1572 |     size_t aSpadId = 0;
      |            ^~~~~~~
/home/sen/buddy/midend/lib/Dialect/Gemmini/Transforms/LegalizeForLLVMExport.cpp:1573:12: warning: unused variable 'bSpadId' [-Wunused-variable]
 1573 |     size_t bSpadId = 0;
      |            ^~~~~~~
/home/sen/buddy/midend/lib/Dialect/Gemmini/Transforms/LegalizeForLLVMExport.cpp:1577:10: warning: variable 'a_reuse' set but not used [-Wunused-but-set-variable]
 1577 |     bool a_reuse = false;
      |          ^~~~~~~
/home/sen/buddy/midend/lib/Dialect/Gemmini/Transforms/LegalizeForLLVMExport.cpp:1578:10: warning: variable 'b_reuse' set but not used [-Wunused-but-set-variable]
 1578 |     bool b_reuse = false;
      |          ^~~~~~~
/home/sen/buddy/midend/lib/Dialect/Gemmini/Transforms/LegalizeForLLVMExport.cpp: In member function 'virtual mlir::LogicalResult GemminiTileConvLowering::matchAndRewrite(buddy::gemmini::TileConvOp, mlir::ConvertOpToLLVMPattern<buddy::gemmini::TileConvOp>::OpAdaptor, mlir::ConversionPatternRewriter&) const':
/home/sen/buddy/midend/lib/Dialect/Gemmini/Transforms/LegalizeForLLVMExport.cpp:1852:23: warning: variable 'outputShape' set but not used [-Wunused-but-set-variable]
 1852 |     ArrayRef<int64_t> outputShape = outputType.getShape();
      |                       ^~~~~~~~~~~
/home/sen/buddy/midend/lib/Dialect/Gemmini/Transforms/LegalizeForLLVMExport.cpp:1853:23: warning: variable 'weightsShape' set but not used [-Wunused-but-set-variable]
 1853 |     ArrayRef<int64_t> weightsShape = weightsType.getShape();
      |                       ^~~~~~~~~~~~

examples/GemminiDialect/tile-conv-igelu.mlir Show resolved Hide resolved
Copy link
Member

@linuxlonelyeagle linuxlonelyeagle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your work!

examples/GemminiDialect/tile-conv-igelu.mlir Show resolved Hide resolved
Copy link
Member

@linuxlonelyeagle linuxlonelyeagle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some minor issues.

/home/sen/buddy/midend/lib/Dialect/Gemmini/Transforms/LegalizeForLLVMExport.cpp:1574:12: warning: unused variable 'num_kch' [-Wunused-variable]
 1574 |     size_t num_kch = ceil_divide_int(inChannels, kchs);
      |            ^~~~~~~
/home/sen/buddy/midend/lib/Dialect/Gemmini/Transforms/LegalizeForLLVMExport.cpp:1575:12: warning: unused variable 'num_poch' [-Wunused-variable]
 1575 |     size_t num_poch = ceil_divide_int(outChannels, pochs);
      |            ^~~~~~~~
/home/sen/buddy/midend/lib/Dialect/Gemmini/Transforms/LegalizeForLLVMExport.cpp:1576:12: warning: unused variable 'num_b' [-Wunused-variable]
 1576 |     size_t num_b = ceil_divide_int(batchSize, batches);
      |            ^~~~~
/home/sen/buddy/midend/lib/Dialect/Gemmini/Transforms/LegalizeForLLVMExport.cpp:1577:12: warning: unused variable 'num_porow' [-Wunused-variable]
 1577 |     size_t num_porow = ceil_divide_int((porowEnd - porowStart), porows);
      |            ^~~~~~~~~
/home/sen/buddy/midend/lib/Dialect/Gemmini/Transforms/LegalizeForLLVMExport.cpp:1578:12: warning: unused variable 'num_pocol' [-Wunused-variable]
 1578 |     size_t num_pocol = ceil_divide_int(poolOutColDim, pocols);
      |            ^~~~~~~~~
/home/sen/buddy/midend/lib/Dialect/Gemmini/Transforms/LegalizeForLLVMExport.cpp:1579:12: warning: unused variable 'num_krow' [-Wunused-variable]
 1579 |     size_t num_krow = ceil_divide_int(kernelDim, krows);
      |            ^~~~~~~~
/home/sen/buddy/midend/lib/Dialect/Gemmini/Transforms/LegalizeForLLVMExport.cpp:1580:12: warning: unused variable 'num_kcol' [-Wunused-variable]
 1580 |     size_t num_kcol = ceil_divide_int(kernelDim, kcols);
      |            ^~~~~~~~
/home/sen/buddy/midend/lib/Dialect/Gemmini/Transforms/LegalizeForLLVMExport.cpp: In member function 'virtual mlir::LogicalResult GemminiTileConvLowering::matchAndRewrite(buddy::gemmini::TileConvOp, mlir::ConvertOpToLLVMPattern<buddy::gemmini::TileConvOp>::OpAdaptor, mlir::ConversionPatternRewriter&) const':
/home/sen/buddy/midend/lib/Dialect/Gemmini/Transforms/LegalizeForLLVMExport.cpp:1838:16: warning: variable 'outputType' set but not used [-Wunused-but-set-variable]
 1838 |     MemRefType outputType = output.getType().dyn_cast<MemRefType>();
      |                ^~~~~~~~~~
/home/sen/buddy/midend/lib/Dialect/Gemmini/Transforms/LegalizeForLLVMExport.cpp:1839:16: warning: variable 'weightsType' set but not used [-Wunused-but-set-variable]
 1839 |     MemRefType weightsType = weights.getType().dyn_cast<MemRefType>();

@linuxlonelyeagle
Copy link
Member

Thanks!

@linuxlonelyeagle linuxlonelyeagle merged commit ba241c1 into buddy-compiler:main Oct 30, 2023
1 check passed
ShiHaoGao pushed a commit to ShiHaoGao/buddy-mlir that referenced this pull request Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants