nvidia/ad-add-fusion-transformation
> transforms under transform/library/ in a TensorRT-LLM checkout. Prefer existing kernels and custom ops; use Triton only when no viable existing-kernel path exists. Use ad-graph-dump for AD_DUMP_GRAPHS_DIR workflows. Covers TRT-LLM paths, registry, default.yaml registration, graph validation, tests, and a review checklist — without prescribing profiling tools or throughput targets.
npx skills add https://github.com/NVIDIA/TensorRT-LLM --skill ad-add-fusion-transformation
This file lives in the trtllm-agent-toolkit plugin. Paths such as tensorrt_llm/..., examples/auto_deploy/..., and tests/... are relative to a TensorRT-LLM source checkout on the user’s machine — not the plugin tree.
After installing the plugin (see the toolkit README.md), skills use the trtllm-agent-toolkit: prefix (for example trtllm-agent-toolkit:ad-add-fusion-transformation).
| Skill | Use it for |
|-------|------------|
| ad-graph-dump | Enabling AD_DUMP_GRAPHS_DIR, dump file layout, and how to read SSA graph output. |
| trtllm-codebase-exploration | Mapping existing transforms, custom ops, and search patterns before writing a pass. |
| trtllm-code-contribution | TensorRT-LLM pre-commit, tests, DCO sign-off, and PR expectations. |
| triton-kernel-writing | Implementing a Triton op only after existing-kernel lookup fails. |
| triton-tileir-optimization | Tuning existing Triton kernels for the TileIR backend when that path applies. |
Use this skill when you already know which subgraph or pattern you are targeting (from graph dumps, logs, or code reading). For dump capture and file semantics, follow ad-graph-dump first.
Do this before writing a new pass so you work on real graph structure.
AD_DUMP_GRAPHS_DIR set (see ad-graph-dump).default.yaml overlays).found / not_found), recommendation (use_existing_kernel, needs_triton_fallback, defer), and trade-offs (complexity, correctness risk).Candidate: <short-name>
Affected graph pattern: <pattern>
Existing kernel lookup: <found|not_found>
Evidence: <path/symbol>
Recommendation: <use_existing_kernel|needs_triton_fallback|defer>
Strengths / weaknesses / risks:
- ...
defer and narrow the question with one more dump or test.default.yaml entry, optional model-registry YAML.existing_kernel_path vs triton_fallback_path (or other kernel stack).[SUMMARY] matches=... before/after from AutoDeploy logs, test results.transform/library/, custom_ops/, torch.ops.auto_deploy.*, and related tests for reuse.tensorrt_llm/_torch/auto_deploy/transform/library/tensorrt_llm/_torch/auto_deploy/transform/interface.pytensorrt_llm/_torch/auto_deploy/config/default.yamltensorrt_llm/_torch/auto_deploy/utils/graph_writer.pytensorrt_llm/_torch/auto_deploy/utils/node_utils.py, tensorrt_llm/_torch/auto_deploy/utils/_graph.pytensorrt_llm/_torch/auto_deploy/custom_ops/Tests (typical):
tests/unittest/auto_deploy/singlegpu/transformations/library/tests/integration/defs/accuracy/test_llm_api_autodeploy.py (when behavior or numerics may change)Create or update a module under transform/library/ and register the class:
@TransformRegistry.register("my_transform_key")
class MyTransform(BaseTransform):
@classmethod
def get_config_class(cls):
return MyTransformConfig
Use a dedicated config class only when the pass needs parameters beyond the base transform config.
default.yamlAdd a key under transforms: in tensorrt_llm/_torch/auto_deploy/config/default.yaml. Copy the field set from the closest existing transform in the same section of the file (required keys depend on the transform config class and on how peers are declared). New experimental passes should stay enabled: false until covered by tests and dumps.
For targeted rollout, adjust registry YAMLs under examples/auto_deploy/model_registry/configs/ rather than turning on unproven passes globally.
torch.ops.auto_deploy entries.node.meta when an edge should carry it.Before Triton:
transform/library/ and custom_ops/.torch.ops.auto_deploy.* and TRT-LLM custom op definitions.Use triton-kernel-writing only when no suitable op exists and you accept owning kernel + integration work.
AutoDeploy logs [SUMMARY] matches=<n> (or skipped / disabled) per transform. Compare before and after your change; a large drop usually indicates pattern or metadata issues, not “slow runs.”
Follow trtllm-code-contribution for repo conventions. Cover:
Primary unittest location for library transforms:
tests/unittest/auto_deploy/singlegpu/transformations/library/default.yaml consistently with peer entries.matches where expected, or skipped is explained.Candidate: <name>
Path: <existing_kernel_path|triton_fallback_path|other>
Rationale:
- ...
Graph validation: <pass|fail — what files / ops>
Summary logs: <matches before / after>
Tests: <what ran>
Open risks:
- ...
Take nvidia/ad-add-fusion-transformation from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.