Skip to content

docs(rl): align the RL engine side with main's RCCL weight sync #15

docs(rl): align the RL engine side with main's RCCL weight sync

docs(rl): align the RL engine side with main's RCCL weight sync #15

name: Atomesh Benchmark
on:
push:
branches: [main]
paths:
- 'atom/mesh/**'
- '.github/benchmark/models_atomesh.yaml'
- '.github/scripts/atomesh/**'
- 'atom/entrypoints/openai/**'
- '.github/scripts/slurm_submit_helpers.sh'
- '.github/workflows/atomesh-benchmark.yaml'
- '.github/workflows/atomesh-benchmark-tmpl.yaml'
pull_request:
branches: [main]
types: [opened, synchronize, reopened, ready_for_review, labeled, closed]
# Do not use paths here. The required gate must be published for every PR;
# ci-gate below keeps the old path filter behavior for expensive jobs.
pull_request_review:
types: [submitted]
schedule:
# Spur MI350X nightly at 00:10 Beijing time (16:10 UTC).
- cron: '10 16 * * *'
# Spur MI350X MoRI IO accuracy at 12:10 Beijing time (04:10 UTC).
- cron: '10 4 * * *'
workflow_dispatch:
inputs:
suite:
description: 'Benchmark suite'
required: false
default: nightly
type: choice
options:
- smoke
- nightly
- weekly
- agentic_multi_decode
- mooncake_store
- accuracy
- profile
rdma_smoke_nodes:
description: 'Comma-separated Slurm candidate nodes for the Mooncake RDMA smoke test; Slurm selects two when multiple nodes are listed'
required: false
default: ''
type: string
rdma_smoke_node_count:
description: 'Number of Slurm nodes for the Mooncake RDMA smoke test'
required: false
default: '2'
type: choice
options:
- '1'
- '2'
run_all_models:
description: 'Run all models from models_atomesh.yaml'
required: false
default: false
type: boolean
model_names:
description: 'When run_all_models=false, run all cases in the selected suite for these model families. Comma-separated: DeepSeek-V4-Pro,DeepSeek-V4-Pro-0813,GLM-5.2-MXFP4,Kimi-K3-MXFP4,Kimi-K2.5-MXFP4,MiniMax-M3-MXFP4,MiniMax-M3-MXFP8'
required: false
default: ''
type: string
case_names:
description: |
Overrides model_names. Enter comma-separated case names.
DeepSeek:
ds-v4-1p1d-tp8-smoke,ds-v4-1p1d-tp8,ds-v4-1p1d-dpa-tp8,
ds-v4-1p1d-tp8-mtp3,ds-v4-1p1d-dpa-tp8-mtp1,
ds-v4-2p1d-tp8,ds-v4-2p1d-dpa-tp8,
ds-v4-2p1d-tp8-mtp3,ds-v4-2p1d-dpa-tp8-mtp1
DeepSeek-V4-Pro-0813 (weekly):
ds-v4-0813-1p1d-dpa-tp8-dspark3-agentic-no-offload-c1,
ds-v4-0813-1p1d-dpa-tp8-dspark3-agentic-no-offload-c2,
ds-v4-0813-1p1d-dpa-tp8-dspark3-agentic-no-offload-c16,
ds-v4-0813-1p1d-dpa-tp8-dspark3-agentic-no-offload-c32,
ds-v4-0813-1p1d-dpa-tp8-dspark3-agentic-no-offload-c128,
ds-v4-0813-1p1d-dpa-tp8-dspark3-agentic-no-offload-c192,
ds-v4-0813-1p1d-dpa-tp8-dspark3-agentic-no-offload-c256
DeepSeek-V4-Pro-0813 (accuracy):
ds-v4-0813-1p1d-tp8-dspark3-gsm8k-only-c16
GLM:
glm-52-mxfp4-1p1d-tp4,glm-52-mxfp4-1p1d-tp8,
glm-52-mxfp4-1p1d-cpp4-dcp4-agentic-lmcache-1m-c48,
glm-52-mxfp4-1p1d-cpp4-dpa4-agentic-lmcache-1m-c36,
glm-52-mxfp4-1p1d-cpp4-dpa4-agentic-lmcache-1m-c40,
glm-52-mxfp4-1p1d-cpp4-dcp4-agentic-lmcache-chunked-1m-c32,
glm-52-mxfp4-1p2d-cpp4-dpa4-agentic-lmcache-1m-c48,
glm-52-mxfp4-1p2d-cpp4-dpa4-agentic-lmcache-1m-c56,
GLM mooncake_store (suite=mooncake_store; pit2-p03 (TW MI355X) nodes only):
glm-52-mxfp4-1p1d-cpp4-dcp4-agentic-mcstore-1m-c48,
glm-52-mxfp4-1p1d-cpp4-dcp4-agentic-mcstore-1m-c56,
glm-52-mxfp4-1p1d-cpp4-dcp4-agentic-mcstore-1m-c72,
glm-52-mxfp4-1p1d-cpp4-dcp4-agentic-mcstore-1m-c96,
glm-52-mxfp4-1p1d-cpp4-dcp4-agentic-mcstore-1m-c112,
glm-52-mxfp4-1p1d-cpp4-dcp4-agentic-mcstore-1m-c128
GLM mooncake_store, two half nodes (suite=mooncake_store; pd_worker_layout multi_node, 2 nodes, GPUs 0-3 with NUMA0 and rdma0-3 of each):
glm-52-mxfp4-1p1d-cpp4-dcp4-agentic-mcstore-2n-1m-c96,
glm-52-mxfp4-1p1d-cpp4-dcp4-agentic-mcstore-2n-1m-c112
GLM agentic_multi_decode (1P3D):
glm-52-mxfp4-1p3d-cpp4-tp4-mtp5-agentic-lmcache-1m-c12,
glm-52-mxfp4-1p3d-cpp4-tp4-mtp5-agentic-lmcache-1m-c16,
glm-52-mxfp4-1p3d-cpp4-tp4-mtp5-agentic-lmcache-1m-c24
GLM 2-node 1P1D DCP8 decode (agentic_multi_decode):
glm-52-mxfp4-1p1d-dcp8-dcp8-agentic-lmcache-1m-c96,
glm-52-mxfp4-1p1d-cpp8-dcp8-agentic-lmcache-1m-c96
GLM 2-node 1P1D DCP8 decode (accuracy):
glm-52-mxfp4-1p1d-dcp8-dcp8-gsm8k-only-c64,
glm-52-mxfp4-1p1d-cpp8-dcp8-gsm8k-only-c64
Kimi-K3:
kimi-k3-mxfp4-1p1d-tp8-dspark7-agentic-1m-c1,
kimi-k3-mxfp4-1p1d-tp8-dspark7-agentic-1m-c2,
kimi-k3-mxfp4-1p1d-tp8-dspark7-agentic-1m-c4,
kimi-k3-mxfp4-1p1d-tp8-dcp8-dspark3-agentic-lmcache-1m-c8,
kimi-k3-mxfp4-1p1d-tp8-dcp8-dspark3-agentic-lmcache-1m-c16,
kimi-k3-mxfp4-1p1d-tp8-dcp8-agentic-lmcache-1m-c32,
kimi-k3-mxfp4-1p1d-tp8-dcp8-agentic-lmcache-1m-c48,
kimi-k3-mxfp4-1p1d-tp8-dcp8-agentic-lmcache-1m-c56,
kimi-k3-mxfp4-1p1d-tp8-dcp8-agentic-lmcache-1m-c64,
kimi-k3-mxfp4-1p1d-tp8-dcp8-agentic-lmcache-1m-c72,
kimi-k3-mxfp4-1p1d-tp8-dcp8-agentic-lmcache-1m-c88,
kimi-k3-mxfp4-agg-tp8-dcp8-agentic-lmcache-1m-c72,
kimi-k3-mxfp4-2p1d-tp8-dcp8-agentic-lmcache-1m-c72,
kimi-k3-mxfp4-2p1d-tp8-dcp8-agentic-lmcache-1m-c128,
kimi-k3-mxfp4-2p1d-tp8-dcp8-agentic-lmcache-1m-c256
Kimi-K3 (profile suite, torch trace in minutes 5-6):
kimi-k3-mxfp4-1p1d-tp8-dcp8-agentic-lmcache-1m-c72-torch-profile
Kimi-K2.5:
kimi-k25-1p1d-tp4,kimi-k25-1p1d-tp4-tp8,
kimi-k25-2p1d-tp4,kimi-k25-1p2d-tp4
MiniMax:
minimax-m3-fp4-1p1d-tp4,minimax-m3-fp4-2p1d-dpa-tp4,
minimax-m3-fp4-1p1d-tp4-eagle3,minimax-m3-fp4-2p1d-dpa-tp4-eagle3,
minimax-m3-fp8-1p1d-tp4,minimax-m3-fp8-2p1d-dpa-tp4,
minimax-m3-fp8-2p1d-tp8,minimax-m3-fp8-2p1d-dpa-tp8,
minimax-m3-fp8-2p1d-dpa-tp8-eagle3,
minimax-m3-fp8-1p1d-tp4-eagle3,minimax-m3-fp8-2p1d-dpa-tp4-eagle3
required: false
default: ''
type: string
atomesh_image:
description: 'Override ATOM docker image'
required: false
default: rocm/atom-dev:latest
type: string
atom_source:
description: 'ATOM python package the servers import: mounted = this checkout (mounted at /workspace/ATOM), image = the copy installed in the docker image (/app/ATOM). Scripts and the mesh router still come from this checkout.'
required: false
default: mounted
type: choice
options:
- mounted
- image
atomesh_slurm_submit_runner:
description: 'GitHub runner label used to submit Slurm jobs: atomesh-cicd = TW MI355X, atomesh-cicd-mi350 = Spur MI350X, atomesh-cicd-mi355-crusoe = Crusoe MI355X'
required: false
default: atomesh-cicd
type: choice
options:
- atomesh-cicd
- atomesh-cicd-mi350
- atomesh-cicd-mi355-crusoe
atomesh_single_node:
description: 'Single-node P/D placement; auto lets Slurm select an idle node, an explicit node pins the job'
required: false
default: auto
type: choice
options:
- auto
- pit2-p03-g01
- pit2-p03-g03
- pit2-p03-g07
- pit2-p03-g08
- pit2-p03-g09
- pit2-p03-g10
- pit2-p03-g12
- pit2-p03-g13
- pit2-p03-g15
- pit2-p03-g17
- pit2-p03-g19
- pit2-p03-g20
- pit2-p03-g23
- pit2-p03-g24
- pit2-p03-g25
- pit2-p03-g27
- pit2-p03-g42
atomesh_1p1d_nodes:
description: 'Comma-separated nodes for 1P1D. auto lets Slurm select idle nodes; an explicit list pins those nodes. Spur MI350 auto still uses its fabric nodelist'
required: false
default: auto
type: string
atomesh_2p1d_nodes:
description: 'Comma-separated nodes for 2P1D. auto lets Slurm select idle nodes; an explicit list pins those nodes. Spur MI350 auto still uses its fabric nodelist'
required: false
default: auto
type: string
benchmark_concurrency:
description: 'Optional benchmark concurrency override, e.g. 1,2,4 (no quotes)'
required: false
default: ''
type: string
eval_concurrency:
description: 'Optional accuracy result-concurrency override; SWE-bench agent workers come from models_atomesh.yaml'
required: false
default: ''
type: string
run_model_benchmark:
description: 'Run model Slurm benchmark for workflow_dispatch'
required: false
default: true
type: boolean
publish_dashboard:
description: 'Publish workflow_dispatch results to the benchmark dashboard'
required: false
default: false
type: boolean
env:
ATOMESH_SINGLE_NODE: ${{ github.event_name == 'workflow_dispatch' && inputs.atomesh_single_node || 'auto' }}
# TW submits only as amd-atom on amd-spur; Crusoe v2 forces amd-aifw-dev on its
# default partition and MI350 sends neither.
ATOMESH_SLURM_ACCOUNT: ${{ (github.event_name == 'workflow_dispatch' && inputs.atomesh_slurm_submit_runner || (github.event_name == 'schedule' && 'atomesh-cicd-mi350' || 'atomesh-cicd')) == 'atomesh-cicd' && 'amd-atom' || '' }}
ATOMESH_SLURM_PARTITION: ${{ (github.event_name == 'workflow_dispatch' && inputs.atomesh_slurm_submit_runner || (github.event_name == 'schedule' && 'atomesh-cicd-mi350' || 'atomesh-cicd')) == 'atomesh-cicd' && 'amd-spur' || '' }}
ATOMESH_SLURM_SUBMIT_RUNNER: ${{ github.event_name == 'workflow_dispatch' && inputs.atomesh_slurm_submit_runner || (github.event_name == 'schedule' && 'atomesh-cicd-mi350' || 'atomesh-cicd') }}
ATOMESH_DASHBOARD_HARDWARE: ${{ (github.event_name == 'workflow_dispatch' && inputs.atomesh_slurm_submit_runner || (github.event_name == 'schedule' && 'atomesh-cicd-mi350' || 'atomesh-cicd')) == 'atomesh-cicd-mi350' && 'MI350X' || 'MI355X' }}
ATOMESH_PD_RANK_MAPPING_POLICY: ${{ (github.event_name == 'workflow_dispatch' && inputs.atomesh_slurm_submit_runner || (github.event_name == 'schedule' && 'atomesh-cicd-mi350' || 'atomesh-cicd')) == 'atomesh-cicd-mi350' && 'idx2idx' || 'none' }}
ATOMESH_LOG_ROOT: ${{ ((github.event_name == 'workflow_dispatch' && inputs.atomesh_slurm_submit_runner || (github.event_name == 'schedule' && 'atomesh-cicd-mi350' || 'atomesh-cicd')) == 'atomesh-cicd-mi350' && '/data/${USER}/logs/ATOMESH_LOG/' || (github.event_name == 'workflow_dispatch' && inputs.atomesh_slurm_submit_runner || (github.event_name == 'schedule' && 'atomesh-cicd-mi350' || 'atomesh-cicd')) == 'atomesh-cicd-mi355-crusoe' && '/home/junyyang/ATOMesh_ACTION_RUNNER/ATOMesh_LOG/' || (github.event_name == 'workflow_dispatch' && inputs.atomesh_slurm_submit_runner || (github.event_name == 'schedule' && 'atomesh-cicd-mi350' || 'atomesh-cicd')) == 'atomesh-cicd-crusoe-mi355' && '/shared_nfs/ATOMESH_CI/LOG/' || '/it-share/ATOMESH_LOG/') }}
ATOMESH_MODEL_ROOT: ${{ (github.event_name == 'workflow_dispatch' && inputs.atomesh_slurm_submit_runner || (github.event_name == 'schedule' && 'atomesh-cicd-mi350' || 'atomesh-cicd')) == 'atomesh-cicd-mi350' && '/data/junyyang/models' || (((github.event_name == 'workflow_dispatch' && inputs.atomesh_slurm_submit_runner || (github.event_name == 'schedule' && 'atomesh-cicd-mi350' || 'atomesh-cicd')) == 'atomesh-cicd-crusoe-mi355' || (github.event_name == 'workflow_dispatch' && inputs.atomesh_slurm_submit_runner || (github.event_name == 'schedule' && 'atomesh-cicd-mi350' || 'atomesh-cicd')) == 'atomesh-cicd-mi355-crusoe') && '/shared_nfs/huggingface_models/amd' || '/mnt/models') }}
# MI350: omit fabric-5 (foreign containers ignore Spur --exclusive and fill
# VRAM) and fabric-15 (unreachable). Candidate pool is fabric-6,7,13,14,16.
ATOMESH_1P1D_NODES: ${{ github.event_name == 'workflow_dispatch' && inputs.atomesh_1p1d_nodes != 'auto' && inputs.atomesh_1p1d_nodes || ((github.event_name == 'workflow_dispatch' && inputs.atomesh_slurm_submit_runner || (github.event_name == 'schedule' && 'atomesh-cicd-mi350' || 'atomesh-cicd')) == 'atomesh-cicd-mi350' && 'ml-ai-ubuntu-gpu-mi350x8-2304gb-fabric-6,ml-ai-ubuntu-gpu-mi350x8-2304gb-fabric-7,ml-ai-ubuntu-gpu-mi350x8-2304gb-fabric-13,ml-ai-ubuntu-gpu-mi350x8-2304gb-fabric-14,ml-ai-ubuntu-gpu-mi350x8-2304gb-fabric-16' || '') }}
ATOMESH_2P1D_NODES: ${{ github.event_name == 'workflow_dispatch' && inputs.atomesh_2p1d_nodes != 'auto' && inputs.atomesh_2p1d_nodes || ((github.event_name == 'workflow_dispatch' && inputs.atomesh_slurm_submit_runner || (github.event_name == 'schedule' && 'atomesh-cicd-mi350' || 'atomesh-cicd')) == 'atomesh-cicd-mi350' && 'ml-ai-ubuntu-gpu-mi350x8-2304gb-fabric-6,ml-ai-ubuntu-gpu-mi350x8-2304gb-fabric-7,ml-ai-ubuntu-gpu-mi350x8-2304gb-fabric-13,ml-ai-ubuntu-gpu-mi350x8-2304gb-fabric-14,ml-ai-ubuntu-gpu-mi350x8-2304gb-fabric-16' || '') }}
concurrency:
# Keep manual benchmark dispatches independent so different cases on the same branch can run together.
# The MoRI IO schedule has a group of its own, or it would queue behind the multi-day nightly.
# Approval runs queue behind existing work. Other reviews get their own group
# so they cannot replace a pending approval run in GitHub's queue.
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ github.event.pull_request.number && 'pr' || github.event_name }}-${{ github.event_name == 'workflow_dispatch' && github.run_id || (github.event_name == 'schedule' && (github.event.schedule == '10 4 * * *' && 'atomesh-cicd-mi350-moriio' || 'atomesh-cicd-mi350') || 'atomesh-cicd') }}${{ github.event_name == 'pull_request_review' && github.event.review.state != 'approved' && format('-review-{0}', github.run_id) || '' }}
cancel-in-progress: ${{ github.event_name != 'workflow_dispatch' && github.ref != 'refs/heads/main' && github.event_name != 'pull_request_review' }}
permissions:
actions: read
contents: write
jobs:
ci-gate:
name: Check Heavy CI Gate
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
pull-requests: read
outputs:
should_run: ${{ steps.gate.outputs.should_run }}
reason: ${{ steps.gate.outputs.reason }}
decidable: ${{ steps.gate.outputs.decidable }}
steps:
- name: Checkout ATOM repo
uses: actions/checkout@v6
- name: Check approval and label gate
id: gate
env:
CI_GATE_WORKFLOW: atomesh-benchmark.yaml
CI_GATE_LABELS: ci:full,ci:mesh
CI_GATE_PATHS_INCLUDE: |
atom/mesh/**
.github/benchmark/models_atomesh.yaml
.github/scripts/atomesh/**
atom/entrypoints/openai/**
.github/scripts/slurm_submit_helpers.sh
.github/workflows/atomesh-benchmark.yaml
.github/workflows/atomesh-benchmark-tmpl.yaml
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: bash ./.github/scripts/check_heavy_ci_gate.sh
load-config:
if: ${{ needs.ci-gate.outputs.should_run == 'true' }}
needs: [ci-gate]
name: Load ATOMesh benchmark config
runs-on: ubuntu-latest
outputs:
groups_json: ${{ steps.groups.outputs.groups_json }}
has_matrix: ${{ steps.matrix.outputs.has_matrix }}
image: ${{ steps.image.outputs.image }}
model_root: ${{ env.ATOMESH_MODEL_ROOT }}
dashboard_hardware: ${{ env.ATOMESH_DASHBOARD_HARDWARE }}
steps:
- name: Checkout ATOM repo
uses: actions/checkout@v6
- name: Install YAML parser
run: python3 -m pip install pyyaml
- name: Test ATOMesh config and launch scripts
run: python3 -m unittest discover -s tests -p "test_atomesh_*.py"
- name: Find ATOMesh latest nightly image
id: image
env:
INPUT_ATOMESH_IMAGE: ${{ github.event_name == 'workflow_dispatch' && inputs.atomesh_image || '' }}
run: |
set -euo pipefail
python3 - <<'PY'
import json
import os
import re
import urllib.parse
import urllib.request
from datetime import datetime, timedelta, timezone
from pathlib import Path
import yaml
cfg = yaml.safe_load(Path(".github/benchmark/models_atomesh.yaml").read_text(encoding="utf-8")) or {}
default_image = str(cfg.get("backends", {}).get("atom", {}).get("image", "")).strip()
image = os.environ.get("INPUT_ATOMESH_IMAGE", "").strip() or default_image
def docker_tags(prefix: str) -> list[dict]:
url = (
"https://hub.docker.com/v2/repositories/rocm/atom-dev/tags?"
+ urllib.parse.urlencode({"page_size": 100, "name": prefix})
)
tags = []
while url:
with urllib.request.urlopen(url, timeout=30) as response:
data = json.load(response)
tags.extend(
tag for tag in data.get("results", [])
if str(tag.get("name", "")).startswith(prefix)
)
url = data.get("next")
return tags
def latest_nightly_for(day) -> str | None:
prefix = f"nightly_{day:%Y%m%d}"
# Unsuffixed latest/nightly tags are the default ROCm line.
# ROCm 10 and manual builds have suffixes and must be requested
# explicitly; publication order must not switch runtime lines.
tags = [
tag for tag in docker_tags(prefix)
if re.fullmatch(r"nightly_[0-9]{12}", str(tag.get("name", "")))
]
if not tags:
return None
tags.sort(
key=lambda tag: (str(tag.get("last_updated", "")), str(tag.get("name", ""))),
reverse=True,
)
return f"rocm/atom-dev:{tags[0]['name']}"
def docker_tag_digest(tag_name: str) -> str:
url = f"https://hub.docker.com/v2/repositories/rocm/atom-dev/tags/{urllib.parse.quote(tag_name)}"
with urllib.request.urlopen(url, timeout=30) as response:
data = json.load(response)
if data.get("digest"):
return str(data["digest"])
for image_info in data.get("images", []):
if image_info.get("digest"):
return str(image_info["digest"])
return ""
resolved_image = image
if image == "rocm/atom-dev:latest":
beijing_tz = timezone(timedelta(hours=8))
today = datetime.now(beijing_tz).date()
resolved_image = latest_nightly_for(today)
if resolved_image is None:
resolved_image = latest_nightly_for(today - timedelta(days=1))
if resolved_image is None:
print("::warning::Cannot find rocm/atom-dev nightly tag for today or yesterday; falling back to rocm/atom-dev:latest.")
resolved_image = image
image_digest = ""
if resolved_image == "rocm/atom-dev:latest":
image_digest = docker_tag_digest("latest")
if image_digest:
print(f"ATOMesh image digest: {image_digest}")
else:
print("::warning::Cannot resolve digest for rocm/atom-dev:latest.")
print(f"ATOMesh image: {image} -> {resolved_image}")
with Path(os.environ["GITHUB_OUTPUT"]).open("a", encoding="utf-8") as output:
output.write(f"image={resolved_image}\n")
output.write(f"image_digest={image_digest}\n")
step_summary = os.environ.get("GITHUB_STEP_SUMMARY")
if step_summary and image_digest:
with Path(step_summary).open("a", encoding="utf-8") as summary:
summary.write(f"ATOMesh image digest: `{image_digest}`\n")
PY
- name: Build benchmark matrix
id: matrix
env:
SUITE: ${{ (github.event_name == 'schedule' || github.event_name == 'push') && 'nightly' || (github.event_name == 'workflow_dispatch' && inputs.suite || 'smoke') }}
RUN_ALL_MODELS: ${{ github.event_name == 'workflow_dispatch' && inputs.run_all_models || github.event_name != 'workflow_dispatch' }}
MODEL_NAMES: ${{ github.event_name == 'workflow_dispatch' && inputs.model_names || '' }}
CASE_NAMES: ${{ github.event_name == 'workflow_dispatch' && inputs.case_names || '' }}
EVENT_SCHEDULE: ${{ github.event_name == 'schedule' && github.event.schedule || '' }}
ATOMESH_IMAGE: ${{ steps.image.outputs.image }}
ATOMESH_BENCHMARK_CONCURRENCY: ${{ github.event_name == 'workflow_dispatch' && inputs.benchmark_concurrency || '' }}
ATOMESH_EVAL_CONCURRENCY: ${{ github.event_name == 'workflow_dispatch' && inputs.eval_concurrency || '' }}
run: |
set -euo pipefail
MODEL_NAME=""
CASE_NAME=""
if [[ "${GITHUB_EVENT_NAME}" == "workflow_dispatch" ]]; then
if [[ -n "${CASE_NAMES}" ]]; then
CASE_NAME="${CASE_NAMES}"
elif [[ "${RUN_ALL_MODELS}" != "true" ]]; then
if [[ -z "${MODEL_NAMES}" && "${SUITE}" != "smoke" ]]; then
echo "::error::Set run_all_models=true, provide model_names, or provide case_names."
exit 1
fi
MODEL_NAME="${MODEL_NAMES}"
fi
fi
if [[ "${SUITE}" == "smoke" && -z "${CASE_NAME}" && -z "${MODEL_NAME}" && "${RUN_ALL_MODELS}" != "true" ]]; then
python3 - <<'PY'
import json
import os
from pathlib import Path
matrix = {"include": []}
Path("atomesh-matrix.json").write_text(
json.dumps(matrix, indent=2),
encoding="utf-8",
)
with Path(os.environ["GITHUB_OUTPUT"]).open("a", encoding="utf-8") as output:
output.write('matrix_json={"include":[]}\n')
output.write("has_matrix=false\n")
print("RDMA smoke workflow: skipping benchmark matrix generation")
PY
cat atomesh-matrix.json
exit 0
fi
if [[ "${GITHUB_EVENT_NAME}" == "schedule" && "${EVENT_SCHEDULE}" == "10 4 * * *" ]]; then
python3 .github/scripts/atomesh/pd_matrix.py \
--suite accuracy \
--kv-connector moriio \
${ATOMESH_IMAGE:+--image "$ATOMESH_IMAGE"} \
--output atomesh-matrix.json \
--github-output
else
python3 .github/scripts/atomesh/pd_matrix.py \
--suite "$SUITE" \
${MODEL_NAME:+--model "$MODEL_NAME"} \
${CASE_NAME:+--case "$CASE_NAME"} \
${ATOMESH_IMAGE:+--image "$ATOMESH_IMAGE"} \
${ATOMESH_BENCHMARK_CONCURRENCY:+--benchmark-concurrency "$ATOMESH_BENCHMARK_CONCURRENCY"} \
${ATOMESH_EVAL_CONCURRENCY:+--eval-concurrency "$ATOMESH_EVAL_CONCURRENCY"} \
--output atomesh-matrix.json \
--github-output
fi
cat atomesh-matrix.json
- name: Group benchmark matrix by configuration
id: groups
if: ${{ steps.matrix.outputs.has_matrix == 'true' }}
run: |
set -euo pipefail
python3 - <<'PY'
import json
import os
import re
from pathlib import Path
# One-concurrency cases are named <config>-c<N>; cells of one config
# nest under one job and keep their matrix order.
groups = {}
for cell in json.loads(Path("atomesh-matrix.json").read_text(encoding="utf-8"))["include"]:
name = re.sub(r"-c\d+$", "", cell["name"])
groups.setdefault((cell["suite"], cell["model"], name), []).append(cell)
groups_json = [
{"name": name, "matrix_json": json.dumps({"include": cells}, separators=(",", ":"))}
for (_, _, name), cells in groups.items()
]
with Path(os.environ["GITHUB_OUTPUT"]).open("a", encoding="utf-8") as output:
output.write(f"groups_json={json.dumps(groups_json, separators=(',', ':'))}\n")
for (_, _, name), cells in groups.items():
print(f"{name}: {', '.join(cell['id'] for cell in cells)}")
PY
- name: Validate ATOMesh P/D matrix
if: ${{ steps.matrix.outputs.has_matrix == 'true' }}
env:
RESULT_DIR: atomesh-dry-run-results
run: |
set -euo pipefail
chmod +x .github/scripts/atomesh/*.sh .github/scripts/atomesh/*.py
python3 - <<'PY'
import json
import os
import subprocess
from pathlib import Path
matrix = json.loads(Path("atomesh-matrix.json").read_text(encoding="utf-8"))
for cell in matrix.get("include", []):
print(f"Validating {cell['id']}", flush=True)
subprocess.run(
[
"bash",
".github/scripts/atomesh/pd_submit.sh",
"--cell-json",
json.dumps(cell, separators=(",", ":")),
"--result-dir",
os.environ["RESULT_DIR"],
"--dry-run",
],
check=True,
)
PY
- name: Upload expanded matrix
uses: actions/upload-artifact@v7
with:
name: atomesh-benchmark-matrix
path: atomesh-matrix.json
rdma-smoke-test:
name: Mooncake RDMA smoke test
needs: [ci-gate, load-config]
# Defense-in-depth: the current smoke path is workflow_dispatch-only.
# Keep forked PRs off ATOMesh self-hosted runners if that changes later.
if: ${{ (github.event_name != 'pull_request' || !github.event.pull_request.head.repo.fork) && github.event_name == 'workflow_dispatch' && inputs.suite == 'smoke' }}
runs-on: ${{ inputs.atomesh_slurm_submit_runner }}
timeout-minutes: 75
env:
MC_GID_INDEX: '1'
RDMA_SMOKE_IMAGE: ${{ needs.load-config.outputs.image }}
RDMA_SMOKE_NODES: ${{ inputs.rdma_smoke_nodes }}
RDMA_SMOKE_NODE_COUNT: ${{ inputs.rdma_smoke_node_count }}
RDMA_SMOKE_DECODE_HCA_MODE: all
SLURM_SUBMIT_RUNNER: ${{ inputs.atomesh_slurm_submit_runner }}
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Run Mooncake RDMA transfer test on selected nodes
id: rdma-smoke
run: |
set -euo pipefail
export PATH="/usr/local/slurm-24.05.5.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${PATH:-}"
if [[ -z "${RDMA_SMOKE_IMAGE}" ]]; then
echo "::error::No ATOM image was resolved for the RDMA smoke test."
exit 1
fi
if [[ ! "${MC_GID_INDEX}" =~ ^[0-9]+$ ]]; then
echo "::error::MC_GID_INDEX must be a non-negative integer."
exit 2
fi
nodes="${RDMA_SMOKE_NODES:-${ATOMESH_1P1D_NODES:-}}"
nodes="${nodes// /}"
RDMA_SMOKE_TARGET_NODE_COUNT="${RDMA_SMOKE_NODE_COUNT:-2}"
if [[ -n "${nodes}" ]]; then
IFS=',' read -r -a node_list <<< "${nodes}"
node_count="${#node_list[@]}"
if [[ "${node_count}" -gt "${RDMA_SMOKE_TARGET_NODE_COUNT}" ]]; then
node_count="${RDMA_SMOKE_TARGET_NODE_COUNT}"
fi
echo "=== requesting ${node_count} node(s) from ${#node_list[@]} Slurm candidates ==="
else
# Allocate two nodes by default so both local and cross-node GDR are validated.
node_count="${RDMA_SMOKE_TARGET_NODE_COUNT}"
fi
if [[ "${node_count}" -lt 1 ]]; then
echo "::error::GPUDirect RDMA smoke testing requires at least one Slurm node."
exit 1
fi
current_user="$(id -un 2>/dev/null || id -u)"
log_root="${ATOMESH_LOG_ROOT//\$\{USER\}/${current_user}}"
log_root="${log_root//\$USER/${current_user}}"
if [[ "$(hostname -s)" == "pit2-vm-amd-xl-02" ]]; then
log_root="/share_nfs/ATOMESH_RUNNER/ATOMESH_LOG"
fi
run_dir="${log_root%/}/rdma-smoke-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}"
mkdir -p "${run_dir}"
chmod 0777 "${run_dir}"
export RDMA_SMOKE_RUN_DIR="${run_dir}"
export RDMA_SMOKE_NODE_COUNT="${node_count}"
CURRENT_USER="${current_user}"
ATOMESH_CELL_ID="rdma-smoke"
RESULT_DIR="${run_dir}"
SLURM_JOB_NAME="rdma-smoke-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}"
SLURM_OUTPUT="${run_dir}/slurm-%j.out"
SLURM_ERROR="${run_dir}/slurm-%j.err"
SLURM_CANCEL_HELPER="${run_dir}/slurm-cancel.sh"
SLURM_LOG_POLL_INTERVAL="${SLURM_LOG_POLL_INTERVAL:-15}"
SLURM_ACCOUNT="${ATOMESH_SLURM_ACCOUNT:-}"
SLURM_PARTITION="${ATOMESH_SLURM_PARTITION:-}"
SLURM_QOS=""
USES_SPUR_CONTROLLER=0
SPUR_CONTROLLER_ADDR="${SPUR_CONTROLLER_ADDR:-}"
SPUR_ACCOUNTING_ADDR=""
if [[ "${SLURM_SUBMIT_RUNNER}" == "atomesh-cicd-mi350" ]]; then
USES_SPUR_CONTROLLER=1
SPUR_CONTROLLER_ADDR="http://134.199.196.72:6817"
SPUR_ACCOUNTING_ADDR="http://134.199.196.72:6819"
elif [[ "${SLURM_SUBMIT_RUNNER}" == "atomesh-cicd-mi355-crusoe" ]]; then
USES_SPUR_CONTROLLER=1
SPUR_CONTROLLER_ADDR="http://crs-m2m-cpu-spur-v2-001.crusoe.amd.com:6817"
SPUR_ACCOUNTING_ADDR="${SPUR_V2_ACCOUNTING_ADDR:-http://crs-m2m-cpu-spur-v2-001.crusoe.amd.com:6819}"
SLURM_ACCOUNT="amd-aifw-dev"
SLURM_PARTITION=""
SLURM_QOS="amd-aifw-dev-qos"
fi
if [[ "$(hostname -s)" == "pit2-vm-amd-xl-02" ]]; then
SLURM_ACCOUNT="amd-atom"
SLURM_PARTITION="amd-spur"
fi
if [[ "${SLURM_ACCOUNT}" == "amd-atom" ]]; then
SLURM_QOS="amd-atom-qos"
fi
source "${GITHUB_WORKSPACE}/.github/scripts/slurm_submit_helpers.sh"
detect_slurm_backend
install_slurm_cancel_traps
rank_script="${run_dir}/run-rdma-smoke-rank.sh"
cat > "${rank_script}" <<'RANK_SCRIPT'
#!/usr/bin/env bash
set -euo pipefail
rank="${SLURM_PROCID:-${SPUR_TASK_OFFSET:-0}}"
job_id="${SLURM_JOB_ID:-${SPUR_JOB_ID:-local}}"
container="atomesh-rdma-smoke-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}-${job_id}-${rank}-$$"
rank_host="$(hostname)"
cleanup() {
echo "=== Removing RDMA smoke container ${container} ==="
# Do not wait on D-state RDMA leftovers: kill/rm with a bound so
# the Slurm task can exit instead of sitting in COMPLETING.
if command -v timeout >/dev/null 2>&1; then
timeout 20 docker kill "${container}" >/dev/null 2>&1 || true
timeout 20 docker rm -f "${container}" >/dev/null 2>&1 || true
else
docker kill "${container}" >/dev/null 2>&1 || true
docker rm -f "${container}" >/dev/null 2>&1 || true
fi
}
on_error() {
local rc="$1"
local line="$2"
local command="$3"
echo "ERROR: RDMA smoke rank ${rank} failed on ${rank_host}: rc=${rc} line=${line} command=${command}" >&2
}
on_signal() {
local signal="$1"
local rc="$2"
echo "ERROR: RDMA smoke rank ${rank} received ${signal} on ${rank_host}" >&2
exit "${rc}"
}
publish_rank_rc() {
local rc="$1"
local rc_file
[[ -n "${RDMA_SMOKE_RUN_DIR:-}" ]] || return 0
rc_file="${RDMA_SMOKE_RUN_DIR}/rank-rc-${rank}"
printf '%s\n' "${rc}" > "${rc_file}.tmp" 2>/dev/null || return 0
mv "${rc_file}.tmp" "${rc_file}" 2>/dev/null || true
}
on_exit() {
local rc=$?
trap - EXIT
echo "=== RDMA smoke rank exit: rank=${rank} host=${rank_host} pid=$$ job=${job_id} container=${container} rc=${rc} ==="
# Publish before cleanup: Slurm accounting is unreliable on Spur, so
# the workflow falls back to these per-rank codes.
publish_rank_rc "${rc}"
cleanup
exit "${rc}"
}
trap 'on_error "$?" "${LINENO}" "${BASH_COMMAND}"' ERR
trap on_exit EXIT
trap 'on_signal HUP 129' HUP
trap 'on_signal INT 130' INT
trap 'on_signal TERM 143' TERM
cleanup
echo "=== RDMA smoke rank start: rank=${rank} host=${rank_host} pid=$$ job=${job_id} container=${container} ==="
echo "=== Pulling RDMA smoke image on rank ${rank}: ${RDMA_SMOKE_IMAGE} ==="
docker pull "${RDMA_SMOKE_IMAGE}"
echo "=== RDMA smoke image pull complete on rank ${rank} ==="
docker_args=(
run -i --name "${container}"
--network host --ipc host
--privileged
--device=/dev/kfd
--device=/dev/dri
--device=/dev/infiniband
--group-add=video
--cap-add=IPC_LOCK
--ulimit memlock=-1:-1
-e MC_GID_INDEX="${MC_GID_INDEX:-1}"
-e MC_ENABLE_DEST_DEVICE_AFFINITY=1
-e SMOKE_RANK="${rank}"
-e SMOKE_NODE_COUNT="${RDMA_SMOKE_NODE_COUNT}"
-e SMOKE_DECODE_HCA_MODE="${RDMA_SMOKE_DECODE_HCA_MODE}"
-e SMOKE_RUN_DIR=/rdma-smoke-shared
-v "${RDMA_SMOKE_RUN_DIR}:/rdma-smoke-shared"
)
host_ionic="$(readlink -f /usr/lib/x86_64-linux-gnu/libionic.so.1 2>/dev/null || true)"
[[ -z "${host_ionic}" ]] || docker_args+=(
-v "${host_ionic}:/usr/lib/x86_64-linux-gnu/libionic.so.1:ro"
)
[[ ! -e /usr/lib/x86_64-linux-gnu/libibverbs/libionic-rdmav34.so ]] || docker_args+=(
-v /usr/lib/x86_64-linux-gnu/libibverbs/libionic-rdmav34.so:/usr/lib/x86_64-linux-gnu/libibverbs/libionic-rdmav34.so:ro
)
[[ ! -e /etc/libibverbs.d/ionic.driver ]] || docker_args+=(
-v /etc/libibverbs.d/ionic.driver:/etc/libibverbs.d/ionic.driver:ro
)
docker_args+=(
"${RDMA_SMOKE_IMAGE}"
bash -s
)
printf '=== RDMA smoke docker command on rank %s ===' "${rank}"
printf ' %q' docker "${docker_args[@]}"
echo
echo "=== Starting RDMA smoke container on rank ${rank} ==="
set +e
docker "${docker_args[@]}" <<'CONTAINER_SCRIPT'
set -euo pipefail
mapfile -t rdma_devices < <(python3 - <<'PY'
import os
import re
devices = [
name
for name in os.listdir("/sys/class/infiniband")
if os.path.isdir(os.path.join("/sys/class/infiniband", name))
]
def sort_key(name: str) -> int:
match = re.search(r"(?:ionic_|rdma)(\d+)$", name)
return int(match.group(1)) if match else 10_000
for device in sorted(devices, key=sort_key):
print(device)
PY
)
if [[ "${#rdma_devices[@]}" -eq 0 ]]; then
echo "ERROR: no RDMA devices found under /sys/class/infiniband" >&2
exit 1
fi
echo "RDMA devices: ${rdma_devices[*]}"
echo "Mooncake RDMA GID index: ${MC_GID_INDEX}"
for rdma_device in "${rdma_devices[@]}"; do
gid_path="/sys/class/infiniband/${rdma_device}/ports/1/gids/${MC_GID_INDEX}"
selected_gid="$(cat "${gid_path}")"
echo "${rdma_device}/1 GID[${MC_GID_INDEX}]: ${selected_gid}"
done
ibv_devinfo
rocm-smi --showproductname || true
gpu_count="$(python3 - <<'PY'
import torch
print(torch.cuda.device_count())
PY
)"
if ! [[ "${gpu_count}" =~ ^[1-9][0-9]*$ ]]; then
echo "ERROR: no ROCm GPUs are visible for GPUDirect RDMA testing" >&2
exit 1
fi
echo "Visible ROCm GPUs: ${gpu_count}"
validator_source="/app/mooncake/mooncake-transfer-engine/example/transfer_engine_validator.cpp"
python3 - "${validator_source}" <<'PY'
import pathlib
import sys
path = pathlib.Path(sys.argv[1])
source = path.read_text()
replacements = {
""" fillData(thread_id, addr, seed);
submitRequestSync(engine, segment_id, thread_id, addr, remote_base,
TransferRequest::WRITE);
fillData(thread_id, addr, 0);
submitRequestSync(engine, segment_id, thread_id, addr, remote_base,
TransferRequest::READ);
checkData(thread_id, addr, seed);""":
""" fillData(thread_id, addr, seed);
submitRequestSync(engine, segment_id, thread_id, addr, remote_base,
TransferRequest::WRITE);""",
""" submitRequestSync(engine, segment_id, thread_id, addr, remote_base,
TransferRequest::WRITE);
submitRequestSync(engine, segment_id, thread_id, addr, remote_base,
TransferRequest::READ);""":
""" submitRequestSync(engine, segment_id, thread_id, addr, remote_base,
TransferRequest::WRITE);""",
'LOG(INFO) << "Worker " << thread_id << " stopped! Data validation passed";':
'LOG(INFO) << "Worker " << thread_id << " stopped! RDMA WRITE transfers completed";',
}
for old, new in replacements.items():
if source.count(old) != 1:
raise RuntimeError(
f"Expected exactly one validator WRITE/READ sequence, "
f"found {source.count(old)} in {path}"
)
source = source.replace(old, new)
path.write_text(source)
print(f"Patched {path} to exercise production WRITE-only transfers")
PY
build_dir="/tmp/mooncake-rdma-smoke-build"
rm -rf "${build_dir}"
cmake -S /app/mooncake -B "${build_dir}" \
-DUSE_HIP=ON \
-DUSE_ETCD=OFF \
-DBUILD_UNIT_TESTS=ON
cmake --build "${build_dir}" \
--target transfer_engine_validator \
--parallel "$(nproc)"
validator_bin="${build_dir}/mooncake-transfer-engine/example/transfer_engine_validator"
if [[ ! -x "${validator_bin}" ]]; then
echo "ERROR: transfer_engine_validator was not built at ${validator_bin}" >&2
exit 1
fi
rdma_device_csv="$(IFS=,; echo "${rdma_devices[*]}")"
export RDMA_DEVICE_CSV="${rdma_device_csv}"
export GPU_COUNT="${gpu_count}"
python3 - <<'PY'
import json
import os
from pathlib import Path
devices = os.environ["RDMA_DEVICE_CSV"].split(",")
gpu_count = int(os.environ["GPU_COUNT"])
matrix = {}
for gpu_id in range(gpu_count):
matrix[f"cuda:{gpu_id}"] = [devices, []]
Path("/tmp/rdma-smoke-nic-priority.json").write_text(
json.dumps(matrix),
encoding="utf-8",
)
PY
echo "NIC priority matrix:"
cat /tmp/rdma-smoke-nic-priority.json
target_pid=""
log_progress() {
local msg="$*"
echo "${msg}"
echo "$(date -Is) rank=${SMOKE_RANK:-?} ${msg}" >> "${SMOKE_RUN_DIR}/rank-${SMOKE_RANK:-unknown}.log" 2>/dev/null || true
}
start_target_process() {
local gpu_id="$1"
local log_file="$2"
shift 2
if command -v setsid >/dev/null 2>&1; then
HIP_VISIBLE_DEVICES="${gpu_id}" \
setsid "${validator_bin}" "$@" >"${log_file}" 2>&1 < /dev/null &
else
HIP_VISIBLE_DEVICES="${gpu_id}" \
"${validator_bin}" "$@" >"${log_file}" 2>&1 < /dev/null &
fi
target_pid=$!
}
stop_target_process() {
local pid="${target_pid:-}"
[[ -n "${pid}" ]] || return 0
target_pid=""
# SIGTERM runs Mooncake unregisterLocalMemory(), which can hang in
# D-state. Smoke targets are ephemeral: KILL the process group and
# do not wait, so the next GPU pair can start immediately.
echo "WARNING: killing RDMA target process group ${pid} without waiting" >&2
kill -KILL -- "-${pid}" 2>/dev/null || kill -KILL "${pid}" 2>/dev/null || true
disown "${pid}" 2>/dev/null || true
}
cleanup_processes() {
stop_target_process
pkill -KILL -f 'transfer_engine_validator' 2>/dev/null || true
}
trap cleanup_processes EXIT HUP INT TERM
wait_for_p2p_address() {
local target_log="$1"
local target_pid="$2"
local timeout_seconds="$3"
local deadline=$((SECONDS + timeout_seconds))
local address=""
while true; do
address="$(awk '
/Transfer Engine RPC using P2P handshake, listening on / {
print $NF
exit
}
' "${target_log}" 2>/dev/null || true)"
if [[ -n "${address}" ]] && kill -0 "${target_pid}" 2>/dev/null; then
printf '%s\n' "${address}"
return 0
fi
if ! kill -0 "${target_pid}" 2>/dev/null; then
echo "ERROR: P2P target exited before publishing its listening address" >&2
cat "${target_log}" >&2 || true
return 1
fi
if [[ "${SECONDS}" -ge "${deadline}" ]]; then
echo "ERROR: timed out waiting for P2P target listening address" >&2
cat "${target_log}" >&2 || true
return 1
fi
sleep 1
done
}
if [[ "${gpu_count}" -ne 8 ]]; then
echo "ERROR: node-local prefill/decode RDMA testing requires exactly 8 GPUs, found ${gpu_count}" >&2
exit 1
fi
if [[ "${#rdma_devices[@]}" -lt 8 ]]; then
echo "ERROR: node-local prefill/decode RDMA testing requires at least 8 RDMA devices, found ${#rdma_devices[@]}" >&2
exit 1
fi
HCA_COUNT=8
select_all_ib_devices_for_gpu() {
local phys_idx="$1"
local primary="${rdma_devices[phys_idx]}"
local -a selected=("${primary}")
local idx device existing
for ((idx = 0; idx < HCA_COUNT; idx++)); do
device="${rdma_devices[idx]:-}"
[[ -z "${device}" ]] && continue
for existing in "${selected[@]}"; do
[[ "${existing}" == "${device}" ]] && continue 2
done
selected+=("${device}")
done
(IFS=,; echo "${selected[*]}")
}
select_decode_ib_devices() {
local prefill_idx="$1"
local decode_idx="$2"
local prefill_device="${rdma_devices[prefill_idx]}"
local decode_device="${rdma_devices[decode_idx]}"
case "${SMOKE_DECODE_HCA_MODE}" in
local|same-gpu)
echo "${decode_device}"
;;
peer)
echo "${prefill_device}"
;;
local-peer)
if [[ "${decode_device}" == "${prefill_device}" ]]; then
echo "${decode_device}"
else
echo "${decode_device},${prefill_device}"
fi
;;
all)
select_all_ib_devices_for_gpu "${decode_idx}"
;;
*)
echo "ERROR: unsupported SMOKE_DECODE_HCA_MODE=${SMOKE_DECODE_HCA_MODE}" >&2
return 1
;;
esac
}
expected_decode_peer_device() {
local prefill_idx="$1"
local decode_idx="$2"
if [[ "${SMOKE_DECODE_HCA_MODE}" == "local" ||
"${SMOKE_DECODE_HCA_MODE}" == "same-gpu" ]]; then
echo "${rdma_devices[decode_idx]}"
else
echo "${rdma_devices[prefill_idx]}"
fi
}
write_cuda0_nic_matrix() {
local matrix_path="$1"
shift
MATRIX_PATH="${matrix_path}" RDMA_MATRIX_DEVICES="${*}" python3 - <<'PY'
import json
import os
from pathlib import Path
devices = os.environ["RDMA_MATRIX_DEVICES"].split()
Path(os.environ["MATRIX_PATH"]).write_text(
json.dumps({"cuda:0": [devices, []]}),
encoding="utf-8",
)
PY
}
echo "Decode HCA diagnostic mode: ${SMOKE_DECODE_HCA_MODE}"
local_prefill_gpu_ids=()
local_decode_gpu_ids=()
if [[ "${SMOKE_DECODE_HCA_MODE}" == "same-gpu" ]]; then
for ((gpu_id = 0; gpu_id < gpu_count; gpu_id++)); do
local_prefill_gpu_ids+=("${gpu_id}")
local_decode_gpu_ids+=("${gpu_id}")
done
else
for ((prefill_gpu_id = 0; prefill_gpu_id < gpu_count - 1; prefill_gpu_id++)); do
for ((decode_gpu_id = prefill_gpu_id + 1; decode_gpu_id < gpu_count; decode_gpu_id++)); do
local_prefill_gpu_ids+=("${prefill_gpu_id}")
local_decode_gpu_ids+=("${decode_gpu_id}")
done
done
fi
for ((pair_index = 0; pair_index < ${#local_prefill_gpu_ids[@]}; pair_index++)); do
prefill_gpu_id="${local_prefill_gpu_ids[pair_index]}"
decode_gpu_id="${local_decode_gpu_ids[pair_index]}"
prefill_rdma_device="${rdma_devices[prefill_gpu_id]}"
decode_rdma_device="${rdma_devices[decode_gpu_id]}"
decode_device_csv="$(select_decode_ib_devices "${prefill_gpu_id}" "${decode_gpu_id}")"
prefill_matrix="/tmp/gdr-smoke-prefill-gpu-${prefill_gpu_id}-nic-priority.json"
decode_matrix="/tmp/gdr-smoke-decode-gpu-${decode_gpu_id}-nic-priority.json"
write_cuda0_nic_matrix "${prefill_matrix}" "${prefill_rdma_device}"
IFS=',' read -r -a decode_ib_devices <<< "${decode_device_csv}"
write_cuda0_nic_matrix "${decode_matrix}" "${decode_ib_devices[@]}"
target_log="/tmp/gdr-smoke-decode-gpu-${decode_gpu_id}-target.log"
initiator_log="/tmp/gdr-smoke-prefill-gpu-${prefill_gpu_id}-initiator.log"
echo "=== GPUDirect RDMA prefill GPU ${prefill_gpu_id} (${prefill_rdma_device}) -> decode GPU ${decode_gpu_id} (${decode_device_csv}) ==="
start_target_process "${decode_gpu_id}" "${target_log}" \
--mode=target \
--protocol=rdma \
--metadata_server=P2PHANDSHAKE \
--local_server_name=127.0.0.2:0 \
--device_name="${decode_device_csv}" \
--nic_priority_matrix="${decode_matrix}" \
--use_vram=true \
--gpu_id=0 \
--buffer_size=100663296
target_name="$(wait_for_p2p_address "${target_log}" "${target_pid}" 30)"
echo "P2P target listening at ${target_name}"
set +e
MC_LOG_RDMA_SLICE_AFFINITY=1 \
GLOG_v=1 \
HIP_VISIBLE_DEVICES="${prefill_gpu_id}" \
timeout 120 "${validator_bin}" \
--mode=initiator \
--protocol=rdma \
--metadata_server=P2PHANDSHAKE \
--local_server_name=127.0.0.3:0 \
--segment_id="${target_name}" \
--device_name="${prefill_rdma_device}" \
--nic_priority_matrix="${prefill_matrix}" \
--use_vram=true \
--gpu_id=0 \
--buffer_size=100663296 \
--batch_size=1 \
--block_size=67108864 \
--threads=1 \
--duration=1 \
2>&1 | tee "${initiator_log}"
transfer_rc="${PIPESTATUS[0]}"
set -e
if [[ "${transfer_rc}" -ne 0 ]] ||
! grep -q "RDMA WRITE transfers completed" "${initiator_log}"; then
cat "${initiator_log}" >&2
cat "${target_log}" >&2
echo "ERROR: GPUDirect RDMA WRITE failed from prefill GPU ${prefill_gpu_id} (${prefill_rdma_device}) to decode GPU ${decode_gpu_id} (${decode_device_csv})" >&2
exit 1
fi
expected_peer_device="$(expected_decode_peer_device "${prefill_gpu_id}" "${decode_gpu_id}")"
expected_affinity="local_device_name=${prefill_rdma_device}, peer_device_name=${expected_peer_device}"
if grep -Fq "RDMA slice affinity:" "${initiator_log}"; then
if ! grep -Fq "${expected_affinity}" "${initiator_log}"; then
grep -F "RDMA slice affinity:" "${initiator_log}" >&2 || true
echo "ERROR: GPUDirect RDMA selected the wrong HCA for prefill GPU ${prefill_gpu_id}" >&2
exit 1
fi
else
echo "WARNING: RDMA WRITE completed, but HCA affinity logging was unavailable for prefill GPU ${prefill_gpu_id}" >&2
fi
stop_target_process
touch "${SMOKE_RUN_DIR}/node-local-passed-${SMOKE_RANK}-${prefill_gpu_id}-${decode_gpu_id}"
echo "GPUDirect RDMA passed from prefill GPU ${prefill_gpu_id} to decode GPU ${decode_gpu_id} via decode HCAs ${decode_device_csv}"
done
echo "Node-local GPUDirect RDMA passed for all ${#local_prefill_gpu_ids[@]} prefill/decode GPU pairs"
if [[ "${SMOKE_NODE_COUNT}" -lt 2 ]]; then
echo "Single-node GPUDirect RDMA smoke test passed"
exit 0
fi
touch "${SMOKE_RUN_DIR}/local-gdr-done-${SMOKE_RANK}"
if [[ "${SMOKE_RANK}" -le 1 ]]; then
deadline=$((SECONDS + 300))
while true; do
completed_nodes=0
for marker in "${SMOKE_RUN_DIR}"/local-gdr-done-*; do
[[ -e "${marker}" ]] && completed_nodes=$((completed_nodes + 1))
done
[[ "${completed_nodes}" -ge "${SMOKE_NODE_COUNT}" ]] && break
if [[ "${SECONDS}" -ge "${deadline}" ]]; then
echo "ERROR: timed out waiting for node-local GDR tests" >&2
exit 1
fi
sleep 2
done
fi
wait_for_file() {
local path="$1"
local timeout_seconds="$2"
local description="$3"
local deadline=$((SECONDS + timeout_seconds))
while [[ ! -s "${path}" ]]; do
if [[ "${SECONDS}" -ge "${deadline}" ]]; then
echo "ERROR: timed out waiting for ${description}: ${path}" >&2
exit 1
fi
sleep 1
done
}
local_ip=""
if command -v ip >/dev/null 2>&1; then
local_ip="$(ip route get 1.1.1.1 2>/dev/null | awk '
{
for (i = 1; i <= NF; i++) {
if ($i == "src" && i < NF) {
print $(i + 1)
exit
}
}
}
' || true)"
fi
if [[ -z "${local_ip}" ]]; then
local_ip="$(hostname -I 2>/dev/null | awk '{print $1}' || true)"
fi
if [[ -z "${local_ip}" ]]; then
echo "ERROR: unable to determine node IP for cross-node GDR testing" >&2
exit 1
fi
peer_info="${SMOKE_RUN_DIR}/cross-node-prefill-info"
if [[ "${SMOKE_RANK}" -eq 0 ]]; then
{
echo "${local_ip}"
echo "${gpu_count}"
} > "${peer_info}.tmp"
mv "${peer_info}.tmp" "${peer_info}"
elif [[ "${SMOKE_RANK}" -eq 1 ]]; then
wait_for_file "${peer_info}" 60 "prefill node information"
mapfile -t peer_data < "${peer_info}"
prefill_node_ip="${peer_data[0]:-}"
prefill_gpu_count="${peer_data[1]:-0}"
if [[ -z "${prefill_node_ip}" || "${prefill_gpu_count}" -ne "${gpu_count}" ]]; then
echo "ERROR: cross-node GPU topology mismatch: prefill=${prefill_gpu_count}, decode=${gpu_count}" >&2
exit 1
fi
fi
if [[ "${SMOKE_RANK}" -eq 0 || "${SMOKE_RANK}" -eq 1 ]]; then
cross_prefill_gpu_ids=()
cross_decode_gpu_ids=()
for ((gpu_id = 0; gpu_id < gpu_count; gpu_id++)); do
cross_prefill_gpu_ids+=("${gpu_id}")
cross_decode_gpu_ids+=("${gpu_id}")
done
for ((prefill_gpu_id = 0; prefill_gpu_id < gpu_count - 1; prefill_gpu_id++)); do
for ((decode_gpu_id = prefill_gpu_id + 1; decode_gpu_id < gpu_count; decode_gpu_id++)); do
cross_prefill_gpu_ids+=("${prefill_gpu_id}")
cross_decode_gpu_ids+=("${decode_gpu_id}")
done
done
for ((pair_index = 0; pair_index < ${#cross_prefill_gpu_ids[@]}; pair_index++)); do
prefill_gpu_id="${cross_prefill_gpu_ids[pair_index]}"
decode_gpu_id="${cross_decode_gpu_ids[pair_index]}"
prefill_rdma_device="${rdma_devices[prefill_gpu_id]}"
decode_rdma_device="${rdma_devices[decode_gpu_id]}"
decode_device_csv="${decode_rdma_device}"
expected_peer_device="${decode_rdma_device}"
is_cross_rail=0
if [[ "${prefill_gpu_id}" -ne "${decode_gpu_id}" ]]; then
decode_device_csv="$(select_decode_ib_devices "${prefill_gpu_id}" "${decode_gpu_id}")"
expected_peer_device="$(expected_decode_peer_device "${prefill_gpu_id}" "${decode_gpu_id}")"
is_cross_rail=1
fi
echo "=== Cross-node RDMA pair: prefill GPU ${prefill_gpu_id} (${prefill_rdma_device}) -> decode GPU ${decode_gpu_id} (${decode_device_csv}); expected peer HCA ${expected_peer_device} ==="
prefill_matrix="/tmp/cross-node-prefill-gpu-${prefill_gpu_id}-nic-priority.json"
decode_matrix="/tmp/cross-node-decode-gpu-${decode_gpu_id}-nic-priority.json"
write_cuda0_nic_matrix "${prefill_matrix}" "${prefill_rdma_device}"
if [[ "${is_cross_rail}" -eq 1 ]]; then
IFS=',' read -r -a decode_ib_devices <<< "${decode_device_csv}"
write_cuda0_nic_matrix "${decode_matrix}" "${decode_ib_devices[@]}"
else
write_cuda0_nic_matrix "${decode_matrix}" "${decode_rdma_device}"
fi
ready_file="${SMOKE_RUN_DIR}/cross-node-ready-prefill-${prefill_gpu_id}-decode-${decode_gpu_id}"
result_file="${SMOKE_RUN_DIR}/cross-node-result-prefill-${prefill_gpu_id}-decode-${decode_gpu_id}"
target_log="${SMOKE_RUN_DIR}/cross-node-prefill-${prefill_gpu_id}-decode-${decode_gpu_id}-target.log"
if [[ "${SMOKE_RANK}" -eq 1 ]]; then
rm -f \
"${ready_file}" "${ready_file}.tmp" \
"${result_file}" "${result_file}.tmp"
log_progress "=== Cross-node decode target: ${local_ip}, GPU ${decode_gpu_id} (${decode_rdma_device}) ==="
start_target_process "${decode_gpu_id}" "${target_log}" \
--mode=target \
--protocol=rdma \
--metadata_server=P2PHANDSHAKE \
--local_server_name="${local_ip}:0" \
--device_name="${decode_device_csv}" \
--nic_priority_matrix="${decode_matrix}" \
--use_vram=true \
--gpu_id=0 \
--buffer_size=100663296
target_name="$(wait_for_p2p_address "${target_log}" "${target_pid}" 30)"
log_progress "Cross-node P2P target listening at ${target_name}"
echo "${target_name}" > "${ready_file}.tmp"
mv "${ready_file}.tmp" "${ready_file}"
wait_for_file "${result_file}" 150 "prefill GPU ${prefill_gpu_id} to decode GPU ${decode_gpu_id} result"
result="$(<"${result_file}")"
stop_target_process
if [[ "${result}" != "0" ]]; then
cat "${target_log}" >&2
echo "ERROR: cross-node GPUDirect RDMA failed from prefill GPU ${prefill_gpu_id} to decode GPU ${decode_gpu_id}" >&2
exit 1
fi
log_progress "Cross-node GPUDirect RDMA passed on decode GPU ${decode_gpu_id}"
else
wait_for_file "${ready_file}" 120 "decode GPU ${decode_gpu_id} target"
target_name="$(<"${ready_file}")"
initiator_log="/tmp/cross-node-prefill-${prefill_gpu_id}-decode-${decode_gpu_id}-initiator.log"
echo "=== Cross-node prefill initiator: ${local_ip} GPU ${prefill_gpu_id} (${prefill_rdma_device}) -> ${target_name} decode GPU ${decode_gpu_id} ==="
transfer_batch_size=4
transfer_block_size=1048576
transfer_duration=2
affinity_env=()
if [[ "${is_cross_rail}" -eq 1 ]]; then
transfer_batch_size=1
transfer_block_size=67108864
transfer_duration=1
affinity_env=(MC_LOG_RDMA_SLICE_AFFINITY=1 GLOG_v=1)
fi
set +e
env "${affinity_env[@]}" HIP_VISIBLE_DEVICES="${prefill_gpu_id}" \
timeout 120 "${validator_bin}" \
--mode=initiator \
--protocol=rdma \
--metadata_server=P2PHANDSHAKE \
--local_server_name="${local_ip}:0" \
--segment_id="${target_name}" \
--device_name="${prefill_rdma_device}" \
--nic_priority_matrix="${prefill_matrix}" \
--use_vram=true \
--gpu_id=0 \
--buffer_size=100663296 \
--batch_size="${transfer_batch_size}" \
--block_size="${transfer_block_size}" \
--threads=1 \
--duration="${transfer_duration}" \
2>&1 | tee "${initiator_log}"
transfer_rc="${PIPESTATUS[0]}"
set -e
if [[ "${transfer_rc}" -eq 0 ]] &&
grep -q "RDMA WRITE transfers completed" "${initiator_log}"; then
result=0
else
result=1
fi
if [[ "${result}" -eq 0 && "${is_cross_rail}" -eq 1 ]]; then
expected_affinity="local_device_name=${prefill_rdma_device}, peer_device_name=${expected_peer_device}"
if grep -Fq "RDMA slice affinity:" "${initiator_log}"; then
if ! grep -Fq "${expected_affinity}" "${initiator_log}"; then
grep -F "RDMA slice affinity:" "${initiator_log}" >&2 || true
echo "ERROR: cross-node GPUDirect RDMA selected the wrong HCA from prefill GPU ${prefill_gpu_id} to decode GPU ${decode_gpu_id}" >&2
result=1
fi
else
echo "WARNING: cross-node RDMA WRITE completed, but HCA affinity logging was unavailable from prefill GPU ${prefill_gpu_id} to decode GPU ${decode_gpu_id}" >&2
fi
fi
echo "${result}" > "${result_file}.tmp"
mv "${result_file}.tmp" "${result_file}"
if [[ "${result}" -ne 0 ]]; then
cat "${target_log}" >&2 || true
echo "ERROR: cross-node GPUDirect RDMA WRITE failed from prefill GPU ${prefill_gpu_id} to decode GPU ${decode_gpu_id}" >&2
exit 1
fi
touch "${SMOKE_RUN_DIR}/cross-node-passed-${prefill_gpu_id}-${decode_gpu_id}"
echo "Cross-node GPUDirect RDMA passed from prefill GPU ${prefill_gpu_id} to decode GPU ${decode_gpu_id}"
fi
done
fi
if [[ "${SMOKE_RANK}" -eq 0 ]]; then
echo "Mooncake cross-node GPUDirect RDMA passed for same-index GPU pairs 0-7 and all cross-rail pairs i < j"
fi
cleanup_processes
log_progress "rank ${SMOKE_RANK} container script complete"
CONTAINER_SCRIPT
docker_rc=$?
set -e
echo "=== RDMA smoke container finished on rank ${rank}: rc=${docker_rc} ==="
cleanup
exit "${docker_rc}"
RANK_SCRIPT
chmod +x "${rank_script}"
slurm_status_file="${run_dir}/slurm-job.rc"
rm -f "${slurm_status_file}" "${slurm_status_file}.tmp"
rm -f \
"${run_dir}"/rank-rc-* \
"${run_dir}"/node-local-passed-* \
"${run_dir}"/cross-node-passed-*
batch_script="${run_dir}/rdma-smoke.sbatch.sh"
if [[ "${USES_SPUR_CONTROLLER}" == "1" ]]; then
# Spur launches this script on each node with SPUR_TASK_OFFSET; srun is unavailable.
cat > "${batch_script}" <<EOF
#!/usr/bin/env bash
set -euo pipefail
exec "${rank_script}"
EOF
else
cat > "${batch_script}" <<EOF
#!/usr/bin/env bash
set -euo pipefail
set +e
srun --nodes=${node_count} --ntasks=${node_count} --ntasks-per-node=1 \
"${rank_script}"
srun_rc=\$?
set -e
printf '%s\n' "\${srun_rc}" > "${slurm_status_file}.tmp"
mv "${slurm_status_file}.tmp" "${slurm_status_file}"
exit "\${srun_rc}"
EOF
fi
chmod +x "${batch_script}"
sbatch_cmd=(
sbatch
--parsable
--exclusive
--export=ALL
--job-name "${SLURM_JOB_NAME}"
--nodes "${node_count}"
--ntasks "${node_count}"
--ntasks-per-node 1
--time 01:00:00
--output "${SLURM_OUTPUT}"
--error "${SLURM_ERROR}"
)
if [[ -n "${nodes}" ]]; then
slurm_node_selection_args "${nodes}" "${node_count}"
sbatch_cmd+=("${SLURM_NODE_SELECTION_ARGS[@]}")
fi
if [[ "${SLURM_SUBMIT_RUNNER}" == "atomesh-cicd-mi350" ]]; then
sbatch_cmd+=(--controller "${SPUR_CONTROLLER_ADDR}")
else
[[ -z "${SLURM_ACCOUNT}" ]] || sbatch_cmd+=(--account "${SLURM_ACCOUNT}")
[[ -z "${SLURM_PARTITION}" ]] || sbatch_cmd+=(--partition "${SLURM_PARTITION}")
[[ -z "${SLURM_QOS}" ]] || sbatch_cmd+=(--qos "${SLURM_QOS}")
sbatch_cmd+=(--gres gpu:8)
if [[ "${USES_SPUR_CONTROLLER}" == "1" && -n "${SPUR_CONTROLLER_ADDR}" ]]; then
sbatch_cmd+=(
--controller "${SPUR_CONTROLLER_ADDR}"
)
fi
fi
sbatch_cmd+=("${batch_script}")
printf ' %q' "${sbatch_cmd[@]}"
echo
write_slurm_cancel_helper ""
set +e
sbatch_output="$("${sbatch_cmd[@]}")"
sbatch_rc=$?
set -e
echo "${sbatch_output}"
if [[ "${sbatch_rc}" -ne 0 ]]; then
echo "sbatch submit exit code: ${sbatch_rc}"
exit "${sbatch_rc}"
fi
JOB_ID="$(parse_sbatch_job_id "${sbatch_output}")"
SLURM_JOB_ACTIVE=1
echo "${JOB_ID}" | tee "${run_dir}/slurm-job-id"
write_slurm_cancel_helper "${JOB_ID}"
set_slurm_job_log_paths "${JOB_ID}"
SLURM_STATUS_DIR="${run_dir}"
SLURM_STATUS_RANKS="${node_count}"
monitor_slurm_job "${JOB_ID}"
# Spur leaves the job in COMPLETING while RDMA leftovers are reaped,
# so give sacct longer than the 30s default to publish a final state.
SLURM_ACCOUNTING_TIMEOUT="${SLURM_ACCOUNTING_TIMEOUT:-180}"
read_slurm_exit_code "${JOB_ID}"
read_slurm_status_files "${run_dir}" "${node_count}"
SLURM_JOB_ACTIVE=0
echo "slurm_state=${SLURM_STATE}"
echo "slurm_exit_code=${SLURM_EXIT_CODE}"
echo "slurm job exit code: ${SLURM_JOB_RC}"
exit "${SLURM_JOB_RC}"
- name: Summarize Mooncake RDMA smoke test
if: always()
env:
RDMA_SMOKE_OUTCOME: ${{ steps.rdma-smoke.outcome }}
run: |
set -uo pipefail
current_user="$(id -un 2>/dev/null || id -u)"
log_root="${ATOMESH_LOG_ROOT//\$\{USER\}/${current_user}}"
log_root="${log_root//\$USER/${current_user}}"
if [[ "$(hostname -s)" == "pit2-vm-amd-xl-02" ]]; then
log_root="/share_nfs/ATOMESH_RUNNER/ATOMESH_LOG"
fi
run_dir="${log_root%/}/rdma-smoke-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}"
summary_path="${run_dir}/rdma-smoke-summary.md"
mkdir -p "${run_dir}"
if [[ "${RDMA_SMOKE_OUTCOME}" == "success" ]]; then
outcome_icon="✅"
else
outcome_icon="❌"
fi
job_id=""
if [[ -s "${run_dir}/slurm-job-id" ]]; then
job_id="$(tr -d '[:space:]' < "${run_dir}/slurm-job-id")"
fi
shopt -s nullglob
log_files=("${run_dir}"/slurm-*.out "${run_dir}"/slurm-*.err)
shopt -u nullglob
{
echo "## Mooncake RDMA smoke test"
echo
echo "- Workflow result: ${outcome_icon} \`${RDMA_SMOKE_OUTCOME}\`"
echo "- Image: \`${RDMA_SMOKE_IMAGE}\`"
echo "- Requested nodes: \`${RDMA_SMOKE_NODE_COUNT}\`"
echo "- Decode HCA mode: \`${RDMA_SMOKE_DECODE_HCA_MODE}\`"
echo "- Mooncake GID index: \`${MC_GID_INDEX}\`"
echo "- Slurm job: \`${job_id:-not submitted}\`"
echo
echo "### RDMA WRITE results"
python3 - "${run_dir}" <<'PY'
import os
import sys
from pathlib import Path
run_dir = Path(sys.argv[1])
node_local_results = set()
for path in run_dir.glob("node-local-passed-*-*-*"):
try:
_, _, _, rank, src, dst = path.name.split("-")
node_local_results.add((int(rank), int(src), int(dst)))
except ValueError:
continue
cross_node_pairs = set()
for path in run_dir.glob("cross-node-passed-*-*"):
try:
_, _, _, src, dst = path.name.split("-")
cross_node_pairs.add((int(src), int(dst)))
except ValueError:
continue
cross_rail_pairs = {(src, dst) for src in range(7) for dst in range(src + 1, 8)}
same_index_pairs = {(gpu, gpu) for gpu in range(8)}
node_count = int(os.environ.get("RDMA_SMOKE_NODE_COUNT", "2"))
expected_node_local_results = {
(rank, src, dst)
for rank in range(node_count)
for src, dst in cross_rail_pairs
}
pair_label = "GPU" + "、".join(
f"{src}→{dst}" for src, dst in sorted(cross_rail_pairs)
)
node_local_icon = "✅" if expected_node_local_results <= node_local_results else "❌"
same_index_icon = "✅" if same_index_pairs <= cross_node_pairs else "❌"
cross_rail_icon = "✅" if cross_rail_pairs <= cross_node_pairs else "❌"
print(f"Node-local {pair_label} {node_local_icon}")
print(f"Cross-node same-index GPU0–7 {same_index_icon}")
print(f"Cross-node cross-rail {pair_label} {cross_rail_icon}")
PY
echo
echo "### Errors"
if [[ "${#log_files[@]}" -gt 0 ]] &&
awk '
/^(ERROR:|E[0-9]{8})/ ||
/Permission denied|command not found|Detect data integrity/ {
if (!seen[$0]++ && count++ < 20) {
print "- ❌ `" $0 "`"
}
}
END { exit(count ? 0 : 1) }
' "${log_files[@]}"; then
:
else
echo "- No RDMA smoke errors found in Slurm logs."
fi
} | tee "${summary_path}" >> "${GITHUB_STEP_SUMMARY}"
echo "RDMA smoke summary written to ${summary_path}"
run-model-benchmark:
name: ${{ matrix.group.name }}
needs: [ci-gate, load-config]
if: >-
needs.load-config.outputs.has_matrix == 'true'
&& (
github.event_name == 'schedule'
|| (github.event_name == 'workflow_dispatch' && inputs.run_model_benchmark)
|| (github.event.pull_request && !github.event.pull_request.head.repo.fork)
)
strategy:
fail-fast: false
# The template runs a config's cells one at a time, so a run holds at most
# this many of the shared atomesh runners.
max-parallel: 4
matrix:
group: ${{ fromJson(needs.load-config.outputs.groups_json || '[{"name":"skip","matrix_json":"{\"include\":[]}"}]') }}
uses: ./.github/workflows/atomesh-benchmark-tmpl.yaml
with:
matrix_json: ${{ matrix.group.matrix_json }}
atom_source: ${{ github.event_name == 'workflow_dispatch' && inputs.atom_source || 'mounted' }}
model_root: ${{ needs.load-config.outputs.model_root }}
dashboard_hardware: ${{ needs.load-config.outputs.dashboard_hardware }}
summarize-results:
name: Summarize ATOMesh benchmark results
needs: [run-model-benchmark]
if: ${{ always() && !cancelled() && needs.run-model-benchmark.result != 'skipped' }}
runs-on: ubuntu-latest
outputs:
has_results: ${{ steps.summary.outputs.has_results }}
steps:
- name: Checkout ATOM repo
uses: actions/checkout@v6
- name: Download model benchmark artifacts
uses: actions/download-artifact@v8
with:
pattern: atomesh-model-benchmark-*
merge-multiple: true
path: atomesh-results
- name: Build benchmark summary
id: summary
run: |
set -euo pipefail
mkdir -p atomesh-results
python3 .github/scripts/atomesh/process_result.py \
atomesh-results \
--output atomesh-benchmark-action.json \
--summary atomesh-benchmark-summary.md \
--hardware "${ATOMESH_DASHBOARD_HARDWARE}" \
--run-url "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
# Empty for standard ISL/OSL cases: only AIPerf writes the console dump.
python3 .github/scripts/atomesh/aiperf_console_report.py \
atomesh-results \
--output atomesh-aiperf-raw.md
python3 - <<'PY' > atomesh-case-log-paths.md
import json
import re
from pathlib import Path
results = Path("atomesh-results")
def sort_key(case_id):
"""Order this table like the perf summary: (benchmark_model_name,
max_concurrency), read from the case's own result JSON so both tables
key off the same fields. A cell that sweeps several concurrencies
leads at its lowest one; a case that died before writing any result
falls back to its id, whose prefix ahead of the NpMd topology token is
the model name.
"""
keys = []
for path in sorted((results / case_id).rglob("pd-*.json")):
try:
payload = json.loads(path.read_text(encoding="utf-8"))
model = str(payload.get("benchmark_model_name") or "")
conc = int(payload.get("max_concurrency") or 0)
except (OSError, ValueError, TypeError):
continue
keys.append((model.rstrip("/").split("/")[-1].lower(), conc))
if keys:
return min(keys)
topology = re.search(r"-\d+p\d+d-", case_id)
found = re.findall(r"-c(\d+)-", case_id)
return (
case_id[: topology.start()] if topology else case_id,
int(found[-1]) if found else 0,
)
rows = []
for path in results.glob("*.log-root"):
case_id = path.name[: -len(".log-root")]
job_file = path.with_name(f"{case_id}.slurm-job-id")
job_id = job_file.read_text().strip() if job_file.is_file() else ""
rows.append((case_id, job_id or "--", path.read_text().strip()))
if rows:
print("### ATOMesh Case Log Paths")
print()
print("| Case | Slurm job | Log path |")
print("| --- | --- | --- |")
for case_id, job_id, log_root in sorted(
rows, key=lambda row: sort_key(row[0]) + (row[0],)
):
print(f"| {case_id} | {job_id} | `{log_root}` |")
print()
PY
if [[ -s atomesh-case-log-paths.md ]]; then
cat atomesh-case-log-paths.md >> "$GITHUB_STEP_SUMMARY"
fi
cat atomesh-benchmark-summary.md >> "$GITHUB_STEP_SUMMARY"
if [[ -s atomesh-aiperf-raw.md ]]; then
{
echo
cat atomesh-aiperf-raw.md
} >> "$GITHUB_STEP_SUMMARY"
fi
ENTRY_COUNT="$(python3 - <<'PY'
import json
from pathlib import Path
path = Path("atomesh-benchmark-action.json")
entries = json.loads(path.read_text(encoding="utf-8")) if path.is_file() else []
print(len(entries))
PY
)"
echo "entry_count=${ENTRY_COUNT}" >> "$GITHUB_OUTPUT"
if [[ "${ENTRY_COUNT}" -gt 0 ]]; then
echo "has_results=true" >> "$GITHUB_OUTPUT"
else
echo "has_results=false" >> "$GITHUB_OUTPUT"
echo "No successful ATOMesh benchmark result JSONs were produced; dashboard publish will be skipped." >> "$GITHUB_STEP_SUMMARY"
fi
- name: Upload AIPerf Perfetto traces
if: always()
uses: ./.github/actions/upload-aiperf-traces
with:
result-dir: atomesh-results
artifact-name: aiperf-chrome-traces-${{ github.run_id }}
output-dir: aiperf-traces
run-url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
# Without merge-multiple each case keeps its own directory, named after
# its per-case artifact.
- name: Download torch profiler traces
if: always()
uses: actions/download-artifact@v8
with:
pattern: atomesh-torch-traces-*
path: torch-traces
- name: Index torch profiler traces
if: always()
id: torch-traces
run: |
set -euo pipefail
if [[ -z "$(find torch-traces -name '*.pt.trace.json*' -print -quit 2>/dev/null)" ]]; then
echo "has_traces=false" >> "$GITHUB_OUTPUT"
exit 0
fi
echo "has_traces=true" >> "$GITHUB_OUTPUT"
python3 - <<'PY'
import json
import os
import shutil
from pathlib import Path
root = Path("torch-traces")
# A non-zipped artifact takes its file's basename as its name, and
# names must be unique in the run, so each trace is staged under
# case/worker/rank.
direct = Path("torch-traces-direct")
direct.mkdir(exist_ok=True)
manifest = []
for path in sorted(root.rglob("*.pt.trace.json*")):
parts = path.relative_to(root).parts
case = parts[0].removeprefix("atomesh-torch-traces-")
# .../torch_traces/<worker>/<rank>/<file>
worker, rank = parts[-3], parts[-2]
size = path.stat().st_size / 2**20
suffix = path.name[path.name.find(".pt.trace.json"):]
staged = direct / f"{case}_{worker}_{rank}{suffix}"
try:
os.link(path, staged)
except OSError:
shutil.copy2(path, staged)
manifest.append(
{
"case": case,
"worker": worker,
"rank": rank,
"size_mb": round(size, 1),
"file": str(staged),
}
)
Path("torch-traces-manifest.json").write_text(json.dumps(manifest, indent=2))
PY
du -sh torch-traces
# upload-artifact takes one non-zipped file per step and the trace count
# varies per run, so loop over @actions/artifact from a JS step: run
# steps never see ACTIONS_RUNTIME_TOKEN.
- name: Install artifact client for per-rank traces
if: ${{ always() && steps.torch-traces.outputs.has_traces == 'true' }}
continue-on-error: true
run: npm install --prefix "${RUNNER_TEMP}/artifact-client" --no-save --no-audit --no-fund @actions/artifact@^6.2.0
- name: Upload per-rank torch profiler traces
if: ${{ always() && steps.torch-traces.outputs.has_traces == 'true' }}
continue-on-error: true
uses: actions/github-script@v8
with:
script: |
const fs = require('fs')
const path = require('path')
const {pathToFileURL} = require('url')
const clientEntry = path.join(
process.env.RUNNER_TEMP,
'artifact-client/node_modules/@actions/artifact/lib/artifact.js'
)
const {DefaultArtifactClient} = await import(pathToFileURL(clientEntry).href)
const client = new DefaultArtifactClient()
const manifest = JSON.parse(fs.readFileSync('torch-traces-manifest.json', 'utf8'))
const runUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`
for (const entry of manifest) {
try {
const {id} = await client.uploadArtifact(
path.basename(entry.file),
[entry.file],
path.dirname(entry.file),
{skipArchive: true}
)
entry.url = `${runUrl}/artifacts/${id}`
} catch (err) {
core.warning(`per-rank upload failed for ${entry.file}: ${err.message}`)
}
}
fs.writeFileSync('torch-traces-manifest.json', JSON.stringify(manifest, null, 2))
- name: Link torch profiler traces in summary
if: ${{ always() && steps.torch-traces.outputs.has_traces == 'true' }}
run: |
set -euo pipefail
{
echo
echo "### Torch Profiler Traces"
echo
echo "Each Download link fetches that rank's \`.pt.trace.json.gz\` alone, unzipped; open it in [Perfetto UI](https://ui.perfetto.dev)."
echo "The case's \`torch_profile.log\`, which records when the window opened and closed, stays in its \`atomesh-torch-traces-<case>\` artifact."
echo
python3 - <<'PY'
import json
from pathlib import Path
print("| Case | Worker | Rank | Size (MB) | Download |")
print("| --- | --- | --- | --- | --- |")
for e in json.loads(Path("torch-traces-manifest.json").read_text()):
link = f"[{Path(e['file']).name}]({e['url']})" if e.get("url") else "—"
print(f"| {e['case']} | {e['worker']} | {e['rank']} | {e['size_mb']:.1f} | {link} |")
PY
} >> "$GITHUB_STEP_SUMMARY"
- name: Upload benchmark summary
if: ${{ steps.summary.outputs.has_results == 'true' }}
uses: actions/upload-artifact@v7
with:
name: atomesh-benchmark-summary
path: |
atomesh-benchmark-action.json
atomesh-benchmark-summary.md
atomesh-aiperf-raw.md
atomesh-case-log-paths.md
if-no-files-found: ignore
atomesh-benchmark-gate:
name: ${{ (github.event_name != 'pull_request_review' || needs.ci-gate.outputs.should_run == 'true') && 'ATOMesh Benchmark Gate' || 'ATOMesh Benchmark Gate not requested' }}
if: always()
runs-on: ubuntu-latest
permissions:
contents: read
needs:
- ci-gate
- load-config
- rdma-smoke-test
- run-model-benchmark
- summarize-results
steps:
- name: Checkout ATOM repo
uses: actions/checkout@v6
- name: Evaluate ATOMesh benchmark gate
uses: ./.github/actions/evaluate-test-gate
with:
gate-name: ATOMesh Benchmark Gate
suite-name: ATOMesh benchmark tests
should-run: ${{ needs.ci-gate.outputs.should_run }}
decidable: ${{ needs.ci-gate.outputs.decidable }}
reason: ${{ needs.ci-gate.outputs.reason }}
ci-gate-result: ${{ needs.ci-gate.result }}
optional-results: |
rdma-smoke-test=${{ needs.rdma-smoke-test.result }}
run-model-benchmark=${{ needs.run-model-benchmark.result }}
summarize-results=${{ needs.summarize-results.result }}
required-results: |
load-config=${{ needs.load-config.result }}
run-model-benchmark=${{ (github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && inputs.run_model_benchmark) || (github.event.pull_request && !github.event.pull_request.head.repo.fork)) && needs.run-model-benchmark.result || 'success' }}
dashboard:
concurrency:
group: gh-pages-deploy
cancel-in-progress: false
name: Update ATOMesh Benchmark Dashboard
needs: [summarize-results]
if: >-
!cancelled()
&& needs.summarize-results.result == 'success'
&& needs.summarize-results.outputs.has_results == 'true'
&& (
github.event_name == 'schedule'
|| (github.event_name == 'workflow_dispatch' && inputs.publish_dashboard)
)
runs-on: ubuntu-latest
steps:
- name: Checkout ATOM repo
uses: actions/checkout@v6
- name: Download CI benchmark dashboard inputs
uses: actions/download-artifact@v8
with:
name: atomesh-benchmark-summary
path: atomesh-dashboard-input
- name: Prepare ATOMesh dashboard assets
run: |
set -euo pipefail
test -s atomesh-dashboard-input/atomesh-benchmark-action.json
cp .github/dashboard/index.html /tmp/atomesh_dashboard_index.html
- name: Prepare existing dashboard data
id: prepare_dashboard_data
uses: ./.github/actions/prepare-dashboard-data
with:
data-path: benchmark-dashboard/data.js
- name: Store ATOMesh benchmark result to dashboard
uses: benchmark-action/github-action-benchmark@v1
with:
tool: customBiggerIsBetter
output-file-path: atomesh-dashboard-input/atomesh-benchmark-action.json
gh-pages-branch: gh-pages
benchmark-data-dir-path: benchmark-dashboard
auto-push: false
max-items-in-chart: 300
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Validate dashboard data after write
uses: ./.github/actions/validate-dashboard-data
with:
data-path: benchmark-dashboard/data.js
min-entries: ${{ steps.prepare_dashboard_data.outputs.entry_count }}
- name: Deploy ATOMesh dashboard shell to gh-pages
run: |
set -euo pipefail
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git fetch origin gh-pages
git checkout gh-pages
git pull --ff-only origin gh-pages
mkdir -p benchmark-dashboard
cp /tmp/atomesh_dashboard_index.html benchmark-dashboard/index.html
git add benchmark-dashboard/index.html
git diff --cached --quiet || git commit -m "Update ATOMesh benchmark dashboard"
git push origin gh-pages