Skip to content

[NVVM] Expose nvvm version detection in cuda.bindings.utils.#1837

Merged
rwgk merged 17 commits intoNVIDIA:mainfrom
abhilash1910:nvvm_fix
Apr 17, 2026
Merged

[NVVM] Expose nvvm version detection in cuda.bindings.utils.#1837
rwgk merged 17 commits intoNVIDIA:mainfrom
abhilash1910:nvvm_fix

Conversation

@abhilash1910
Copy link
Copy Markdown
Contributor

Description

Fixes issue #1457 . Provides an api call to cuda.bindings.utils to check the version of nvvm.
@leofang @rwgk pinging for review.

@copy-pr-bot
Copy link
Copy Markdown
Contributor

copy-pr-bot Bot commented Mar 31, 2026

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@abhilash1910
Copy link
Copy Markdown
Contributor Author

pre-commit.ci autofix

@abhilash1910 abhilash1910 changed the title [NVVM]Expose nvvm version detection in cuda.bindings.utils. [NVVM][Fix] Expose nvvm version detection in cuda.bindings.utils. Mar 31, 2026
@abhilash1910 abhilash1910 changed the title [NVVM][Fix] Expose nvvm version detection in cuda.bindings.utils. [NVVM] Expose nvvm version detection in cuda.bindings.utils. Mar 31, 2026
@rwgk rwgk added the cuda.bindings Everything related to the cuda.bindings module label Mar 31, 2026
@rwgk rwgk added this to the cuda.bindings backlog milestone Mar 31, 2026
@rwgk rwgk added enhancement Any code-related improvements P1 Medium priority - Should do labels Mar 31, 2026
Comment thread cuda_bindings/cuda/bindings/utils/_nvvm_utils.py Outdated
@@ -0,0 +1,93 @@
# SPDX-FileCopyrightText: Copyright (c) 2026-2027 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Remove -2027

Comment thread cuda_bindings/cuda/bindings/utils/_nvvm_utils.py Outdated
Comment thread cuda_bindings/cuda/bindings/utils/_nvvm_utils.py Outdated
Comment thread cuda_bindings/cuda/bindings/utils/_nvvm_utils.py Outdated
Comment thread cuda_core/tests/test_program.py Outdated
@rparolin rparolin removed this from the cuda.bindings backlog milestone Apr 2, 2026
@abhilash1910
Copy link
Copy Markdown
Contributor Author

pre-commit.ci autofix

Comment thread cuda_bindings/cuda/bindings/utils/__init__.py
Comment thread cuda_bindings/cuda/bindings/utils/_nvvm_utils.py Outdated
Comment thread cuda_bindings/cuda/bindings/utils/_nvvm_utils.py Outdated
@abhilash1910
Copy link
Copy Markdown
Contributor Author

pre-commit.ci autofix

Comment thread cuda_bindings/cuda/bindings/utils/_nvvm_utils.py Outdated
@rwgk rwgk added this to the cuda.bindings next milestone Apr 7, 2026
@rwgk rwgk added awaiting-response Further information is requested and removed awaiting-response Further information is requested labels Apr 7, 2026
@rwgk
Copy link
Copy Markdown
Contributor

rwgk commented Apr 7, 2026

/ok to test c13c860

Comment thread cuda_bindings/cuda/bindings/utils/_nvvm_utils.py Outdated
@rwgk
Copy link
Copy Markdown
Contributor

rwgk commented Apr 7, 2026

/ok to test e2afa85

@github-actions

This comment has been minimized.

@rwgk
Copy link
Copy Markdown
Contributor

rwgk commented Apr 7, 2026

This doesn't work with the cuda-bindings from the 12.9.x backport branch, e.g.:

https://github.com/NVIDIA/cuda-python/actions/runs/24091305075/job/70279241852?pr=1837

tests/test_program.py:76: in _check_nvvm_arch
    from cuda.bindings.utils import check_nvvm_compiler_options
E   ImportError: cannot import name 'check_nvvm_compiler_options' from 'cuda.bindings.utils' (/opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/cuda/bindings/utils/__init__.py)

