Skip to main content

Module graph

Module graph 

Source
Expand description

cuDNN v9 frontend graph builder — Rust-level “spec” objects that describe a backend descriptor DAG (tensors → ops → operation graph → engine config → execution plan) plus a plan cache keyed on op-shape signatures.

The spec layer is fully host-buildable. The actual cudnnBackendCreateDescriptor / cudnnBackendFinalize calls live in [Self::build_into] which only fires when a real cuDNN handle is plumbed in. Unit tests round-trip the spec without touching FFI.

§What we build

TensorSpec*  ──► OpSpec  ──► OperationGraphSpec
                                  │
                                  ▼
                      EngineHeurSpec ──► EnginecfgSpec
                                             │
                                             ▼
                                      ExecutionPlanSpec
                                             │
                                             ▼
                                      VariantPackSpec

Plan-cache key is op-kind + dtype + tensor-spec digest, so two requests with identical shapes hit the same cached plan.

Structs§

CachedPlan
Cached execution-plan handle. On a host without cuDNN this is just a marker that “this signature was prepared” — the actual BackendDescriptor lives only on a real GPU build.
OperationGraphSpec
Top-level operation graph.
PlanCache
LRU plan cache. The cuDNN actor wraps this in a Mutex and shares one instance across all op kinds — entries are tagged by op_kind in the key.
PlanCacheKey
Plan-cache key: op-kind + dtype + signature digest. Compact (24 bytes) so the LRU lookup is cheap.
TensorSpec
One tensor in a backend graph: unique id, dtype, dims, strides, alignment.

Enums§

DtypeTag
cuDNN scalar dtype tag, decoupled from a T: CudaDtype parameter so spec-level objects are dyn-friendly.
NormMode
Normalisation kind.
NormPhase
Normalisation training phase.
OpSpec
One op in a backend graph. Each OpSpec references TensorSpecs by their uid; the actual TensorSpec values live on the parent OperationGraphSpec.
PointwiseMode
Pointwise op mode.
PoolKind
Pooling kind.
ReduceOp
Reduction op tag.
TensorLayout
Tensor layout: NCHW, NHWC, or fully arbitrary nd-strided.

Constants§

DEFAULT_PLAN_CACHE_SIZE
Default LRU capacity for the plan cache (matches the existing cuDNN ConvForward cache + cuBLASLt heuristic cache).

Functions§

cache_key
Build a PlanCacheKey from an op-kind tag + dtype + an OperationGraphSpec. The signature is the full graph digest.