Skip to content

fix(cudnn): remove duplicate ConvBwdData match arm in backend graph builder#372

Merged
LegNeato merged 1 commit intoRust-GPU:mainfrom
CharryWu:fix/cudnn-backend-graph-duplicate-arm
Apr 1, 2026
Merged

fix(cudnn): remove duplicate ConvBwdData match arm in backend graph builder#372
LegNeato merged 1 commit intoRust-GPU:mainfrom
CharryWu:fix/cudnn-backend-graph-duplicate-arm

Conversation

@CharryWu
Copy link
Copy Markdown
Contributor

@CharryWu CharryWu commented Mar 31, 2026

Summary

Removes a duplicate unreachable match arm in the cuDNN backend graph builder.

Problem

In GraphBuilder::build(), the operations iterator map had two identical arms for Operation::ConvBwdData. The second arm was unreachable dead code and would generate a compiler warning under strict linting.

Change

Remove the duplicate arm. All seven operation variants (ConvBwdData, ConvBwdFilter, ConvFwd, MatMul, Pointwise, Reduction) are now each matched exactly once.

Testing

  • cudnn crate compiles cleanly (Compiling cudnn v0.1.0 passes)
  • One-line change, no logic affected

Flow Diagrams

crates/cudnn/src/lib.rs
└── mod backend  (src/backend/mod.rs)
    ├── descriptor.rs    ─── Descriptor (Rc<Inner> wrapping cudnnBackendDescriptor_t)
    ├── operation.rs     ─── Operation enum (the 6 DNN operation types)
    ├── graph.rs         ─── GraphBuilder → Graph  ◄── PR #372 fix here
    ├── engine_heuristic.rs  ─── HeuristicMode (picks best engine for a graph)
    ├── engine.rs / engine_cfg.rs  ─── Engine configuration
    ├── execution_plan.rs    ─── ExecutionPlan (final executable plan)
    ├── tensor.rs            ─── Tensor descriptors
    ├── conv_fwd.rs          ─── ConvFwd operation builder
    ├── conv_bwd_data.rs     ─── ConvBwdData operation builder
    ├── conv_bwd_filter.rs   ─── ConvBwdFilter operation builder
    ├── matmul.rs            ─── MatMul operation builder
    ├── pointwise.rs         ─── Pointwise operation builder
    └── reduction.rs         ─── Reduction operation builder

Data flow for cuDNN backend graph execution:

 ┌─────────────────────────────────────────────────────────────────────┐
 │                     User-facing build pipeline                      │
 │                                                                     │
 │  Tensor ──┐                                                         │
 │  Tensor ──┼──► Operation (ConvFwd / ConvBwdData / MatMul / ...)     │
 │  ConvCfg ─┘         │                                               │
 │                     ...  (repeat for each op)                       │
 │                      │                                              │
 │                      ▼                                              │
 │              Vec<Operation>                                         │
 │                      │                                              │
 │  CudnnContext ───┐   │                                              │
 │                  ▼   ▼                                              │
 │              GraphBuilder                                           │
 │                  │                                                   │
 │                  │  .build()                                         │
 │                  ▼                                                   │
 │  ┌───────────────────────────────┐                                  │
 │  │  Graph                        │                                  │
 │  │  ├─ descriptor (finalized)    │  Wraps CUDNN_BACKEND_            │
 │  │  ├─ context                   │  OPERATIONGRAPH_DESCRIPTOR       │
 │  │  └─ operations                │                                  │
 │  └───────────────┬───────────────┘                                  │
 │                  │                                                   │
 │                  ▼                                                   │
 │          EngineHeuristic  (picks optimal algorithm)                 │
 │                  │                                                   │
 │                  ▼                                                   │
 │          EngineCfg  (configures chosen engine)                      │
 │                  │                                                   │
 │                  ▼                                                   │
 │          ExecutionPlan  (ready to execute on GPU)                   │
 └─────────────────────────────────────────────────────────────────────┘

…uilder

The operations iterator map in GraphBuilder::build() had two identical
Operation::ConvBwdData arms. The second arm was unreachable dead code.
Removed the duplicate; all seven operation variants are now matched once.

Made-with: Cursor
@CharryWu CharryWu marked this pull request as ready for review April 1, 2026 11:53
@CharryWu CharryWu requested a review from frjnn as a code owner April 1, 2026 11:53
@LegNeato LegNeato added this pull request to the merge queue Apr 1, 2026
Merged via the queue into Rust-GPU:main with commit 85ab9c2 Apr 1, 2026
9 checks passed
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.

3 participants