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

How to add new dialect to buddy-translate? #150

Open
LRY89757 opened this issue May 27, 2023 · 3 comments
Open

How to add new dialect to buddy-translate? #150

LRY89757 opened this issue May 27, 2023 · 3 comments
Labels
help wanted Extra attention is needed

Comments

@LRY89757
Copy link

Hi, buddy-mlir! I want to translate the conv2d.mlir to llvm ir file to compare the difference of conv2d implemention between vectorization and non-vectorization(with linalg dialect). But when I try to run the command like this:

 buddy-translate --buddy-to-llvmir after-vec-conv2d.mlir -o after-vec-conv2d.ll 

It showed like:
image

Because the buddy-translate doesn't support the dialect linalg,affine and vector of mlir.
I've checked the CMakeLists.txt of buddy-translate:

get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
get_property(translation_libs GLOBAL PROPERTY MLIR_TRANSLATION_LIBS)

But I don't know how to add the dialect vector, affine and linalg to dialect_libs.

@LRY89757
Copy link
Author

@xlinsist @zhanghb97 Please take a look. : )

@xlinsist
Copy link
Collaborator

Hi, @LRY89757, buddy-translate is based on mlir-translate. To generate LLVM IR from the .mlir file, you must ensure that every operation in this file is a part of llvm dialect or dialects at the same level. In your conv2d situation, vector.splat is high-level operation and requires more lowering passes(e.g. convert-vector-to-llvm) before using buddy-translate.

Having further questions about the vectorization of conv2d, you may share your after-vec-conv2d.mlir and thorough lowering&translation process. Thanks for your interest!

@LRY89757
Copy link
Author

Thx for your guidance! @xlinsist I need to add additional params like -convert-linalg-to-loops --lower-affine to lowering subsequently this high level dialect. I think I have a more deep understanding of Dialect : )

@meshtag meshtag added the help wanted Extra attention is needed label May 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants