Skip to content

fix(cuda.bindings): make cythonization warning-clean and enable -Werror - #2463

Merged
mdboom merged 5 commits into
NVIDIA:mainfrom
atiaomar1978-hub:fix/bindings-cython-warning-errors-2450
Aug 13, 2026
Merged

fix(cuda.bindings): make cythonization warning-clean and enable -Werror#2463
mdboom merged 5 commits into
NVIDIA:mainfrom
atiaomar1978-hub:fix/bindings-cython-warning-errors-2450

Conversation

@atiaomar1978-hub

@atiaomar1978-hub atiaomar1978-hub commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Clear the Cython warnings that blocked enabling warning_errors for cuda.bindings (Fixes cuda.bindings: make cythonization warnings clean #2450)
  • Drop ignored except * on Python-returning cudla cpdefs and reseal those generated files
  • Declare LOAD_LIBRARY_SEARCH_SYSTEM32 as const DWORD in hand-written windll.pxd
  • Enable _CythonOptions.warning_errors = True in cuda_bindings/build_hooks.py (matching cuda.core)

Cybind follow-up: the cudla emitter should stop attaching exception clauses to cpdefs that return Python objects so the next sync does not reintroduce those warnings.

Test plan

  • Local Cythonize of cuda.bindings with warning_errors=True succeeds (27 extensions)
  • toolshed/check_generated_file_seals.py passes for updated cudla.{pxd,pyx}
  • CI source builds for cuda.bindings on Linux/Windows

Clear the Cython warnings that blocked matching cuda.core's warning_errors
setting (NVIDIA#2450): drop ignored except clauses on Python-returning cudla
cpdefs, declare LOAD_LIBRARY_SEARCH_SYSTEM32 as const in windll.pxd, and
enable Cython Options.warning_errors in build_hooks.

Add source-level regression tests so these patterns do not return.

Signed-off-by: Omar Atie <atiaomar1978-hub@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@copy-pr-bot

copy-pr-bot Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

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.

@github-actions github-actions Bot added the cuda.bindings Everything related to the cuda.bindings module label Jul 31, 2026
@atiaomar1978-hub

Copy link
Copy Markdown
Contributor Author

Hi maintainers — gentle follow-up on this PR for #2450.

Could someone please:

  1. Vet / approve the PR so NVIDIA runners can run CI (copy-pr-bot is still waiting)
  2. Review when convenient
  3. Assign related issue cuda.bindings: make cythonization warnings clean #2450 to me (@atiaomar1978-hub) so I can own follow-through

Happy to adjust based on feedback (including the cybind sync note in the description).
cc @juenglin (issue author)

@juenglin

juenglin commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Thanks, Omar.

You may have noticed that some files under cuda_bindings are auto-generated, and the fix for those need to be made in a different place (the generator). We need to wait for that fix before we can merge this PR.

Regarding the pre-commit.ci failure, you might need to run pre-commit install in your virtual environment.

Signed-off-by: Omar Atie <atiaomar1978-hub@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@atiaomar1978-hub

Copy link
Copy Markdown
Contributor Author

Thanks @juenglin — that makes sense, and I appreciate the guidance.

On the generated cudla files
Agreed that the lasting fix belongs in the cybind/generator path, not hand-editing sealed outputs. This PR already notes that in the description (the cudla emitter should stop attaching exception clauses to Python-returning cpdefs). I’m happy to hold merge until that generator change lands, then refresh/reseal cudla.{pxd,pyx} from a clean sync so we don’t reintroduce the warnings.

What remains useful in this PR once cybind is fixed:

  • windll.pxd: declare LOAD_LIBRARY_SEARCH_SYSTEM32 as const DWORD (hand-written)
  • build_hooks.py: enable _CythonOptions.warning_errors = True (matching cuda.core)
  • source-level regression tests in test_cython_warning_cleanliness.py

If you’d rather split those from the temporary cudla reseal, I can reshape the PR — just say the word.

On pre-commit.ci
The failure was ruff format (one file). I’ve pushed a signed fix on this branch: a9f3036 (style: ruff-format cython warning cleanliness tests). pre-commit.ci is green again.

Ask
When convenient, could you (or another maintainer) assign #2450 to me (@atiaomar1978-hub) and vet the PR for NVIDIA runners so full CI can run once we’re unblocked on cybind? Happy to adjust based on your preferred sequencing.

@mdboom mdboom left a comment

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.

This looks great.

I think we should remove the test_cython_warning_cleanliness.py test. It just adds test complexity we need to maintain, and with "warnings as errors" turned on in build_hooks.py we will automatically catch these warnings (or any others) if they creep back.

Address review feedback: warning_errors in build_hooks already
guards against Cython warning regressions, so the source-level
tests add unnecessary maintenance cost.

Signed-off-by: Omar Atie <atiaomar1978-hub@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@atiaomar1978-hub

Copy link
Copy Markdown
Contributor Author

Thanks @mdboom — agreed. I've removed cuda_bindings/tests/test_cython_warning_cleanliness.py in 1695c51; warning_errors in build_hooks.py is enough to catch any regression. PR description/test plan updated accordingly.

@mdboom mdboom left a comment

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.

@mdboom

mdboom commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

/ok to test 1695c51

@mdboom
mdboom enabled auto-merge (squash) August 12, 2026 21:22
@atiaomar1978-hub

Copy link
Copy Markdown
Contributor Author

Hi @mdboom,

Thank you for the review and approval — much appreciated. I've removed the source-level cleanliness tests as requested, and I'm glad the remaining approach (enabling warning_errors in build_hooks.py) looks good.

I also checked the current CI failures on this PR; none appear to come from the PR changes:

  • Build win-64 / py3.11cibuildwheel failed while downloading virtualenv.pyz with http.client.RemoteDisconnected (network/infra flake). Other Windows Python versions on the same matrix passed.
  • Docs / Build docs — the docs build itself succeeded; deploy to gh-pages was rejected by a repository rule (Cannot force-push to this branch).
  • PR has assignee, labels, and milestone — process metadata check (assignee/milestone). Label cuda.bindings is already present.
  • Check job status — aggregate of the above.

pre-commit.ci, Linux builds/tests, and the other Windows builds look green. If convenient, could you please re-run the flaky Windows job (and set assignee/milestone if needed for the metadata check)? Happy to adjust anything else on my side.

Thanks again for your help on this.

@mdboom

mdboom commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

We are having merge conflicts in generated files here. The easiest thing will be to wait for #2603 to merge and then remove the cudla changes here. I can handle getting that across the finish line. Thanks again for your work, @atiaomar1978-hub.

@mdboom

mdboom commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

/ok to test ce9fb70

@github-actions

Copy link
Copy Markdown

@mdboom mdboom added the CI/CD CI/CD infrastructure label Aug 13, 2026
@mdboom
mdboom merged commit 8457bb0 into NVIDIA:main Aug 13, 2026
113 of 114 checks passed
@atiaomar1978-hub

Copy link
Copy Markdown
Contributor Author

Thanks @mdboom

github-actions Bot pushed a commit that referenced this pull request Aug 14, 2026
Removed preview folders for the following PRs:
- PR #2463
- PR #2474
- PR #2479
- PR #2522
- PR #2551
- PR #2601
- PR #2608
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI/CD CI/CD infrastructure cuda.bindings Everything related to the cuda.bindings module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cuda.bindings: make cythonization warnings clean

3 participants