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

Investigate conversion from StableHLO to Nx.Defn.Expr #1547

Open
polvalente opened this issue Oct 24, 2024 · 2 comments
Open

Investigate conversion from StableHLO to Nx.Defn.Expr #1547

polvalente opened this issue Oct 24, 2024 · 2 comments
Labels
area:nx Applies to nx kind:feature New feature or request note:discussion Details or approval are up for discussion

Comments

@polvalente
Copy link
Contributor

polvalente commented Oct 24, 2024

It might be possible to use Beaver to parse StableHLO modules into an Elixir data structure, and convert that into the equivalent Nx.Defn.Expr.

This should allow us to operate on PyTorch and Jax exports not only to execute them through Nx, but for grad and, in the future, sharding.

Note: the first draft for this feature can be worked in this repository, but most likely it can be generally implemented in a separate library.

@polvalente polvalente added kind:feature New feature or request note:discussion Details or approval are up for discussion area:nx Applies to nx labels Oct 24, 2024
@josevalim
Copy link
Collaborator

I believe this is pretty unlikely because we are a subset of StableHLO. And the StableHLO for some backends may include generic MLIR operations as well.

@polvalente
Copy link
Contributor Author

I think this might be possible if we add a special kind of node for representing the unrepresentable StableHLO operations.

My main concern is about how regions can nest -- I don't think the nested ones can be split.

And even if we don't support all models, being able to support some models might already be a win.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:nx Applies to nx kind:feature New feature or request note:discussion Details or approval are up for discussion
Projects
None yet
Development

No branches or pull requests

2 participants