Add how to cache model stuff to AGENTS.md (#16003)

This commit is contained in:
comfyanonymous
2026-08-31 16:09:43 -07:00
committed by GitHub
parent 95d755cd81
commit a8b4fa6410

View File

@@ -297,6 +297,12 @@
- Avoid caches that persist across different executions as much as possible.
Persistent caches are acceptable only when they use a very minimal amount of
memory and have a clear ownership and invalidation story.
- When condition-dependent model work would otherwise repeat on every denoising
step and preprocessing it once materially improves performance, expose a
model preprocessing method and call it from `BaseModel.extra_conds`, following
patterns such as LTXAV and Anima. Pass the result through normal conditioning;
do not add model-owned caches, sampler-option caches, or cache-management
wrappers for this work.
- When optimizing, favor small measurable changes: fewer allocations, fewer
device transfers, less peak memory, better batching, or use of a faster
existing backend op.