cuda-python icon indicating copy to clipboard operation
cuda-python copied to clipboard

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

Open atiaomar1978-hub opened this issue 4 months ago • 1 comments

Summary

  • Clear the Cython warnings that blocked enabling warning_errors for cuda.bindings (Fixes #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)
  • Add source-level regression tests for these patterns

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

  • [x] Local Cythonize of cuda.bindings with warning_errors=True succeeds (27 extensions)
  • [x] pytest cuda_bindings/tests/test_cython_warning_cleanliness.py — 4 passed
  • [x] toolshed/check_generated_file_seals.py passes for updated cudla.{pxd,pyx}
  • [ ] CI source builds for cuda.bindings on Linux/Windows

atiaomar1978-hub avatar Jul 31 '26 04:07 atiaomar1978-hub

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.

copy-pr-bot[bot] avatar Jul 31 '26 04:07 copy-pr-bot[bot]

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 #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)

atiaomar1978-hub avatar Aug 04 '26 18:08 atiaomar1978-hub

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.

juenglin avatar Aug 04 '26 23:08 juenglin

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.

atiaomar1978-hub avatar Aug 04 '26 23:08 atiaomar1978-hub