Skip to content

feat: run stablehlo-opt on programs - #236

Open
sebffischer wants to merge 1 commit into
mainfrom
feat-stablehlo-opt
Open

feat: run stablehlo-opt on programs#236
sebffischer wants to merge 1 commit into
mainfrom
feat-stablehlo-opt

Conversation

@sebffischer

Copy link
Copy Markdown
Collaborator

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.

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>
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

Successfully merging this pull request may close these issues.

1 participant