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

stablehlo-legalize-to-linalg not exposed to Python bindings #2559

Open
Wheest opened this issue Sep 25, 2024 · 1 comment
Open

stablehlo-legalize-to-linalg not exposed to Python bindings #2559

Wheest opened this issue Sep 25, 2024 · 1 comment

Comments

@Wheest
Copy link

Wheest commented Sep 25, 2024

Request description

Using the latest version (165cd60cfa at time of writing), the stablehlo-legalize-to-linalg pass is not exposed in the Python bindings.

with open(input_mlir_file, "r") as f:
    mlir_text = f.read()

with Context() as ctx:
    stablehlo.register_dialect(ctx)
    stablehlo.register_stablehlo_passes()


    module = Module.parse(mlir_text)

    pm = PassManager.parse(
        "builtin.module(func.func("
        "shape-legalize-to-stablehlo,"
        "stablehlo-aggressive-folder,"
        "stablehlo-aggressive-simplification,"
        "stablehlo-legalize-to-linalg"
        "))"
    )

    pm.run(module.operation)

Fails with ValueError: MLIR Textual PassPipeline Parser:1:103: error: 'stablehlo-legalize-to-linalg' does not refer to a registered pass or pass pipeline, whereas removing this pass the rest behave as normal.

The pass is available under the stablehlo-opt binary.

@GleasonK
Copy link
Member

GleasonK commented Oct 2, 2024

This can probably be resolved by adding conversion pass registration to:

void mlirRegisterAllStablehloPasses() { mlir::stablehlo::registerPasses(); }

Can try to get to this in the near future but feel free to submit a PR if you'd like it sooner

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