feat: run stablehlo-opt on programs - #236
Open
sebffischer wants to merge 1 commit into
Open
Conversation
Brings the functionality of r-xla/stablehlopt into pjrt. `pjrt_optimize()` runs StableHLO's `stablehlo-opt` tool on a program and returns the transformed `PJRTProgram`; `stablehlo_opt_passes()` lists the passes it supports. The binary is downloaded and cached on first use, reusing the plugin download's cache directory and `PJRT_INSTALL` consent mechanism. On top of that, `pjrt_refine_shapes()` concretizes the arguments of a program exported with dynamic (polymorphic) shapes -- e.g. by `jax.export` with a symbolic batch dimension -- so that it can be compiled. It also erases the `stablehlo.custom_call @shape_assertion` guards such exports carry, which PJRT has no custom call for, after checking them against the concrete shapes. The new article "Running a JAX Model in R" walks through exporting an MLP from JAX with a symbolic batch dimension and running it in R. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Brings the functionality of r-xla/stablehlopt into pjrt.
pjrt_optimize()runs StableHLO'sstablehlo-opttool on a program and returns the transformedPJRTProgram;stablehlo_opt_passes()lists the passes it supports. The binary is downloaded and cached on first use, reusing the plugin download's cache directory andPJRT_INSTALLconsent mechanism.On top of that,
pjrt_refine_shapes()concretizes the arguments of a program exported with dynamic (polymorphic) shapes -- e.g. byjax.exportwith a symbolic batch dimension -- so that it can be compiled. It also erases thestablehlo.custom_call @shape_assertionguards such exports carry, which PJRT has no custom call for, after checking them against the concrete shapes.The new article "Running a JAX Model in R" walks through exporting an MLP from JAX with a symbolic batch dimension and running it in R.