Fix -Werror=unused-parameter build failure in python/gnn.cpp against cudnn < 9.26 headers - #726
Fix -Werror=unused-parameter build failure in python/gnn.cpp against cudnn < 9.26 headers#726zkyue wants to merge 1 commit into
Conversation
…NN < 9.26 init_gnn_submodule(py::module_ &m) has its entire body gated on CUDNN_VERSION >= 92600. When building the python bindings from source against older cuDNN headers, the gate compiles the body out, the parameter is unused, and the -Werror build fails: python/gnn.cpp:71:33: error: unused parameter 'm' [-Werror=unused-parameter] Mark the parameter [[maybe_unused]]; the attribute is inert when the gate is open and the parameter is used. Signed-off-by: zky <kaiyue.zhou@z.ai>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review. 📝 WalkthroughWalkthroughThe GNN submodule initializer marks its module parameter with ChangesGNN warning cleanup
Estimated code review effort: 1 (Trivial) | ~2 minutes Merge Risk: ⚪ Minimal · up to This localized build-only change prevents Python bindings from failing under cuDNN headers older than 9.26 without changing runtime behavior or compatibility, so no actionable merge-blocking risk remains after normal checks and review. Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Full details: Description checkExplanation The description includes all required sections, explains the cause and fix, states compatibility impact, and provides detailed testing results. The GitHub labels checkbox is not selected, but the requested labels are explicitly listed and this is non-critical to the description content. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Before submitting
pre-commit runand committed any formatting changes.cat-*, one or moremod-*, and oneorig-*(see label list).(Requesting labels:
cat-bugfix,mod-frontend,orig-external— happy to adjust.)Affected area
Build, packaging, or installation (python bindings, source build only).
Summary
One-line fix: mark the
py::module_ &mparameter ofinit_gnn_submoduleas[[maybe_unused]]so the python bindings build from source against cuDNN headers older than 9.26.Why
init_gnn_submodule(py::module_ &m)inpython/gnn.cpphas its entire body gated on#if CUDNN_VERSION >= 92600 && !defined(_WIN32). When building against older cuDNN headers the gate compiles the body out,mbecomes unused, and the top-leveladd_compile_options(... -Werror ...)fails the whole python-binding build:Version matrix:
mused)[[maybe_unused]]is already used elsewhere in this codebase (e.g.include/cudnn_frontend_EngineFallbackList.h,include/cudnn_frontend/utils/attn_score_modifiers.h) and is inert when the gate is open and the parameter is used.I swept the rest of the tree for the same pattern (a
CUDNN_VERSIONgate compiling out a whole function body and orphaning a parameter):python/pycudnn.cpp's version gates sit insidePYBIND11_MODULEwheremis used unconditionally, and the gatedTEST_CASEbodies insamples/take no parameters —python/gnn.cppis the only instance.Related issues
None filed; hit while building the python bindings from source on a machine with cuDNN 9.23.
API and compatibility impact
None. Attribute-only change; no behavior, API, or ABI impact for any cuDNN version.
Testing
On Linux x86_64, gcc 13.3.0, CMake 3.31.6, python 3.12, cuDNN 9.23 headers (
/usr/include/x86_64-linux-gnu), clean environment (noCXXFLAGS/CFLAGSoverrides):cmake -S . -B build -GNinja -DCUDNN_FRONTEND_BUILD_PYTHON_BINDINGS=ON -DCUDNN_FRONTEND_BUILD_SAMPLES=OFF -DCUDNN_FRONTEND_BUILD_TESTS=OFF && cmake --build build --target _compiled_modulefails with the error above.
python3 -m pip wheel . --no-deps(the standard source wheel build) succeeds on the fixed tree against the same 9.23 headers.CUDNN_FRONTEND_BUILD_SAMPLES=ON,CUDNN_FRONTEND_BUILD_TESTS=ON) also compiles cleanly under-Werroragainst 9.23 headers.[[maybe_unused]]is attribute-only and inert by construction (it merely suppresses the diagnostic; the parameter is used).pre-commit run --files python/gnn.cpp: clang-format passed, no reformatting.Summary by CodeRabbit