AGENT SKILL

development-and-testing

Guide TorchRL code changes, tests, docs, CI labels, deprecations, and contributor policy for maintainer-safe edits.

License 许可
MIT
最近更新
2026-09-03
Stars
★ 351
Forks
27

01 前言 Front Matter

name
development-and-testing
license
MIT
metadata
{ "disco-role": "operating" }
description
Guide TorchRL code changes, tests, docs, CI labels, deprecations, and contributor policy for maintainer-safe edits.
disable-model-invocation
true

02 资源文件 6

03 SKILL.md 正文

TorchRL Development and Testing

Use this sub-skill when the user wants to modify TorchRL code, add or change a public API, write tests, update docs or tutorials, add a benchmark, decide CI labels, handle CUDA/optional backend test markers, maintain Hydra config parity, or prepare a maintainer-quality PR.

Do not use this sub-skill as the primary source for runtime API recipes. Route API usage and debugging to the workflow sub-skills first, then return here for edit policy, testing, documentation, and CI decisions.

Immediate routing

  • Environment, transform, spec, rollout, or step_mdp implementation details: route to the envs/transforms workflow owner, then apply this sub-skill for tests/docs.
  • Collector, replay buffer, storage, sampler, evaluator, distributed collection, or service-backed replay changes: route to the collector/replay workflow owner, then apply this sub-skill for backend and CI scope.
  • Actor, critic, distribution, recurrent module, policy wrapper, or model component changes: route to the modules/policies workflow owner, then apply this sub-skill for TensorDict keys and coverage.
  • Loss, value estimator, target updater, trainer, algorithm, SOTA script, or Hydra training config changes: route to the objectives/training workflow owner, then apply this sub-skill for parity and SOTA/docs checks.
  • LLM, VLA, service registry, render/checkpoint integration, or optional serving backend changes: route to the LLM/VLA/services workflow owner, then apply this sub-skill for optional-dependency labels and isolation.

Required references

Read these in order for development tasks:

  1. Contributor guidance for code style, imports, TensorDict-first design, logging, timing, type hints, and compile-friendly patterns.
  2. Test and CI selection for focused pytest selection, GPU marker policy, optional dependency labels, SOTA smoke expectations, and helper scripts.
  3. Config, docs, and deprecations for Hydra config/class parity, docs reference entries, tutorials, benchmarks, and two-release deprecation policy.
  4. Troubleshooting when a change passes locally but fails or disappears in CI.

Safe helper scripts

  • scripts/list_relevant_tests.py: suggest likely test files and CI focus areas from touched paths.
  • scripts/check_gpu_marker_policy.py: statically flag CUDA-only skip conditions that are missing pytest.mark.gpu.

Both scripts are standalone and only inspect files or paths explicitly passed to them.

Minimum maintainer checklist

Before claiming a TorchRL code change is ready:

  1. Confirm all new .py files start with from __future__ import annotations.
  2. Keep imports module-top; no wildcard imports; use the optional-dependency exception only with a module-top _has_<name> probe.
  3. Use torchrl.implement_for for version dispatch rather than hand-rolled version checks.
  4. Use TorchRL logging and torchrl.timeit; do not add print() to library code or time.time() timing blocks.
  5. Preserve TensorDict-first public APIs and use accurate type hints, NestedKey for TensorDict keys, and Literal[...] for fixed string modes.
  6. Add or extend focused tests in existing test files when possible; include nested-key tests when accepting NestedKey.
  7. Add pytest.mark.gpu to CUDA-only tests that also use CUDA/Triton skip conditions.
  8. Update reference docs for every new public class/function; add runnable examples in public docstrings.
  9. For hot paths, check compile/cudagraph friendliness and add or update a benchmark when behavior is performance-relevant.
  10. If a class has a Hydra *Config companion, keep constructor kwargs, config fields, factory popping/forwarding, defaults, and doc cross-references in parity.

04 同仓库更多 Skills

VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-triton-opt

Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-solve

END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-skill

PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-pattern-fusion

Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-orchestrate

Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-feedback

Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).

★ 351