Cache-DiT is a PyTorch inference engine for DiT models, with caching, parallel processing, quantization, and CPU offloading. It is for running diffusion-model pipelines with support for systems and hardware such as Diffusers, SGLang Diffusion, vLLM-Omni, ComfyUI, NVIDIA GPUs, Ascend NPUs, and AMD GPUs.
Borrowing it
Nothing to install: this file belongs to vipshop/cache-dit. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/vipshop/cache-dit/main/.agents/skills/cache-dit-custom-kernel/SKILL.mdgit clone --depth 1 https://github.com/vipshop/cache-ditWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/vipshop/cache-dit/cache-dit-custom-kernel)<a href="https://agentmods.dev/skills/vipshop/cache-dit/cache-dit-custom-kernel"><img src="https://agentmods.dev/badge/skills/vipshop/cache-dit/cache-dit-custom-kernel/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/vipshop/cache-dit/cache-dit-custom-kernel"><img src="https://agentmods.dev/badge/skills/vipshop/cache-dit/cache-dit-custom-kernel.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00136 | $0.03976 |
| Opus 5.5 | $0.00054 | $0.01590 |
| Sonnet 5.5 | $0.00027 | $0.00795 |
| Haiku 4.5 | $0.00014 | $0.00398 |
Grade A, and why
cache-dit-custom-kernel scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured today.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 179 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Cache-DiT 自定义算子开发与优化
使用范围与路由
本 skill 处理 csrc/kernels/ 下所有算子族(现有 comm、attn、svdq,目前全部是 CUDA/CuTe C++ kernel)的接入、移植、构建、profile 与优化。读完本节再动手:
| 任务 | 判据 | 读哪里 |
|---|---|---|
| 接入新算子 / 新算子族 | 要新建 csrc/kernels/<族>/ 下的文件,或要动 setup.py 的源清单/扩展/schema 注册 |
references/kernel-integration-chain.md |
| 从上游仓库移植算子 | 有 nunchaku / deepcompressor / flashinfer 参照实现 | references/operator-migration.md |
| 改现有算子实现 | 只改 .cu/.cuh/.h,schema、setup.py、Python 包装都不动 |
本文 §5 + 该族 Python 模块 + 对应测试 |
| 性能优化 | 数值契约与链路不变 | 本文 §6;SVDQ 另读下列三份 ref |
| SVDQuant 原理 | 推导、误差上界、scale 粒度、低秩残差 | references/svdquant-mathematics.md |
SVDQ 专项参考,修改 NVFP4 CuTe 路径前先读:
references/svdq-nvfp4-cute.md:当前实现、有效/无效尝试和实测性能。references/rfc-cuda-optimizations.md:优化门槛、待办、状态更新规则。references/svdq-nvfp4-cute-tma-sync-analysis.md:TMA/mbarrier、warp/block 同步、K-block 软件流水及 CUTLASS/FlashInfer SM120 对照;做 SVDQ CuTe GEMM 调度与性能优化前先读。
原理路由:先读 references/svdquant-mathematics.md 的 §1–4 建立记号并复核推导与成立条件,需要落到当前实现时读 §5,评估 TurboQuant / DVD-Quant 是否可借鉴时读 §6–8;性能结论与数值契约仍以 references/svdq-nvfp4-cute.md 为准。
配合 cuda-auto-tune(NCU 驱动迭代优化)、cuda-cpp-kernel(CUDA/PTX/架构细节)、cutlass-cpp-kernel(CUTLASS/CuTe C++ 模板)、cute-dsl-kernel(CuTe DSL Python kernel 编写)使用。本仓目前没有 CuTe DSL 算子;将来引入时,kernel 编写走 cute-dsl-kernel,接入、注册与构建仍走本 skill。NCU 优化必须先 profile 后修改,再复采验证。
算子形态现状与后端边界:仓库当前只有纯 CUDA/CuTe C++ kernel(csrc/kernels/),没有 Triton,也没有 CuTe DSL 算子。后续可能引入 CuTe DSL(@cute.kernel)算子,但必须先补齐 Python 侧注册、扩展构建与打包这条链再落地;Triton 明确不支持,不要新增,也不要恢复 kernels/backend.py 之类后端选择层。上游只有 Triton 实现时,读算法后用 CUDA 重写。细则与反模式见 references/operator-migration.md §1、§9。
1. 分层架构(所有算子族共用)
内部调用点
-> torch.ops.cache_dit_cuda_ops.<op> Python 侧 torch.library:dispatch / fake / compile
-> kernels/_<族>.py @torch.library.impl(..., "CUDA") 元数据校验 + 建输出
-> _call_<op>() out-param 桥 + 签名归一化
-> _C_<族>.ops.<op> pybind 子模块
-> csrc/kernels/<族>/<TU>.cpp -> <kernel>.cu TORCH_CHECK + launch
What ships with it
6 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- today First seen · 179 lines · 136 tokens per session scan A 5af9d548ad38
cache-dit-custom-kernel is a skill published in the GitHub repository vipshop/cache-dit (1,300 stars, last pushed today), licensed Apache-2.0. It adds 136 tokens to every session and 3,976 once invoked, about $0.0005 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-11-06.
cache-dit-custom-kernel compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| cache-dit-custom-kernelvipshop/cache-dit | Skill | 1.3k | today | Apache-2.0 | A | 136 | Claude Code |
| ax-cpp-aiax-llm/ax | Skill | 3.0k | 3d ago | Apache-2.0 | A | 47 | Claude Code, Codex |
| ax-cpp-genax-llm/ax | Skill | 3.0k | 3d ago | Apache-2.0 | A | 48 | Claude Code, Codex |
| ax-cpp-signatureax-llm/ax | Skill | 3.0k | 3d ago | Apache-2.0 | A | 37 | Claude Code, Codex |
| ax-cpp-typesafeax-llm/ax | Skill | 3.0k | 3d ago | Apache-2.0 | A | 57 | Claude Code, Codex |
| ax-cpp-gepaax-llm/ax | Skill | 3.0k | 3d ago | Apache-2.0 | A | 39 | Claude Code, Codex |
| cuda-kernelshuggingface/kernels | Skill | 783 | yesterday | Apache-2.0 | A | 120 | Claude Code |