rea-analysis-optimization
MOmorluto/rea485k7,690 new stars in the last 7 days
Author or repair baseline/optimized benchmark pairs, CUDA binary benchmarks, and multi-GPU torchrun benchmarks in this repository. Use when creating or fixing `baseline_*.py` / `optimized_*.py` modules, `VerificationPayloadMixin` contracts, deterministic seeding, tolerances, or benchmark linter errors.
Use this skill when writing or repairing a chapter or lab benchmark pair under code/.
get_benchmark() -> BaseBenchmark factory. Do not add a
if __name__ == "__main__": runner to discoverable benchmark modules.VerificationPayloadMixin and BaseBenchmark (or CudaBinaryBenchmark
for compiled native binaries).setup(), never inside benchmark_fn().benchmark_fn() free of .item(), .cpu(), .numpy(), .tolist(),
ad-hoc logging, or host transfers unless the benchmark explicitly measures them.capture_verification_payload() via
self._set_verification_payload(inputs=..., output=..., batch_size=..., parameter_count=..., precision_flags=..., output_tolerance=(rtol, atol)).baseline and optimized must execute the same mathematical workload on the
same logical inputs, shapes, dtypes, and sequence/batch dimensions.resolve_verification_input_seed() / caller
seeding) so VerifyRunner can run identical inputs, jitter checks, and fresh-input
checks cleanly. Avoid hardcoding torch.manual_seed(42) in helper builders that
ignore the harness seed.VerifyRunner rejects tolerances that admit an all-zero output or a half-scale
output. Choose the tightest mathematically justified (rtol, atol) for the output
dtype and magnitude:
(0.0, 0.0)(1e-4, 1e-4) to (1e-3, 1e-3)(1e-2, 1e-2) or (2e-2, 1e-2), scaled
strictly below output magnitude so zero and half-scale outputs always fail. Initialize
inputs at realistic O(1) LayerNorm/RMSNorm scale rather than shrinking them (shrunk
inputs produce tiny SwiGLU/MLP outputs near atol that trigger VerifyRunner's
zero-admission rejection). When baseline and optimized run identical BF16/FP16 math
across different stream schedules, tighten to (1e-3, 1e-3).get_torchrun_spec(config) returning a
TorchrunLaunchSpec and consume real rank receipts.multi_gpu_required = True,
call require_min_gpus(2, ...), allow explicit end-of-step multi-GPU sync via
allowed_benchmark_fn_antipatterns = ("sync",), seed inputs deterministically on
cuda:0 before transferring peer shards so both arms receive identical hashes, gather
all ranks' outputs onto cuda:0 in capture_verification_payload(), and keep
cross-rank event waits symmetric between baseline and optimized.labs/moe_parallelism, where list-targets
intentionally returns empty) free of baseline_*.py / optimized_*.py pairs. Put
empirical GPU benchmarks in the companion CUDA lab (such as labs/moe_cuda) and
cross-link both READMEs. In PlanEvaluator.analyze(), preserve raw un-overlapped
collective times (ep_time_ms) for invariant tests and model schedule overlap
(such as DualPipeV) separately via exposed_ep_time_ms inside estimated_step_ms.RuntimeError("SKIPPED: <clear reason>") (note the exact SKIPPED: prefix so the
harness classifies the capability skip cleanly instead of failing or falling back).cd code
python -m core.scripts.linting.check_benchmarks --include-unpaired --fail-on-warnings
python -m pytest -q tests/test_get_benchmark_presence.py
python -m cli.aisp bench verify --targets <chapter_or_lab>:<example>
MOmorluto/rea485k7,690 new stars in the last 7 days
MAmattpocock/skills336k4,217 new stars in the last 7 days
Diagnose hard bugs and performance regressions by building a feedback loop with tests or scripts.
MAmattpocock/skills336k4,217 new stars in the last 7 days
MAmattpocock/skills336k4,217 new stars in the last 7 days
MAmattpocock/skills336k4,217 new stars in the last 7 days
MAmattpocock/skills336k4,217 new stars in the last 7 days