Mlir_core not built

Hi there,

I’m having problems using the MLIR bindings. I’m following the docs here: MLIR Python Bindings - MLIR

However, the tools/mlir/python_packages/mlir_core/ directory is not present in my build, and when I run with python bindings enabled I’m given an error saying that the cmake option is ignored. How do I enable the python bindings when the cmake is being ignored? Do I have to add the cmake variables at the top elsewehere? I’m trying to use the MLIR python bindings and I’m at a bit of a loss, any help would be greatly appreciated.


CMake Warning:
Manually-specified variables were not used by the project:



1 Like

That’s true, I didn’t notice that. I built following user @stellaraccident 's instructions from GitHub - stellaraccident/mlir-py-release in the manual packaging release section. Do you know why these would be different?

MLIR_BINDINGS_PYTHON_ENABLED was renamed MLIR_ENABLE_BINDINGS_PYTHON about two months ago as part of a cleanup to make all these variable names consistent (using the imperative form). Those instructions would need an update.

1 Like

Great, so I’ve replaced the outdated variable names with the correct ones. I no longer get Cmake warnings about manually-specified variables. I am, however, now getting a new error:

-- Configuring done
-- Generating done
-- Build files have been written to: /media/machel/74D6207BD6203FAA/AAAAAAAAAAAAAA/mlir-py-release/build/llvm
-- Running cmake (build/install): cmake --build /media/machel/74D6207BD6203FAA/AAAAAAAAAAAAAA/mlir-py-release/build/llvm --target install-mlir-headers install-MLIRBindingsPythonSources install-MLIRBindingsPythonDialects install-MLIRPublicAPI-stripped install-MLIRTransformsBindingsPythonExtension-stripped install-MLIRCoreBindingsPythonExtension-stripped
ninja: error: unknown target 'install-MLIRBindingsPythonSources'
Traceback (most recent call last):
  File "./", line 302, in <module>
  File "/usr/lib/python3.8/", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '/media/machel/74D6207BD6203FAA/AAAAAAAAAAAAAA/mlir-py-release/build/llvm', '--target', 'install-mlir-headers', 'install-MLIRBindingsPythonSources', 'install-MLIRBindingsPythonDialects', 'install-MLIRPublicAPI-stripped', 'install-MLIRTransformsBindingsPythonExtension-stripped', 'install-MLIRCoreBindingsPythonExtension-stripped']' returned non-zero exit status 1.

Any ideas about this?

I need to delete or put a warning on that repo. Everything it did has been upstreamed now and builds disabled.

Ah I see- how would you recommend going around installing the bindings now? Been having a lot of issues with it, would really appreciate any help!

I’m on mobile for a few days and can’t check. Can I suggest just doing a global “ninja install” for the moment. There is a discrete target for just installing this part but I can’t remember it off hand. Also, we still need to add a to the upstream project (similar to the one in mlir-npcomp). I haven’t done so because of the additional work to enable a CI for it, etc.

1 Like

For upstream MLIR, if you install with python bindings enabled, the resultant python_packages/mlir_core is a standalone python package that you can copy to site-packages, etc.

We don’t (yet) distribute the bindings for the core project and are missing, which would make this more canonical. Downstreams have been working that out and when it stabilizes, we should do the same upsteam.

1 Like

Also, the official documentation still presents the happy path that works/is supported: MLIR Python Bindings - MLIR

Various niceties would be good beyond that, but they take time and… Patches welcome :wink:

1 Like

Got it now! Thanks so much for your help and advice. The problem was I kept using the outdated variables- my other source had the old ones too!