Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@cbalint13
Copy link
Contributor

@cbalint13 cbalint13 commented Jan 7, 2025

This PR make CIRCT to relay on the very MLIR cmake python detection macros.

It now properly picks up python components including pybind11 and the recently introduced nanobind.

Here is how this is used upstream .


Here is the cmake process output:

{...}
-- CIRCT Python bindings are enabled.
-- Found Python3: /usr/bin/python3.13 (found version "3.13.1") found components: Interpreter Development.Module
-- Found Python: /usr/bin/python3.13 (found version "3.13.1") found components: Interpreter Development.Module
-- Found python include dirs: /usr/include/python3.13
-- Found python libraries: 
-- Found numpy v: 
-- Checking for pybind11 in python path...
-- found (/usr/share/cmake/pybind11)
-- Performing Test HAS_FLTO
-- Performing Test HAS_FLTO - Success
-- Found pybind11: /usr/include (found version "2.13.6")
-- Found pybind11 v2.13.6: /usr/include
-- Python prefix = '', suffix = '', extension = '.cpython-313-x86_64-linux-gnu.so
-- Checking for nanobind in python path...
-- found (/usr/lib/python3.13/site-packages/nanobind/cmake)
-- Found nanobind v2.4.0: 
-- Python prefix = '', suffix = '', extension = '.cpython-313-x86_64-linux-gnu.so
{...}

Thank you !

Copy link
Contributor

@teqdruid teqdruid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm all for using things from upstream if they work!

@teqdruid teqdruid added the Python Python bindings label Jan 7, 2025
@teqdruid teqdruid merged commit ab5dc6c into llvm:main Jan 7, 2025
4 checks passed
@mikeurbach
Copy link
Contributor

I think this may have broken the ability to build wheels on Linux. I actually updated this to not use the upstream helpers based on the discussion here: https://discourse.llvm.org/t/psa-python-binding-dependencies-changing/83376.

That did break the ability to build wheels on MacOS, and I was trying to test some fixes for that, when I noticed the Linux wheel build is now broken: https://github.com/llvm/circt/actions/runs/12659976325/job/35280207153#step:6:7841

It's interesting that the failure matches the failures we've been seeing on MacOS... it seems like we are getting closer to understanding what's going wrong.

I'm not positive this change was the culprit, so I'll open a revert PR and kick off a wheel build on that PR to see if it succeeds.

@cbalint13
Copy link
Contributor Author

I think this may have broken the ability to build wheels on Linux. I actually updated this to not use the upstream helpers based on the discussion here: https://discourse.llvm.org/t/psa-python-binding-dependencies-changing/83376.

Original issue (on my side, git-tag 1.99.2) was:

-- CIRCT Python bindings are enabled.
CMake Error at CMakeLists.txt:517 (mlir_detect_pybind11_install):
  Unknown CMake command "mlir_detect_pybind11_install".
  • Somehow the mlir_detect_pybind11_install() (available within include(MLIRDetectPythonEnv)) was not picked up.
  • Also the new nanobind dependency was not picked up at all.

I noticed the proper setup of python environment here for booth external (non mono-repo) and internal projects.

That did break the ability to build wheels on MacOS, and I was trying to test some fixes for that, when I noticed the Linux wheel build is now broken: https://github.com/llvm/circt/actions/runs/12659976325/job/35280207153#step:6:7841

  • I did't saw the failure on MacOS, CI was in green.

It's interesting that the failure matches the failures we've been seeing on MacOS... it seems like we are getting closer to understanding what's going wrong.

I'm not positive this change was the culprit, so I'll open a revert PR and kick off a wheel build on that PR to see if it succeeds.

@mikeurbach
Copy link
Contributor

Somehow the mlir_detect_pybind11_install() (available within include(MLIRDetectPythonEnv)) was not picked up.
Also the new nanobind dependency was not picked up at all.

Hmm that is interesting, this is covered in the pre-merge CI. I think we'd need to know more about your environment to understand why it didn't work. I very much want to use the same setup example as the standalone project... if we can make it work for building wheels.

I did't saw the failure on MacOS, CI was in green.

Yeah, unfortunately the issue only popped up in the Upload Wheels job, which is not tested before merge. It runs weekly, or on release. This was failing on MacOS after my original changes in CMakeLists.txt, and started failing on Linux as well after this PR.

mikeurbach added a commit that referenced this pull request Jan 8, 2025
This reverts commit ab5dc6c.

There was a regression where Linux wheel builds started failing.
TaoBi22 pushed a commit to TaoBi22/circt that referenced this pull request Jul 17, 2025
This reverts commit ab5dc6c.

There was a regression where Linux wheel builds started failing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Python Python bindings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants