-
Notifications
You must be signed in to change notification settings - Fork 7
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
Allow partial TorchToTcp
conversions using a whitelist
#16
Allow partial TorchToTcp
conversions using a whitelist
#16
Conversation
1bc96af
to
5370f60
Compare
add private method move addPatternIfOpInConvertTorchOpsSet to utility function add back typeConverter add inline function in Utils.h update Misc patterns as well update elementwise
5370f60
to
7a6d51d
Compare
TorchToTcp
conversions using a whitelist
e7c5eb6
to
774bde8
Compare
774bde8
to
7cc8bdd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for enabling this feature, LGTM!
patterns.add<ConvertAtenAtan2Op>(typeConverter, context); | ||
ConversionTarget &target, const llvm::StringSet<> &convertTorchOpsSet) { | ||
|
||
#define INSERT_ATEN_ELEMENTWISE_OP_PATTERN(ConvertAtenOpPattern, AtenOp) \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can reduce some duplication through token pasting:
#define INSERT_ATEN_ELEMENTWISE_OP_PATTERN(AtenOp) \
torch_to_tcp::addPatternIfOpInConvertTorchOpsSet<Convert ## AtenOp ## Pattern, \
AtenOp>( \
typeConverter, patterns, target, convertTorchOpsSet)
...
INSERT_ATEN_ELEMENTWISE_OP_PATTERN(AtenAtan2Op);
Same for the other macros.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good suggestion, done. I think this was applicable to just INSERT_ATEN_ELEMENTWISE_OP_PATTERN
macro in Elementwise.cpp and INSERT_ATEN_MISC_OP_PATTERN
macro in Misc.cpp. PLMK if I missed any other occurrence and I'll address in a follow-on.
[LLVM](https://github.com/llvm/llvm-project/tree/e5ed7b6e2fd368b722b6359556cd0125881e7638) (Feb 27) [StableHlo](https://github.com/openxla/stablehlo/tree/d214e2e2bd568a80a9f25515907b64dd7b98c538) (Mar 5) [Torch-MLIR](https://github.com/llvm/torch-mlir/tree/a86e89ecb5c7929a39a38743fb7cacadf1ff41bb) (Mar 4) [TCP](https://github.com/cruise-automation/mlir-tcp/tree/8d5d10e91e1afc9a5bb88ac647de4929fa31d735) (Mar 5) Disable the python related tests that use the hermetic python deps
Add pass option to TorchToTcp accepting a set of op name strings as whitelist (for selective conversion). This allows flexibility with phase ordering of conversion passes in downstream pipelines.