Have cu12/cu13 extras depend on cuda-core extra #457
Auto-sync is disabled for ready for review pull requests in this repository. Workflows must be run manually.
Contributors can view more details about this message here.
<!-- coderabbit-ai-generated:v1 -->
<!-- This is an auto-generated comment: summarize by coderabbit.ai -->
<!-- review_stack_entry_start -->
<a href="https://app.coderabbit.ai/change-stack/NVIDIA/numba-cuda-mlir/pull/457?scope=ghh_OusAJGA4HG8ljoOV0wJvVx8NmnZIjc2DdjmxOu0xZWA&cs_source=review_comment"><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change.svg" alt="Explain Change →" height="32"></picture></a>
<!-- review_stack_entry_end -->
<!-- recent_review_status_start -->
No actionable comments were generated in the recent review.
<!-- recent_review_status_end -->
<!-- walkthrough_start -->
<details>
<summary><strong>Walkthrough</strong></summary>
<dl>
<dd>
<br>
important: The cu12 and cu13 optional dependency groups now include matching cuda-core extras, each constrained to >=0.5.1,<2.0.0.
Changes: CUDA optional dependencies
|Layer / File(s)|Summary|
|:---|:---|
|Add CUDA-specific cuda-core extras <br> pyproject.toml|The cu12 and cu13 groups add cuda-core[cu12] and cuda-core[cu13], respectively. Both use the version constraint >=0.5.1,<2.0.0.|
Possibly related issues
NVIDIA/numba-cuda-mlir#456: The issue reports an invalid cuda-core/cuda-bindings pair from the cu12 extra. This change adds a matching CUDA extra to cuda-core; the provided summary reports a successful dependency-resolution dry run but no runtime check.Suggested reviewers: atmnp, brandon-b-miller
</dd>
</dl>
</details>
<!-- walkthrough_end -->
<!-- change_assessment_start -->
<!-- change_assessment_commit:"8db66fe05630d7961cd53a3f62fb7f3c0b54b7cb" -->
<!-- change_assessment_priority:{"version":1,"urgency":"p2","manual":false} -->
Change: Bug fix
<!-- change_assessment_end -->
<details>
<summary><strong>Merge Risk:</strong> <strong><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/risk-unassessed-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Minimal</strong> · up to <code>8db66</code></summary>
<dl>
<dd>
<br>
<!-- final_review_risk_start -->
<!-- final_review_risk_label
Merge Risk: ⚪ Minimal · up to 8db66
-->
<!-- final_review_risk_coverage:{"sourceCommitId":"8db66fe05630d7961cd53a3f62fb7f3c0b54b7cb","coveredCommitId":"8db66fe05630d7961cd53a3f62fb7f3c0b54b7cb","kind":"reviewed"} -->
Installing the CUDA 12 or CUDA 13 extra now also selects the matching cuda-core variant, which lets the resolver pick a version compatible with the user's cuda-bindings. No actionable merge risk remains.
<!-- final_review_risk_end -->
</dd>
</dl>
</details>
<details>
<summary><strong>Architecture risk:</strong> <strong><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/risk-low-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Low</strong> · up to <code>8db66</code></summary>
<dl>
<dd>
<br>
<!-- architecture_review_start -->
<!-- architecture_review_label
Architecture Summary
Architecture risk: 🔵 Low · up to 8db66
-->
The change affects 1 system.
Changed systems: pyproject.toml
Architecture concerns
No architecture-level concerns identified.
<details>
<summary><strong>Review details</strong></summary>
<dl>
<dd>
<br>
Systems and components
Before / after behavior
cu12 extra adds cuda-core[cu12]>=0.5.1,<2.0.0.cu13 extra adds cuda-core[cu13]>=0.5.1,<2.0.0.</dd>
</dl>
</details>
<!-- architecture_review_end -->
</dd>
</dl>
</details>
<!-- autopilot:start -->
<!-- autopilot:end -->
<!-- recent_review_start -->
<h6>
<details>
<summary><strong><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/info.svg" width="12" height="12" align="absmiddle" alt=""></picture> Recent review info</strong></summary>
<dl>
<dd>
<br>
<!-- review_info_content -->
<details>
<summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog.svg" width="16" height="16" align="absmiddle" alt=""></picture> Run configuration</strong></summary>
<dl>
<dd>
<br>
d980f832-6068-470d-a621-606eebf4f6ee</dd>
</dl>
</details>
<details>
<summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal.svg" width="16" height="16" align="absmiddle" alt=""></picture> Commits</strong></summary>
<dl>
<dd>
<br>
Reviewing files that changed from the base of the PR and between d1862d34d7afc54d42b6900c04889c06bd9a78d2 and 8db66fe05630d7961cd53a3f62fb7f3c0b54b7cb.
</dd>
</dl>
</details>
<details>
<summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner.svg" width="16" height="16" align="absmiddle" alt=""></picture> Files selected for processing: 1</strong></summary>
<dl>
<dd>
<br>
pyproject.toml</dd>
</dl>
</details>
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 10 remain after this review.
</dd>
</dl>
</details>
</h6>
<!-- recent_review_end -->
/ok to test
Doc Preview CI
:---:
| <p></p> :rocket: View preview at <br> https://nvidia.github.io/numba-cuda-mlir/pr-preview/pr-457/ <br><br>
| <h6><br> Preview will be ready when the GitHub Pages deployment is complete. <br><br></h6>
<!-- Sticky Pull Request Commentpr-preview -->
I don't understand why we must add cu12 (and same for cu13) extra? We did not design to require this and the same cuda-core should work in both cases.
Also, this brings in a lot of dependencies that do not concern with numba-cuda-mlir users.
Requested changes.
this brings in a lot of dependencies that do not concern with numba-cuda-mlir users
There's already a dependency on cuda-core at
https://github.com/NVIDIA/numba-cuda-mlir/pull/457/changes#diff-50c86b7ed8ac2cf95bd48334961bf0530cdc77b5a56f852c5c61b89d735fd711R27, it's just un-suffixed. Do the cu12/cu13 extras bring in additional dependencies?
I don't understand why we must add cu12 (and same for cu13) extra?
That's where cuda-core expresses it's lower bound on cuda-bindings. Without this, the solver allows cuda-bindings==12.9.3, which isn't allowed for the latest cuda-core so you get the error at runtime.
Do the cu12/cu13 extras bring in additional dependencies?
Oh maybe through the [all]? Hmm... That's unfortunate (for downstream users like cudf. Makes sense for cuda-core).
Yes. Many of them are not required by numba-cuda-mlir, e.g. cuFile and nvFatBin. I am not sure what is breaking here since as you noted we do already include cuda-core as a required dependency.
FWIW, starting cuda-core v1.3.0 we set a floor policy for cuda-bindings: https://github.com/NVIDIA/cuda-python/issues/2783. Is this what's bothering RAPIDS? The suggestion is to not pin cuda-bindings version and let cuda-core decide https://nvidia.github.io/cuda-python/cuda-core/latest/support.html#cuda-bindings-version-requirements
This is coming from cudf: https://github.com/NVIDIA/cudf/issues/25224
I think that "let cuda-core figure it out" won't work for us since we don't depend on cuda-core, just cuda-bindings (https://github.com/NVIDIA/cudf/blob/61680dbc9df47f517a63529c95e1537eaebb57f2/dependencies.yaml). We only get cuda-core transitively through packages like numba-cuda-mlir.
@leofang is this expected behavior?
$ pip install "cuda-core==1.3.0" "cuda-bindings==12.9.3"
# exit 0
>>> import cuda.core
# ImportError: cuda.core 1.3.0 requires cuda-bindings >= 12.9.8 for CUDA 12,
# but cuda-bindings 12.9.3 is installed.
I think that has to be the behavior with how things are set up today (a single package using extras for the cu12/cu13 split). This makes pip install cuda-core (unsuffixed) somewhat dangerous for cuda12. But if you "correctly" express a dependency on cuda-core[cu12] you get the right error:
❯ uv pip install "cuda-core[cu12]==1.3.0" "cuda-bindings==12.9.3" --dry-run
error: No solution found when resolving dependencies
cause: Because cuda-core[cu12]>=1.3.0 depends on cuda-bindings[all]>=12.9.8,<13 and you require cuda-core[cu12]==1.3.0, we can conclude that you require cuda-bindings>=12.9.8,<13.
And because you require cuda-bindings==12.9.3, we can conclude that your requirements are unsatisfiable.
So in general, I think numba-cuda-mlir should only have cu12/cu13 dependencies in its cu12/cu13 dependencies.
It does seem like we'd need some other extra (cuda-core[cu12-core] 😆) to avoid the extra packages brought in by cuda-core[cu12] bringing in cuda-bindings[all].
I don't understand why we must addcu12(and same forcu13) extra? We did not design to require this and the samecuda-coreshould work in both cases.
@leofang Then why do the cuda-core docs explicitly advise this approach?
Approved these changes.
Closing the loop here. We connected offline and are comfortable with this change. Thanks for the PR.
Doc Preview CI
:---:
Preview removed because the pull request was closed or merged.
<!-- Sticky Pull Request Commentpr-preview -->
We'll circle back after https://github.com/NVIDIA/cuda-python/pull/3460 was merged and released.
leofang
TomAugspurger
This updates our cu12 / cu13 extras in pyproject.toml to depend on
cuda-core[cu-version]. This will ensure that the environment solves correctly, avoiding the runtime error fromhttps://github.com/NVIDIA/numba-cuda-mlir/issues/456.
With this change, we solve for an older version of cuda-core that's compatible with the user-supplied cuda-bindings:
(this env already had some stuff in it, so the removed packages can be ignored. The main thing is that it correctly solves for
cuda-core==1.2.2given thecuda-bindings==12.9.3constraint)