-
Notifications
You must be signed in to change notification settings - Fork 180
StableHLO support #87
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
base: main
Are you sure you want to change the base?
Conversation
|
@abeleinin This is awesome! This is a really great start. I think we can take a look at some popular models represented in StableHLO and see what ops they use, if we can support the ops in at least a couple non-trivial models, I think it's good enough to merge. I don't know too much about StableHLO so I don't know how many ops this is, but my guess is that it's mostly a 80/20 situation where we can support most of the popular models with only the most used ops, and then add the rest in later. For the GraphTensor thing, basically they contain an unsafe pointer back to the graph which lets us build the graph using graph tensors, and are only supposed to live as long as the Graph lives. If you're moving the Graph around after creation, it's probably a good idea to Box it using For the Tensor not found in graph error, that's happening if you're trying to access data for that tensor without it ever being set. Data is either set for a tensor manually with One other thing, I don't think you need to include luminal_hlo in the dependencies for luminal_hlo, because that just makes it a dependency on itself! |
|
Cool! Thanks for the info. I was looking through the examples to figure out what would be good to support, maybe MobileNets or BERT would be good baselines. |
|
Yeah those make sense as solid example models |
|
Sorry for the month long hiatus, getting back to work on this! I just uploaded a README that outlines how I've been exporting models from PyTorch, which is a lot more painful than I expected. There's some nuance to the mlir structure that's a bit annoying, so you have to flatten it using the
|
|
End-to-end squeezenet1_0 support in luminal via stablehlo mlir! Output: Working on cleaning this up and improving the documentation soon. Also, I plan to look into what ops (if any) are missing in more advanced models (BERT, MobileNets, etc). |
Hi! I saw you added #85 yesterday, and I think StableHLO should be a lot simpler to add before we tackle ONNX. This initial pr just adds support for basic arithmetic ops, but I think the structure is here to easily extend it. I'm not sure how complete you want this crate to be before it lands, but I'll continue to add ops in the coming days.
I did have some issues with the lifetime of
GraphTensors when constructing theGraphinsideimport_hlo. I'm not sure if this is from my lack of rust knowledge, but I did noticeGraphTensorusesunsafemutable references. All else equal when I constructed the graph in the function I was getting Tensor not found in the graph! when I tried to printinputs["0"]in the tests.Also, I decided to return a
HashMapso you can easily set function args by their names. I'm open to changing it to aVecif that's your preference.