协作头脑风暴
brainstorming
在实现前澄清需求、探索设计选择,并形成清晰的开发方向。
runtime-optimization【开发与工程】Use this sub-skill for Torch-TensorRT runtime performance controls, CUDA Graphs, output allocation, caches, TensorRT-RTX runtime settings, mutable modules, refit, weight streaming, and benchmark triage.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this sub-skill after a model compiles, or when a user asks about runtime latency, memory, caches, CUDA Graphs, output buffers, TensorRT-RTX settings, mutable modules, refit, or benchmark methodology.
torch_tensorrt.ENABLED_FEATURES; runtime APIs are gated by standard TensorRT vs TensorRT-RTX and by whether C++ runtime libraries are present.references/performance-and-memory.md for memory/latency triage before changing many knobs at once.| User goal | Read/run |
|---|---|
| Apply CUDA Graphs, output allocator, preallocated outputs, weight streaming, runtime config, or TensorRT-RTX settings | references/workflows.md |
| Need exact runtime API names and signatures | references/api-reference.md |
| Diagnose high latency, OOM, compile/runtime cache behavior, dynamic shape profile choice, or benchmark design | references/performance-and-memory.md |
| Debug runtime errors, cache/load failures, CUDAGraph invalidation, allocator issues, or RTX-only setting surprises | references/troubleshooting.md |
| Need a safe script to inspect runtime feature availability | scripts/runtime_feature_probe.py --help |
| Need a benchmarking template | scripts/benchmark_latency_template.py --help |
Use CUDA Graphs only after shapes and memory addresses are stable enough for capture.
from torch_tensorrt import runtime
with runtime.enable_cudagraphs(compiled) as graph_module:
for _ in range(10):
_ = graph_module(*example_inputs)
For TensorRT-RTX, CUDA graph strategy may also be set through RuntimeSettings or runtime_config.
from torch_tensorrt.runtime import RuntimeSettings
compiled.runtime_settings = RuntimeSettings(
runtime_cache="trt_rtx_cache.bin",
dynamic_shapes_kernel_specialization_strategy="eager",
cuda_graph_strategy="whole_graph_capture",
)
These fields are no-ops or unavailable outside TensorRT-RTX. Apply settings before first execution when the execution context is lazily created.
Use compile-time timing_cache_path, cache_built_engines, reuse_cached_engines, engine_cache_dir, and engine_cache_size when repeated builds or dynamic variants dominate latency. Cache paths should be writable, stable for the workload, and isolated per incompatible model/settings pair.
Use MutableTorchTensorRTModule or refit_module_weights when weights change and recompiling every time would be expensive. Compile with immutable_weights=False when refit/mutability is required.
Use weight streaming, offload_module_to_cpu, resource partitioning, or smaller max dynamic shapes for memory pressure. Validate latency after each change; some memory-saving settings trade off performance.
../extensibility-and-debugging/SKILL.md.