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

[midend/lib/Conversion/MatMulOptimization] add batchmatmul vectorization pass and add relevant examples and tests. #427

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

FloatingcloudKnight
Copy link
Contributor

@FloatingcloudKnight FloatingcloudKnight commented Nov 8, 2024

Add batchmatmul vectorization pass and add relevant examples and tests.
examples/BuddyMatmul/:
linalg-batchmatmul-f32.mlir: add operator execution time calculation;
batchmatmul-vectorisation.mlir: handwritten mlir file
makefile: update related commands.

midend/lib/Conversion/MatMulOptimization/: update BatchMatMulOptimize.cpp implementation of vectorisation, now using the standard method in buddy.

tests/Conversion/: batchmatmul-vectorisation.mlir: a test file.

Before vectorisation optimization: 0.0043869, after vectorization optimization: 0.00018692 (with vectorization size of 128), speedup ratio about 22.5. After vectorization size adjustment to 256: 0.000138998, speedup ratio about 30.6.

Vectorisation size of 32 compared to the previous version: 0.000586033 before the update, 0.000358105 after the update, with a speedup ratio of about 0.636. In addition, the original implementation may even be negatively optimised.

…ion pass and add relevant examples and tests.
FloatingcloudKnight and others added 6 commits November 24, 2024 05:35
linalg-batchmatmul-f32.mlir: add operator execution time calculation;
batchmatmul-vectorisation.mlir: handwritten mlir file
makefile: update related commands.

midend/lib/Conversion/MatMulOptimization/: update BatchMatMulOptimize.cpp implementation of vectorisation, now using the standard method in buddy.

tests/Conversion/: batchmatmul-vectorisation.mlir: a test file.

Before vectorisation optimization: 0.0043869, after vectorization optimization: 0.00018692 (with vectorization size of 128), optimization is about 23.5x. After vectorization size adjustment to 256: 0.000138998, optimization is about 31.6x.

Compared to the previous version of BatchMatMulOptimize.cpp: before the update: 0.000586033, after the update: 0.000358105, the optimisation is improved by 1.5x. In addition, the original implementation will even have a negative optimisation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants