Skip to content

Reshape: apply the runtime version guard to the legacy OperationBuilder_v8 too - #467

Merged
Anerudhan merged 1 commit into
NVIDIA:developfrom
YangXu1990uiuc:yanxu/reshape-legacy-builder-runtime-guard
Aug 3, 2026
Merged

Reshape: apply the runtime version guard to the legacy OperationBuilder_v8 too#467
Anerudhan merged 1 commit into
NVIDIA:developfrom
YangXu1990uiuc:yanxu/reshape-legacy-builder-runtime-guard

Conversation

@YangXu1990uiuc

@YangXu1990uiuc YangXu1990uiuc commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

Follow-up to the graph-API fix already on develop, which gates
CUDNN_ATTR_OPERATION_RESHAPE_MODE on detail::get_backend_version() in
cudnn_frontend/node/reshape.h.

The legacy OperationBuilder_v8 reshape at cudnn_frontend_Operation.h:1808 has the identical
defect and is worse off: reshape_mode defaults to ReshapeMode_t::VIEW_ONLY rather than
NOT_SET (:240), so the existing if (reshape_mode != NOT_SET) guard is always true and every
legacy reshape sends the attribute to whatever runtime is loaded. Against a pre-9.22 library that
returns CUDNN_STATUS_BAD_PARAM and fails the operation.

Same shape of fix, same reasoning about semantics: skipping the attribute on a pre-9.22 runtime
reproduces that runtime's only behaviour, which is view-only. An explicit ReshapeMode_t::LOGICAL
request cannot be honoured there, so it is refused rather than silently downgraded.

It does not show up in an SDPA reproducer — the SDPA nodes use the graph API — which is why it was
missed when the graph-API half was fixed.

Setting attribute 2202 in isolation reproduces the underlying split: BAD_PARAM on 9.13.1 / 9.18.0 /
9.21.0, success on 9.22.0. The graph-API half was verified end to end by driving an SDPA-backward
graph through validate → build_operation_graph → create_execution_plans → check_support with the
frontend headers held constant and only the runtime library swapped; this half has no SDPA path to
exercise, so it is justified by symmetry with that fix rather than by its own A/B.

Found by an independent review of the graph-API patch.

Summary by CodeRabbit

  • Bug Fixes
    • Improved reshape operation compatibility across cuDNN runtime versions.
    • Explicit logical reshapes now report unsupported status on older runtimes.
    • View-only reshapes continue to work on older runtimes without unsupported settings.
    • Newer runtimes retain configured reshape-mode behavior.

…er_v8 too

The graph-API reshape node already gates CUDNN_ATTR_OPERATION_RESHAPE_MODE on
detail::get_backend_version(). The v8 builder has the identical defect and is worse
off: its reshape_mode member defaults to ReshapeMode_t::VIEW_ONLY rather than
NOT_SET (cudnn_frontend_Operation.h:240), so the existing `if (reshape_mode !=
NOT_SET)` guard is always true and every legacy reshape sends the attribute to
whatever runtime is loaded. Against a pre-9.22 library that returns BAD_PARAM and
fails the operation.

Same shape of fix and same reasoning about semantics: skipping the attribute on a
pre-9.22 runtime reproduces that runtime's only behaviour, which is view-only. An
explicit LOGICAL request cannot be honoured there, so it is refused rather than
silently downgraded.

This does not show up in an SDPA repro because the SDPA nodes use the graph API,
which is why it was missed when the graph-API half was fixed.
@coderabbitai

coderabbitai Bot commented Aug 1, 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: 42847e92-4c49-4128-9e9b-98aae6827692

📥 Commits

Reviewing files that changed from the base of the PR and between 073ce27 and 7f39568.

📒 Files selected for processing (1)
  • include/cudnn_frontend_Operation.h

📝 Walkthrough

Walkthrough

The reshape operation builder now checks the cuDNN runtime version. It rejects explicit logical reshapes before version 9.22, omits the reshape-mode attribute for legacy view-only reshapes, and preserves configured mode handling on newer runtimes.

Changes

Reshape mode compatibility

Layer / File(s) Summary
Runtime reshape-mode handling
include/cudnn_frontend_Operation.h
The builder applies version-specific behavior for logical and view-only reshape modes.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested labels: cat-bug, mod-frontend, orig-nv-eng

Suggested reviewers: anerudhan

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the reshape change and the runtime version guard applied to the legacy builder.
Description check ✅ Passed The description clearly explains the change, problem, rationale, compatibility behavior, and testing context, although it does not use all template headings.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@Anerudhan Anerudhan added cat-bug Reports of incorrect behavior, crashes, regressions, or unexpected results. mod-frontend cuDNN frontend APIs, operation graph construction, plans, and user-facing wrappers. orig-nv-eng Reported or requested by NVIDIA engineering. labels Aug 3, 2026
@Anerudhan Anerudhan added this to the Frontend 1.27.0 milestone Aug 3, 2026
@Anerudhan
Anerudhan merged commit f4cf2fe into NVIDIA:develop Aug 3, 2026
1 check passed
@YangXu1990uiuc
YangXu1990uiuc deleted the yanxu/reshape-legacy-builder-runtime-guard branch August 3, 2026 22:49
@Anerudhan Anerudhan mentioned this pull request Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cat-bug Reports of incorrect behavior, crashes, regressions, or unexpected results. mod-frontend cuDNN frontend APIs, operation graph construction, plans, and user-facing wrappers. orig-nv-eng Reported or requested by NVIDIA engineering.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants