cudnn-frontend / cudnn_frontend
AGENTS.md959 starsChanged 2 months agoApache-2.0View on GitHub
The header-only C++ library (CMake INTERFACE target cudnn_frontend, C++17). Umbrella header: include/cudnn_frontend.h. Build/test commands: ../../AGENTS.md. Legacy flat API (include/cudnn_frontend_*.h: Tensor, Operation, ExecutionPlan, Heuristics...) is maintained but frozen — new features target the graph API under this directory.
In this repository8 other files it gives its agents.
- AGENTS.mdAGENTS.md
- python/cudnn/AGENTS.mdAGENTS.md
- python/cudnn/sdpa/AGENTS.mdAGENTS.md
- samples/AGENTS.mdAGENTS.md
- test/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- llms.txtllms.txt
- cutedsl-kernel-integrationSkill
The file
Files
include/cudnn_frontend — Agent Guide
The header-only C++ library (CMake INTERFACE target cudnn_frontend, C++17). Umbrella header: include/cudnn_frontend.h. Build/test commands: ../../AGENTS.md.
Hard rules
- Header-only: no
.cppfiles, no link-time dependencies beyond cuDNN/CUDA. New third-party code must be vendored underthirdparty/(currently onlynlohmann/json.hpp, excludable viaCUDNN_FRONTEND_SKIP_JSON_LIB). - Builds with
-Wall -Wextra -Wpedantic -Werror(GCC/Clang) and/W4 /WX(MSVC) — code must be warning-clean on both. - C++17 only in
include/(the pybind11 layer underpython/is C++20). - Guard anything needing a newer cuDNN with runtime
detail::get_backend_version()checks (compare againstCUDNN_FRONTEND_VERSION-style integers, e.g. 9.12.0 → 91200); the same headers must compile against older cuDNN 9.x. Declare unconditionally, gate in the body: an#if-conditional declaration bakes the build-time cuDNN version into the artifact, so a wheel built against 9.23 silently loses the symbol on a 9.24 system — declare the API always and return not-supported at runtime instead (review on PR #246). - Guard new enum attributes with the header version, like the rest of the codebase. Wrap the use of an attribute that only exists from cuDNN X.Y on in
#if (CUDNN_VERSION >= XY00)with a not-supported#elsebranch, and keep the runtime backend version check (NV_CUDNN_FE_DYNAMIC_CHECK_CUDNN_BACKEND_VERSION) inside it. Only gate on a version whose released headers actually define the attribute;#ifdefcannot detect an enum constant, and guessing its integer value risks an ABI collision. - clang-format (Google-based, indent 4, 120 cols,
SortIncludes: false) viapre-commit run. - A backend correctness workaround belongs to the affected native support surface, not an unrelated frontend engine's admission. For SDPA block masks, test
AUTOand explicitUNIFIED, runtime versions below/at the fix, and unaffected architectures/no-mask controls. Mask contents are mutable device data; an all-visible validation sample cannot establish a safe reusable plan.SDPA block-mask backend support boundaryis the descriptor-only detector; actual numerical qualification must identify the loaded released backend artifact, not just its version label.
Layering
graph_interface.h Graph class (namespace cudnn_frontend::graph); includes every node/*.h
node/*.h one header per op node (matmul, conv_fprop, sdpa, rmsnorm, ...): <Op>Node + <Op>_attributes
node_interface.h INode base; graph_properties.h holds attribute classes
cudnn_interface.h ICudnn: lowering to cuDNN backend ops/plans
backend/ C-backend descriptor wrappers (execution plans, kernel cache, device properties)
plans.h, knobs.h, graph_helpers.h, context.h plan management, autotuning knobs, error handlingLegacy flat API (include/cudnn_frontend_*.h: Tensor, Operation, ExecutionPlan, Heuristics...) is maintained but frozen — new features target the graph API under this directory.
Adding a graph operation (typical shape)
node/<op>.h:<Op>_attributes(+NLOHMANN_DEFINE_TYPE_INTRUSIVE-style serialization where applicable) and the node class implementing infer/expand/lowering.- Wire into
graph_interface.h(include +Graph::<op>(...)builder method returning tensor attributes). - Serialization support in
utils/serialize.hif the op is cacheable. - Doc page in
docs/operations/, sample undersamples/cpp/, tests (C++ and/ortest/python/). - Python surface: pybind wrapper in
python/pygraph/when the op should be scriptable.
experimental/ and generated/
generated/holds open-sourced kernel source embedded as raw C++ string literals (inline constexpr const char <name>_source[], namespacecudnn_frontend::experimental::generated) — RMSNorm+SiLU. These files are large and machine-produced; don't hand-edit kernel bodies casually, and don't "clean them up".experimental/is the NVRTC glue that compiles those strings at runtime (IOssNormEngine:check_support/build/execute, per-arch engines,nvrtc_shim.h).
Versioning
cudnn_frontend_version.h defines CUDNN_FRONTEND_{MAJOR,MINOR,PATCH}_VERSION. Keep in sync with CMakeLists.txt project(VERSION ...) and python/cudnn/__init__.py.__version__ when bumping.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

