rocm/rocm-libraries/hipdnn-codegen

Claude Code and agent skill by rocm/rocm-libraries

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Generate hipDNN operation boilerplate from a YAML config. Use when the user wants to add a new operation type to hipDNN, or generate descriptor/packer/unpacker code.

Install

npx vskill@latest install rocm/rocm-libraries/hipdnn-codegen

SKILL.md

The same SKILL.md was published earlier as rocm/rocm-libraries/hipdnn-codegen.

hipDNN Code Generator Skill

Generate all boilerplate code needed to add a new operation to hipDNN from a YAML config.

This skill is near-autonomous. The agent first tries to resolve everything itself by deriving from the schema, the existing codebase, and cudnn-frontend on GitHub. It may prompt the user as a fallback on three classes of decision where derivation has failed:

  1. cuDNN naming uncertainty — when the cuDNN equivalent descriptor / attribute / frontend-node name cannot be confidently identified after consulting cudnn-frontend (drives the _EXT decision; see Step 3a-i).
  2. `infer_properties_node()` strategy — output-shape inference rule, when the op's shape behavior isn't obvious from analogous ops.
  3. `pre_validate_node()` rules — additional validation beyond default null/dim checks, when domain-specific constraints aren't derivable.

In a clean, well-known op (cuDNN-aligned with a clear analog), the agent may not prompt at all on the three classes above.

