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

No stablehlo-legalize-to-linalg pass in the python binding #2597

Open
mamanain opened this issue Oct 22, 2024 · 2 comments
Open

No stablehlo-legalize-to-linalg pass in the python binding #2597

mamanain opened this issue Oct 22, 2024 · 2 comments

Comments

@mamanain
Copy link

mamanain commented Oct 22, 2024

What happened?

Hello!
We need to convert stablehlo to linalg in our pipeline. I know there is a stablehlo-legalize-to-linalg pass which is available through stablehlo-opt but it seems like it's not available in the python binding. Looks like only passes in the transformations directory are registered there.

Am I doing something wrong? Is there a reason for this? Could we also add conversion transformations to the binding? mhlo used to have them there.
Thanks!

Steps to reproduce your issue

#func îs some jax function
lowered = func.lower(*args)
stablehlo_module = lowered.compiler_ir(dialect="stablehlo")

  with stablehlo_module.context as ctx:
      ctx.append_dialect_registry(mlir.upstream_dialects)
      stablehlo.register_stablehlo_passes()
      pipeline = PassManager.parse("builtin.module(stablehlo-legalize-to-linalg)") #other passes from the transformation directories like stablehlo-legalize-to-vhlo work
      pipeline.run(stablehlo_module.operation)

-->>

error: 'stablehlo-legalize-to-linalg' does not refer to a registered pass or pass pipeline
stablehlo-legalize-to-linalg

Running the pass through stablehlo-opt works.

Version information

1c0b606

@GleasonK
Copy link
Member

Dup of #2559, let's resolve this in the other ticket. I can try to get to this this week.

What python bindings are you using? The StableHLO pip wheel or the one via JAX?

@mamanain
Copy link
Author

Dup of #2559, let's resolve this in the other ticket. I can try to get to this this week.

What python bindings are you using? The StableHLO pip wheel or the one via JAX?

Oh, sorry for missing it. We use the one provided by jax.
Is it ok if I try doing it myself? Seems like the fix shouldn't be very hard.

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

No branches or pull requests

2 participants