Python API Naming Conventions
These rules apply to every new public op API: any op name added to
test/python/api_index/api_index.txt. The graph API (cudnn.pygraph and its
enums) is out of scope. Existing names keep working; renaming them is part of
the API pruning plan, not this document.
Name pattern
<op_name>: the operation in snake_case, such asgrouped_gemm_gluorsdpa.jax: marks the JAX variant. The PyTorch variant has no framework token.standalone: marks the framework-free variant, which takes raw device pointers and a stream instead of framework tensors.<direction>:forwardorbackward. Every op has a direction, including an op without a backward.
Each name is a function exported from cudnn.ops or from one of its families.
Ops are imperative: forward and backward are separate calls.
Families
A family groups related ops under cudnn.ops.<family>:
Make a family when either holds:
- The ops are distinct steps that compose into one model block, such as DSA’s indexer, top-k and sparse attention.
- The ops share public input types, such as GNN’s
CscGraphand its aggregation enums.
Otherwise the op stays flat in cudnn.ops. An op with its variants or helpers
is still one op: dtype paths, causal_conv1d_update, and the linear-attention
*_summary ops stay flat. Being used by the same model is not enough.
Inside a family:
- Drop the family name from the op name:
cudnn.ops.dsa.indexer_forward, notcudnn.ops.dsa.dsa_indexer_forward. - Export the family’s shared types from the family:
cudnn.ops.gnn.CscGraph. - Do not nest families.
Families: dsa (DeepSeek sparse attention, including the CSA/HCA compressor),
nsa (native sparse attention) and gnn.
Rules
- Functions only. Do not export op classes. Exported op classes such as
GroupedGemmSwigluSm100are legacy. Input types such asCscGraphare not ops. - No
wrapperin names. The function is the framework op;wrapperadds nothing. - Spell out the direction. Use
forward/backward, neverfwd/bwd. - Keep implementation details out of names. Do not add an architecture
(
sm90,sm100, …) or an implementation technology (dsl,cutedsl,frost,triton, …). The function dispatches internally and raises a clear error for an unsupported configuration. - Ops live in
cudnn.ops. Do not add op APIs to the top-levelcudnnpackage,cudnn.torch,cudnn.jax, or an op package such ascudnn.gemm; a JAX variant is marked by a_jaxsuffix, and a family is a subpackage ofcudnn.ops. Existing exports keep working until the API pruning plan retires them.