Skip to content

Fix -Werror=unused-parameter build failure in python/gnn.cpp against cudnn < 9.26 headers - #726

Open
zkyue wants to merge 1 commit into
NVIDIA:developfrom
zkyue:fix/gnn-submodule-unused-param
Open

Fix -Werror=unused-parameter build failure in python/gnn.cpp against cudnn < 9.26 headers#726
zkyue wants to merge 1 commit into
NVIDIA:developfrom
zkyue:fix/gnn-submodule-unused-param

Conversation

@zkyue

@zkyue zkyue commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Before submitting

  • I agree to license this contribution under the terms of LICENSE.txt.
  • I ran pre-commit run and committed any formatting changes.
  • I added GitHub labels: one cat-*, one or more mod-*, and one orig-* (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_ &m parameter of init_gnn_submodule as [[maybe_unused]] so the python bindings build from source against cuDNN headers older than 9.26.

Why

init_gnn_submodule(py::module_ &m) in python/gnn.cpp has its entire body gated on #if CUDNN_VERSION >= 92600 && !defined(_WIN32). When building against older cuDNN headers the gate compiles the body out, m becomes unused, and the top-level add_compile_options(... -Werror ...) fails the whole python-binding build:

python/gnn.cpp: In function 'void cudnn_frontend::python_bindings::init_gnn_submodule(pybind11::module_&)':
python/gnn.cpp:71:33: error: unused parameter 'm' [-Werror=unused-parameter]
   71 | init_gnn_submodule(py::module_ &m) {
      |                    ~~~~~~~~~~~~~^
cc1plus: all warnings being treated as errors

Version matrix:

cuDNN headers at build time result
>= 9.26 builds fine (gate open, m used)
< 9.26 (e.g. 9.23, 9.24) build fails as above
published wheels unaffected (built with new cuDNN)

[[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_VERSION gate compiling out a whole function body and orphaning a parameter): python/pycudnn.cpp's version gates sit inside PYBIND11_MODULE where m is used unconditionally, and the gated TEST_CASE bodies in samples/ take no parameters — python/gnn.cpp is 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 (no CXXFLAGS/CFLAGS overrides):

  • Before the fix (stock develop @ 139b154):
    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_module
    fails with the error above.
  • After the fix: same build succeeds.
  • python3 -m pip wheel . --no-deps (the standard source wheel build) succeeds on the fixed tree against the same 9.23 headers.
  • Full default-target build (CUDNN_FRONTEND_BUILD_SAMPLES=ON, CUDNN_FRONTEND_BUILD_TESTS=ON) also compiles cleanly under -Werror against 9.23 headers.
  • No >= 9.26 header set was available to me for the open-gate arm; there [[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

  • Chores
    • Made an internal code-quality adjustment with no changes to runtime behavior or the public Python API.

…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>
@coderabbitai

coderabbitai Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: ddffe806-b93a-464a-8041-217dc65510e8

📥 Commits

Reviewing files that changed from the base of the PR and between 139b154 and e777eb4.

📒 Files selected for processing (1)
  • python/gnn.cpp

Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review.


📝 Walkthrough

Walkthrough

The GNN submodule initializer marks its module parameter with [[maybe_unused]]. Runtime behavior and the public Python API remain unchanged.

Changes

GNN warning cleanup

Layer / File(s) Summary
Annotate unused initializer parameter
python/gnn.cpp
init_gnn_submodule marks parameter m as [[maybe_unused]].

Estimated code review effort: 1 (Trivial) | ~2 minutes

Merge Risk: ⚪ Minimal · up to e777e

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: tingyu66

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the unused-parameter build failure, the affected file, and the cuDNN header condition.
Description check ✅ Passed 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 requ…
Full details: Description check

Explanation

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)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@zkyue zkyue changed the title Before submitting Fix -Werror=unused-parameter build failure in python/gnn.cpp with cuDNN < 9.26 Aug 25, 2026
@zkyue zkyue changed the title Fix -Werror=unused-parameter build failure in python/gnn.cpp with cuDNN < 9.26 Fix -Werror=unused-parameter build failure in python/gnn.cpp against cudnn < 9.26 headers Aug 25, 2026
@Anerudhan Anerudhan added this to the Frontend 1.28.0 milestone Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants