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

[QUERY] How to stop torch-mlir from decomposing certain ops when using torch dynamo #3953

Open
Abhishek-TyRnT opened this issue Jan 10, 2025 · 2 comments

Comments

@Abhishek-TyRnT
Copy link
Contributor

When I was torchscript.compile, there is a argument backend_legal_ops which optionally stops torch-mlir from decomposing certain aten ops. But I couldn't find something similar when using fx.import_and_export. If there is someone please help how to do it.

@mgehre-amd
Copy link
Contributor

import_and_export has a decomposition_table argument. By default, it uses the table given by get_decomposition_table. You can try explicitly passing an empty list to disable all decompositions at this level.
(Other decompositions might still happen due to how dynamo is working internally).

@Abhishek-TyRnT
Copy link
Contributor Author

I am trying to stop decomposition of operations like layer_norm or softmax. Even after passing the empty list, it decomposing. Although I found an alternate route to do that. like torch script, we can use backend_legal_ops argument before running the pass like this.

option_string = (
"{backend-legal-ops="
+ ",".join(backend_legal_ops)
+ " extra-library="
+ extra_library_file_name
+ "}"
)
run_pipeline_with_repro_report(

This seems like a useful feature, and since torch-mlir is migrating more towards dynamo, I believe dynamo export must also have this feature. I can send a PR for this

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

No branches or pull requests

2 participants