Add code design rules and tighten test discipline in AGENTS.md (#9211)
Adds four code design rules to `AGENTS.md` and tightens its test
discipline. Split out of #9177 at a reviewer's
[request](https://github.com/deepspeedai/DeepSpeed/pull/9177).
## Motivation
Coding agents load `AGENTS.md` while they write code, but consult the
`pr-checklist` skill only when preparing a PR, so rules that shape the
code itself belong in `AGENTS.md`. The new rules target recurring
problems:
- **Test growth.** Agents tend to add as many unit tests as they can to
justify their changes. `test_fused_rms_norm.py` has 118 tests on master
for a single training op, and many are redundant: shapes that take the
same kernel path, a second dtype for dtype-independent tests, CPU copies
of CUDA tests, and tests of development-only details. #9177 cuts it to
65. If tests keep accumulating this way, CI cannot keep up in the long
run.
- **Ungated architecture-specific code.** Some PRs did not limit
architecture-specific changes to the platforms they were validated on.
That can break platforms without CI here: the ROCm and Intel XPU
workflows (`amd-mi200`, `xpu-max1100`, `xpu-compile`) are disabled, and
NPU, MLU, SDAA and SUPA have none.
- **Defensive code.** Internal functions re-check what their callers
already guarantee and handle inputs no caller produces. Besides the
extra code, these checks add CPU overhead to every call: fused RMSNorm
runs several times per layer on every step, and each forward
re-validates the weight and epsilon that `replace_rms_norm` already
checks at install. #9177 removes such checks, including a duplicated
Triton-availability check, dtype and device checks implied by other
checks, and checks for zero-width or scalar inputs.
- **Scattered code.** On master, modules holding Triton kernels live in
`deepspeed/runtime/` and `deepspeed/sequence/` rather than
`deepspeed/ops/triton_ops/`; #9177 moves them.
- **Unverified test runs.** A local run can look green while the tests
that exercise the change never ran: pytest reports them as skipped, for
reasons such as a missing dependency, too few GPUs, or an unsupported
GPU architecture. Some bugs that local runs could have caught went
unnoticed because their tests were skipped during development.
Signed-off-by: Hongwei Chen <hongweichenmail@gmail.com>
Co-authored-by: Zhipeng Wang <zhipeng.rainbowserie@gmail.com>