[Fix] Wire cudac bindings#105
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors Pybind11 module definitions by removing them from the individual SM100 and SM90 CUDA source files and consolidating them into a shared csrc/api/pybind.cu file. However, sharing the exact same source file across multiple CUDAExtension modules in setup.py causes a critical build collision and caching issue in setuptools due to differing preprocessor definitions. To prevent linker errors and incorrect bindings, it is recommended to use separate lightweight wrapper files for each extension that include the shared pybind file.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
Hi @cherhh, please test the fat package build command to make sure it doesn't break it. # Build fat wheel (SM90 + SM100 + SM103):
CULA_BUILD_ALL_ARCHS=1 python -m build --wheel --no-isolation |
Tested with: CULA_BUILD_ALL_ARCHS=1 python -m build --wheel --no-isolationKey output: Successfully built The resulting wheel contains: Both extension modules import successfully and expose the expected bindings. The separate pybind_sm100.o and pybind_sm90.o objects confirm that the object-file reuse issue is fixed. |
📌 Description
This PR fixes the Python bindings used by
setup.pybuilds for the SM90 and SM100/SM103 prefill extensions.#86 added two optional prefill arguments and moved the binding definitions into
csrc/api/pybind.cu, where their names and default values are defined. However, that new binding file was not wired into the CUDA extension sources, so source builds still used the legacy unnamed bindings. As a result:This PR wires the shared binding file into both architecture-specific extensions, enables the SM100/SM103 binding guards from
setup.py, and removes the duplicate legacyPYBIND11_MODULEblocks.No kernel computation or routing logic is changed.
🔍 Related Issues
Follow-up to #86.
🚀 Pull Request Checklist
Thank you for contributing to cuLA! Before we review your pull request, please make sure the following items are complete.
✅ Pre-commit Checks
pre-commitby runningpip install pre-commit(or used my preferred method).pre-commit install.pre-commit run --all-filesand fixed any reported issues.pre-commit run --all-filesandgit diff --checkboth pass.🧪 Tests
Validation performed on an H100:
The remaining failure is pre-existing and hardware-dependent:
test_cp_bypass_matches_basic[128K + 5×1K, H=8]. On a 132-SM H100, the CP heuristic engages, while the test table expects a bypass. The assertion fails in a pure-Python precondition before any kernel runs, so it is independent of this binding change.⚡ Performance
Not applicable. This PR only fixes extension binding and build wiring; no kernel computation or routing logic is changed.
Reviewer Notes
The SM90 and SM100/SM103 extensions now use the shared bindings in
csrc/api/pybind.cuinstead of separate legacyPYBIND11_MODULEblocks.