There are two mandatory prompts:

  • Schema confirmation (Step 2a-ii), whenever the agent had to construct the FBS schema (from a user description, or from cudnn-frontend). Schema mistakes propagate through every layer, so the agent must show the schema and get explicit user sign-off before continuing. This prompt is skipped only when the user supplied a complete FBS file.
  • Work-model confirmation (Step 11, Class C), whenever the op has no logicalFlops decision in EngineFeatures.hpp yet: the FLOP formula, or "no counting convention" with a reason, and which operands are content-dependent (work_data_dependent). A missing or wrong answer degrades UHD heuristics without any build or test failure (no graph.flops, or a count that is not the declared problem's), so the agent proposes its derivation and gets explicit sign-off.

Everything else is mechanical and is derived from the FBS schema, existing codebase state, and the conventions in this skill.

For human-facing context, including the cuDNN parity rules, layer-by-layer reference, testing matrix, and PR checklist, see `projects/hipdnn/docs/AddingNewOperations.md`. For a complete worked example, see `configs/convolution_fwd.yaml`.

Philosophy

You MUST run the generator. The code generator exists to produce correct, pattern-matched boilerplate. Do not skip it and write code by hand — even if you think you understand the patterns well enough. The generator's output is the starting point for every file and fragment. If Bash access is unavailable or denied, stop and ask the user to grant it rather than proceeding without the generator.

After running the generator, the agent owns the integration. Generated output is scaffolding, not a finished product. Before placing any generated file or inserting any fragment, check if the target already exists in hipDNN. If it does, compare the generated version with the existing code. Use whichever is more correct, or merge them if each covers different parts. If a fragment's insertion point has changed, adapt the fragment to the current code structure.

Generated code is not always perfect. Enum value numbering may differ between the backend C-API, SDK, and frontend — use frontend_value and sdk_name overrides in enum_def to handle mismatches. Test patterns may need adjustment for unusual field types. Fragment insertion points are guidelines; always read the target file. But these are adjustments to generator output, not reasons to bypass the generator entirely.

The goal is a clean, building, tested integration. If generated code needs tweaks to compile, make them. If a fragment conflicts with existing code, resolve it. Judgment and adaptation are applied to generated output, not as a substitute for it.

When to Use Which Mode

ScenarioMode
Brand new operation (nothing exists yet)full
Adding backend only (frontend exists or will land later)backend
Adding frontend only (backend descriptor already exists)frontend

Arguments

  • $ARGUMENTS can contain:
  • Schema or operation: Path to .fbs schema file, path to existing YAML config, or operation name (e.g., convolution_fwd)
  • Mode (one of):
  • backend (default) - Descriptor, Packer, Unpacker + backend tests
  • frontend - Node, Attributes, Graph method + frontend tests
  • full - Everything (backend + frontend)

Directory Locations

Determine the hipDNN project root by finding the nearest parent directory containing tools/DescriptorGenerator/. Set paths relative to that:

HIPDNN_SRC=<path to projects/hipdnn>
CODEGEN=$HIPDNN_SRC/tools/DescriptorGenerator
VENV=$CODEGEN/.venv

Hint: if the current working directory is inside a rocm-libraries worktree, the hipDNN root is at <worktree>/projects/hipdnn/. If invoked from a standalone hipDNN checkout, it is the repo root.

Execution Steps

1. Parse Arguments and Set Up

Parse $ARGUMENTS for:

  • Schema path, config path, or operation name
  • Mode (default: backend)

Locate the hipDNN project root. Verify the codegen venv exists:

bash
cd $CODEGEN
if [ ! -d .venv ]; then
python3 -m venv .venv
.venv/bin/pip install -r requirements.txt
fi
2. Determine Input Type
  • If argument is a .fbs file path: proceed to Step 3 (create YAML config from schema)
  • If argument is a .yaml file path: skip to Step 5 (run generator)
  • If argument is an operation name and configs/<name>.yaml exists: skip to Step 5
  • If argument is an operation name and no FBS schema exists for it: proceed to Step 2a (author the FBS schema)
  • If the argument is unrecognized or ambiguous: ask the user to clarify
2a. Author the FBS Schema (if it does not exist)

Schemas live ONLY in $HIPDNN_SRC/flatbuffers_sdk/schemas/ (they were removed from data_sdk/). Before deriving the YAML, you may need to write the FBS schema yourself.

2a-i. Source the schema content

Pick the path that matches what the user provided:

  • User provided an FBS file → use it directly, skip to 2a-ii.
  • User provided a description (text listing inputs, outputs, attributes, modes) → translate it directly into the table, skip to 2a-ii.
  • User gave only an op name → derive the schema from cudnn-frontend on GitHub:
  1. Run the directory listing + node-file fetch from Step 3a-i to locate the matching cuDNN node header (e.g., include/cudnn_frontend/node/<op>.h).
  2. From that header, find the attributes class it references (e.g., Conv_fprop_attributes). Fetch its source — usually under include/cudnn_frontend/graph_properties.h or alongside the node header.
  3. Walk the attributes class:
  • Each tensor input/output method (typically set_<name>(...)) becomes a <name>_tensor_uid: long (cache_uid) field (long = null (cache_uid) when optional). Note which are required vs optional. Add work_data_dependent to the annotation ((cache_uid, work_data_dependent)) when the tensor's contents, not its shape, decide how much work the op does: valid lengths, page tables, block masks, routing offsets. An operand read densely whatever its values (an additive bias, a dropout seed) is not work-data-dependent. Declare each attribute used at file scope (attribute "cache_uid";, attribute "work_data_dependent";).
  • Each scalar/vector attribute (typically set_<attr>(...)) becomes a typed field with the matching cuDNN name.
  • Mode-style enums become a <field>: <Enum> field; capture the enum members from the cuDNN definition.
  1. Use the same naming as cuDNN (lowercase snake_case for fields, matching cuDNN attribute identifiers). Apply _EXT per the rule in Step 3a only to fields with no cuDNN equivalent.
  2. Write the draft schema to $HIPDNN_SRC/flatbuffers_sdk/schemas/<op_name>_attributes.fbs.
2a-ii. Confirm the schema with the user

When this prompt is required:

Schema sourceConfirmation required?
User supplied a complete FBS fileNo (they already authored it)
User supplied a description and the agent translated itYes
Agent derived from cudnn-frontendYes

When required, show the schema and the parsed structure, and get explicit sign-off via AskUserQuestion:

"Here is the FBS schema I will use for <op_name> (sourced from <description / cudnn-frontend URL>):
```flatbuffers
<full schema contents>
```
Tensor inputs: <list>. Tensor outputs: <list>. Optional fields: <list>. Mode enums: <list>. Work-data-dependent operands: <list or none>.
Confirm before I proceed: is this schema correct? (Yes / Edit-and-resend / No-rewrite)"

Do NOT proceed to 2a-iii until the user confirms. If the user requests edits, apply them and ask again. Schema mistakes propagate to every layer (FBS table, generated headers, descriptor, packer, unpacker, attributes class, node, tests) — fixing them late is expensive.

2a-iii. Wire the schema into the build

Once confirmed:

  1. Update `graph.fbs`:
  • Add include "<op_name>_attributes.fbs";
  • Add <Op>Attributes to the NodeAttributes union
  1. Update the `SCHEMAS` list in $HIPDNN_SRC/flatbuffers_sdk/CMakeLists.txt so the new schema is compiled into the SDK.
  2. Rebuild the FlatBuffers SDK target so the generated headers are present before the code generator runs:

``bash cd $HIPDNN_SRC/build # or your active build dir ninja hipdnn_flatbuffers_sdk ` (If no build dir exists yet, see [docs/Building.md`](../../../../../docs/Building.md) for first-time setup.)

After 2a-iii, proceed to Step 3.

3. Create YAML Config from FBS Schema

Read the FBS schema file. Map fields to YAML config following these rules:

FBS Field PatternYAML SectionYAML type
*_tensor_uid: longtensor_fields(tensors are UIDs)
*_tensor_uid: long (cache_uid, work_data_dependent)tensor_fields, with work_data_dependent: true(tensors are UIDs)
field: [long]data_fieldsvector_int64
field: SomeEnumdata_fieldsmode
field: floatdata_fieldsscalar_float
field: long (non-UID)data_fieldsscalar_int64
field: booldata_fieldsbool
field: [long] (array of UIDs)tensor_array_fields(tensor arrays; work_data_dependent as for tensor_fields)

Derive all config fields from the schema and existing codebase — do NOT ask the user for these. Use existing configs and backend code to determine:

  • Operation name: Derive from the FBS table name (e.g., ConvolutionFwdAttributes → ConvolutionFwd)
  • Descriptor type enum: Search $HIPDNN_SRC/backend/include/HipdnnBackendDescriptorType.h for existing enum entries
  • Operation attribute prefix: Search $HIPDNN_SRC/backend/include/HipdnnBackendAttributeName.h for existing HIPDNN_ATTR_OPERATION_* entries
  • Shared attributes: Compare attribute names against existing operations in the codebase
  • Compute data type: Check if the FBS schema has compute precision fields; check existing operations for patterns
  • Test tensor UIDs: Read existing configs in $CODEGEN/configs/ to find used UID ranges, pick the next available
  • Frontend fields (graph method name, NodeType, union type): Derive from existing frontend code or operation name conventions

If a field truly cannot be determined, use sensible defaults derived from the operation name. Only ask the user as a last resort for genuinely ambiguous decisions.

Write the config to $CODEGEN/configs/<operation>.yaml.

Use $CODEGEN/configs/convolution_fwd.yaml as the reference template for all config fields.

3a. cuDNN Naming Parity Check (_EXT Decision Rule)

Parity with cuDNN is nominal (names match) but not numeric (values do not align — pick the next free value as Step 3 already does).

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
441
Repository forks
420
7-day trend score
30

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/rocm/rocm-libraries/hipdnn-codegen/badge)](https://verified-skill.com/skills/rocm/rocm-libraries/hipdnn-codegen)

Something wrong with this skill or its page? Tell us.