Skip to content

fix: bound nanobind below 3 in the MLIR setup step - #214

Merged
fabianlim merged 1 commit into
torch-spyre:mainfrom
WarningRan:fix/ci-nanobind-upper-bound
Aug 25, 2026
Merged

fix: bound nanobind below 3 in the MLIR setup step#214
fabianlim merged 1 commit into
torch-spyre:mainfrom
WarningRan:fix/ci-nanobind-upper-bound

Conversation

@WarningRan

Copy link
Copy Markdown
Collaborator

Summary

uv pip install ... "nanobind>=2.12.0" in the Set up MLIR step has no upper bound. nanobind 3.0.0 was published on 2026-08-22, so that specifier now resolves to it, and CMake configuration of ktir-mlir-frontend fails before any test runs:

CMake Error at .../lib/cmake/mlir/MLIRDetectPythonEnv.cmake:79 (find_package):
  Could not find a configuration file for package "nanobind" that is
  compatible with requested version "2.9".
      .../site-packages/nanobind/cmake/nanobind-config.cmake, version: 3.0.0
      The version found is not compatible with the version requested.

Cause

MLIR asks for a major version, and nanobind's config enforces it:

  • MLIRDetectPythonEnv.cmake calls find_package(nanobind 2.9 CONFIG REQUIRED) — request major = 2.
  • nanobind ships CMake's SameMajorVersion compatibility file, whose test is if(PACKAGE_FIND_VERSION_MAJOR STREQUAL CVF_VERSION_MAJOR). With 3.0.0 installed that is 2 STREQUAL 3, so PACKAGE_VERSION_COMPATIBLE is FALSE.

So this is not a missing symbol or an API change we could adapt to — CMake rejects a 3.x config on the major-version rule alone, and will keep doing so for as long as MLIR's request is spelled 2.9.

Scope

This breaks every branch, not one. The last green run is 2026-08-21 17:57 UTC, which predates the release; the first run after it (2026-08-25) failed, and any push or PR fails identically until this lands.

<3 rather than an exact pin: MLIR accepts any compatible 2.x, and 2.12.0 is what uv.lock already resolves for ktir-mlir-frontend. The bound belongs here rather than in pyproject.toml because --no-build-isolation bypasses ktir-mlir-frontend's build-system.requires, which is what the surrounding comment already explains for the cmake>=4.0 pin.

Test plan

CI on this PR is the test: it exercises the changed step, and both pytest legs run behind it.

The `uv pip install` in *Set up MLIR* asked for `nanobind>=2.12.0` with no upper
bound. nanobind 3.0.0 was published on 2026-08-22 and now satisfies it, and CMake
configuration of ktir-mlir-frontend fails before any test runs:
MLIRDetectPythonEnv.cmake calls `find_package(nanobind 2.9 CONFIG REQUIRED)`,
nanobind ships CMake's SameMajorVersion compatibility file whose test is
`PACKAGE_FIND_VERSION_MAJOR STREQUAL CVF_VERSION_MAJOR`, and 2 does not equal 3.

Nothing here can adapt to the new major version: the rejection is CMake's
version rule, not a missing symbol, and it stands as long as MLIR spells its
request 2.9.

This is not specific to one branch. The last green run predates the release; the
first run after it failed, and any push or pull request fails the same way until
this lands.

`<3` rather than an exact pin because MLIR accepts any compatible 2.x, and
2.12.0 is what uv.lock already resolves for ktir-mlir-frontend. The bound goes
here rather than in pyproject.toml because --no-build-isolation bypasses
ktir-mlir-frontend's build-system.requires, which is what the comment above this
line already explains for the cmake>=4.0 pin.

Signed-off-by: WarningRan <zhuoran.liu@ibm.com>
@WarningRan

Copy link
Copy Markdown
Collaborator Author

Cc @fabianlim @kiszk @lchu6 @nwang-ibm @lasch — this one blocks every branch, so it is worth landing ahead of anything else in the queue.

Comment thread .github/workflows/ci.yml
# DEPENDS_TARGETS, overflowing NAME_MAX (255). CMake 4.0 truncates the
# name and relies on the trailing hash.
uv pip install scikit-build-core "nanobind>=2.12.0" "cmake>=4.0" "ninja>=1.11"
# nanobind is bounded below 3: MLIRDetectPythonEnv.cmake asks

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: i think this comment can be removed, its ok to just upperbound

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

upperbounding stuff is a nightmare, imho (not in the next 2 weeks but in 3+ months) 😉

I'm in favor of that comment explaining why it's upperbound and to help keep an eye on the reason.

@WarningRan WarningRan Aug 25, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Keeping it — @lasch asked for the opposite on this same line. What the comment is for is the condition for lifting the bound: MLIR's find_package(nanobind 2.9 CONFIG REQUIRED).

If it's the length you mind rather than its presence, I'll cut it to one sentence.

@WarningRan WarningRan Aug 25, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Same worry here, which is why the reason is in there and not just the bound — MLIR's find_package(nanobind 2.9 CONFIG REQUIRED) is the thing to watch. And it's a window rather than a pin, so 2.x still flows in on its own.

@fabianlim asked for the opposite on this line, so I've left it as is.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

yes but so you know, the MLIR version is our compiler stack is frozen, so that is why Im not worried about the upperbound.

@fabianlim fabianlim left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

left a nit on the comment

@fabianlim
fabianlim merged commit d4694d9 into torch-spyre:main Aug 25, 2026
2 checks passed
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.

3 participants