@leofang wrote under #1457:

We should expose it to cuda.bindings.utils, similar to the PTX version helpers.

That makes using it from cuda_core/tests/ a little tricky: it'll only be in future cuda-bindings releases.

@leofang how would you handle this situation?

@rwgk
Copy link
Copy Markdown
Contributor

rwgk commented Apr 7, 2026

@abhilash1910 — Offline we decided (roughly): let's move the (or some) tests to cuda_bindings/, and if we want to keep certain tests in cuda_core/, skip them if cuda.bindings.utils.check_nvvm_compiler_options is not available. Could you please try how that shakes out? Please ping me on chat if you have questions.

@github-actions github-actions Bot added the Needs-Restricted-Paths-Review PR touches cuda_bindings or cuda_python; only NVIDIA employees may modify these paths; see LICENSEs label Apr 16, 2026
@abhilash1910
Copy link
Copy Markdown
Contributor Author

pre-commit.ci autofix

@rwgk rwgk removed the Needs-Restricted-Paths-Review PR touches cuda_bindings or cuda_python; only NVIDIA employees may modify these paths; see LICENSEs label Apr 16, 2026
Copy link
Copy Markdown
Contributor

@rwgk rwgk left a comment

Choose a reason for hiding this comment

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

A few pretty minor suggestions (docstring fixes and test code only).

I verified that all existing test coverage is preserved.

Comment thread cuda_bindings/cuda/bindings/utils/_nvvm_utils.py Outdated
Comment thread cuda_bindings/tests/test_utils.py
Comment thread cuda_core/tests/test_program.py
Comment thread cuda_bindings/cuda/bindings/utils/_nvvm_utils.py Outdated
@github-actions github-actions Bot added the Needs-Restricted-Paths-Review PR touches cuda_bindings or cuda_python; only NVIDIA employees may modify these paths; see LICENSEs label Apr 17, 2026
@abhilash1910
Copy link
Copy Markdown
Contributor Author

pre-commit.ci autofix

@abhilash1910
Copy link
Copy Markdown
Contributor Author

/ok to test 9ad12b1

@rwgk
Copy link
Copy Markdown
Contributor

rwgk commented Apr 17, 2026

/ok to test 9ad12b1

@rwgk rwgk enabled auto-merge (squash) April 17, 2026 13:45
@rwgk
Copy link
Copy Markdown
Contributor

rwgk commented Apr 17, 2026

/ok to test 9ad12b1

@copy-pr-bot
Copy link
Copy Markdown
Contributor

copy-pr-bot Bot commented Apr 17, 2026

/ok to test 9ad12b1

@rwgk, there was an error processing your request: E2

See the following link for more information: https://docs.gha-runners.nvidia.com/cpr/e/2/

@rwgk
Copy link
Copy Markdown
Contributor

rwgk commented Apr 17, 2026

/ok to test d821db1

@rwgk rwgk removed the Needs-Restricted-Paths-Review PR touches cuda_bindings or cuda_python; only NVIDIA employees may modify these paths; see LICENSEs label Apr 17, 2026
@rwgk rwgk merged commit a18022c into NVIDIA:main Apr 17, 2026
92 checks passed
@github-actions

This comment has been minimized.

3 similar comments
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions
Copy link
Copy Markdown

Doc Preview CI
Preview removed because the pull request was closed or merged.

mdboom pushed a commit to mdboom/cuda-python that referenced this pull request Apr 20, 2026
…1837)

* refactor cuda bindings utils for nvvm

* [pre-commit.ci] auto code formatting

* refresh

* renaming

* exceptions

* refresh

* [pre-commit.ci] auto code formatting

* refresh

* [pre-commit.ci] auto code formatting

* refresh

* refresh

* refresh

* [pre-commit.ci] auto code formatting

* refresh

* [pre-commit.ci] auto code formatting

* refresh

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cuda.bindings Everything related to the cuda.bindings module enhancement Any code-related improvements P1 Medium priority - Should do

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants