rea-analysis-optimization
MOmorluto/rea485k7,690 new stars in the last 7 days
Profile and debug CUDA, CUTLASS, Triton, and PyTorch kernels on NVIDIA Blackwell GPUs (B200/GB200 SM100, B300/GB300 SM103, RTX Blackwell SM120, GB10 SM121) using Nsight Systems, Nsight Compute, Torch Profiler, and the repository's architecture and abort-attribution rules.
Use this skill when compiling, profiling, or debugging GPU kernels across Blackwell
targets under code/.
sm_100 / sm_100a): B200 / GB200 (the shared CUDA 13.0 + PyTorch
2.14.1 setup.sh baseline).sm_103 / sm_103a): B300 / GB300 (separate environment and
qualification path, never substituted with SM100 receipts).sm_120) and SM121 (sm_121): RTX Blackwell and GB10 (separate
feature constraints, no datacenter tcgen05 cluster assumptions).Use core/common/cuda_arch.mk (ARCH=sm_100, sm_103, sm_120, sm_121) and
core/harness/arch_config.py. Preserve explicit unsupported-target diagnostics
instead of silently rewriting one architecture into another.
Before adding any compiler flag, architecture guard, or kernel workaround for a Triton, Inductor, CUTLASS, or CUDA failure:
TRITON_CACHE_DIR, TORCHINDUCTOR_CACHE_DIR,
CUDA_CACHE_PATH pointed at a fresh temp directory) to separate stale cache bugs
from real toolchain failures.nvcc/ptxas, CUTLASS 4.5.2,
Triton 3.8.0, Inductor, or runtime ABI) and capture the raw error message.SKIPPED: or hard diagnostic.Run commands from code/ after sourcing the pinned environment (runtime-env.sh):
# PyTorch profiler (initializes Kineto/CUPTI before capture)
python -m cli.aisp profile torch tests/fixtures/mcp_torch_profile_target.py \
--mode full --output-name smoke-torch --timeout 60
# Nsight Systems 2026.5.1 timeline (cuda, nvtx, osrt)
python -m cli.aisp profile nsys \
"python tests/fixtures/mcp_torch_profile_target.py" \
--output-name smoke-nsys --timeout 60
# Nsight Compute 2026.2.1 kernel metrics (discover real metric names first)
ncu --list-sections
ncu --set basic --export kernel_run_01 python <script>
# Deep-dive nsys/ncu explanation for human engineers or AI coding agents
python -m cli.aisp profile explain artifacts/runs/<run_id>/profiles/<pair_dir> --format md
python -m cli.aisp profile explain path/to/report.ncu-rep --include-source --format json
python -m cli.aisp profile compare-nsys artifacts/runs/<run_id>/profiles/<pair_dir>
python -m cli.aisp profile compare-ncu artifacts/runs/<run_id>/profiles/<pair_dir> --include-ncu-details
Keep the inner edit loop fast and gate deeper profiling deliberately so ncu kernel replay (10x-100x overhead and exclusive GPU profiler lock) never blocks iteration:
<10s, --profile none): Run python -m cli.aisp bench run --targets <target> --profile none (or MCP benchmark_verify + run_benchmarks) to check VerifyRunner numerical parity and CUDA-Event speedup. Inspect -Xptxas=-v during CUDA extension builds for zero register spills.nsys): Capture with --profile minimal (default in tier1-nightly.yml) or aisp profile nsys / MCP profile_nsys, then call aisp profile explain <report.nsys-rep> (or MCP profile_explain / compare_nsys) to separate micro-kernel launch storms, host sync stalls, H2D copies, and dominant GPU kernels.ncu): Filter directly to the hotspot kernel with aisp profile ncu <script> --kernel-filter <name> --metric-set roofline --launch-count 5 (or MCP profile_ncu), then run aisp profile explain <report.ncu-rep> --include-source --include-disassembly (or MCP profile_explain / compare_ncu) to classify DRAM vs SM/Tensor Core vs L2 vs occupancy/register-spill bottlenecks and feed concrete next-step hypotheses back into the agent.--profile minimal|roofline|deep_dive run automatically attaches profile_evaluation (PASS/WARN/INFO, regime shift, metric deltas, and warnings) to benchmark_test_results.json, benchmark_test_results.md, and the Tier-1 nightly GitHub Step Summary.For multi-rank NCCL or distributed captures that deadlock under default NCU process-tree
replay, follow the rank-local TCP workflow in docs/tooling-and-profiling.md and
core/profiling/ncu_torchrun_capture.py.
tcgen05 NVFP4, MXFP4, NVLink 5, and CUDA-Graph rulesRead code/docs/blackwell_tcgen05_nvfp4_guide.md when authoring or tuning sm_100a
FP4/FP8 decode, MoE, hybrid DeltaNet, or TP=2 NVLink P2P kernels:
W4A16 for B = 1..4, native tcgen05
W4A4/W8A8 for dense B >= 8, and MXFP4 (W4A8: MXFP8 acts x MXFP4 weights) as
the default high-batch MoE FP4 path (zero activation calibration via E8M0 scales).flashinfer.autotuner.AutoTuner.get().clear_cache() per batch size with real
non-zero tokens before tuning, broadcast Rank 0's winning tactic map to peer TP ranks
(dist.broadcast_object_list) to prevent +3.7 ms NVLink barrier skew, and verify
global_scale direction with a 1-GEMM mag_ratio test instead of trusting docstrings.epoch & 1)
and L1-bypassing .cv loads (__ldcv / ld.global.cv.*) so CUDA Graph replays
never serve stale L1 lines or race across epochs.mma.m16n8k32.e4m3 / mma.m16n8k16.bf16 over
scalar SIMT FP8 GEMVs at B = 1..8, overlap Shared Expert with Routed MoE on a
second CUDA stream inside the CUDA Graph, and absorb W_uk/W_uv for NoPE MLA.tcgen05 decode inside a CUDA Graph after a >= 40-replay boost-clock
warmup, verify graph_diff < 1e-3, and report apples-to-apples Full + argmax
latency alongside held-out cosine and top-1 parity.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