Skip to content

Commit 3519f0e

Browse files
committed
Merge branch 'main' of https://github.com/devalshahamd/ATOM
2 parents bdea5f7 + 675fdac commit 3519f0e

811 files changed

Lines changed: 146744 additions & 11870 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.claude/hooks/auto_lint.py‎

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
#!/usr/bin/env python3
2-
"""PostToolUse hook: auto-format Python files with black + ruff after Edit/Write."""
2+
"""PostToolUse hook: black + ruff on the file just edited, and say what is left.
3+
4+
Fixing silently is only half of it. `ruff --fix` cannot fix every rule -- RUF012
5+
is one it only advises on -- and a violation it leaves behind used to vanish
6+
here, because this hook captured ruff's output and never read it. CI does not
7+
vanish: reviewdog filters to the pull request's diff context, so any finding on
8+
a line this edit moved becomes a red check, whatever the repository's total was
9+
before.
10+
11+
So whatever survives `--fix` goes back to Claude on stderr with exit 2, which
12+
for a PostToolUse hook means "show this, the tool already ran". Pre-existing
13+
findings in the file are reported too, on purpose: they are exactly the ones CI
14+
picks up once an edit lands beside them.
15+
"""
316

417
import json
518
import shutil
@@ -10,15 +23,38 @@
1023
info = json.loads(data)
1124
file_path = info.get("tool_input", {}).get("file_path", "")
1225

26+
remaining = ""
1327
if file_path.endswith(".py"):
1428
black = shutil.which("black")
1529
ruff = shutil.which("ruff")
30+
# `check=False` throughout: a formatter that finds nothing to do and a
31+
# linter that finds something both exit non-zero, and neither is this
32+
# hook's failure -- the second one is its whole output.
1633
if black:
17-
subprocess.run([black, "--quiet", file_path], capture_output=True)
34+
subprocess.run([black, "--quiet", file_path], capture_output=True, check=False)
1835
if ruff:
1936
subprocess.run(
20-
[ruff, "check", "--fix", "--quiet", file_path], capture_output=True
37+
[ruff, "check", "--fix", "--quiet", file_path],
38+
capture_output=True,
39+
check=False,
2140
)
41+
left = subprocess.run(
42+
[ruff, "check", "--output-format=concise", file_path],
43+
capture_output=True,
44+
text=True,
45+
check=False,
46+
)
47+
if left.returncode:
48+
remaining = left.stdout.strip()
2249

2350
# Output original data to stdout per hook protocol
2451
print(data)
52+
53+
if remaining:
54+
print(
55+
f"ruff still reports these in {file_path} after --fix. CI reviewdog "
56+
"flags any of them that land in the diff context, so fix them now "
57+
"rather than after the push:\n" + remaining,
58+
file=sys.stderr,
59+
)
60+
sys.exit(2)

‎.github/actions/atom-bench-container/action.yml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ inputs:
1515
model-path:
1616
description: HF model id / path to download into the container.
1717
required: true
18+
runner:
19+
description: Job runner label; forwarded so runner-specific container env can be applied.
20+
required: false
21+
default: ""
1822
env-vars:
1923
description: Newline-separated KEY=VAL model env vars (written to an env-file).
2024
required: false
@@ -43,6 +47,7 @@ runs:
4347
with:
4448
container-name: ${{ inputs.container-name }}
4549
base-image: ${{ inputs.image }}
50+
runner: ${{ inputs.runner }}
4651
env-vars: ${{ inputs.env-vars }}
4752
hf-token: ${{ inputs.hf-token }}
4853
network-host: "true"

‎.github/actions/setup-gpu-container/action.yml‎

Lines changed: 43 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,16 +88,33 @@ runs:
8888
fi
8989
9090
MODEL_HOST_ROOT=""
91-
for d in /shared_nfs/huggingface_models /models /data/models; do
92-
if [ -d "$d" ]; then
93-
MODEL_HOST_ROOT="$d"
94-
break
95-
fi
96-
done
91+
# PITT predownload runners keep model payloads on the Docker host under
92+
# /models. The Actions runner process may not see that host path itself,
93+
# so do not gate the bind mount on `[ -d /models ]` for that label.
94+
if [ "${RUNNER_LABEL}" = "atom-mi355-8gpu.predownload" ]; then
95+
MODEL_HOST_ROOT="/models"
96+
else
97+
# Prefer the common host cache roots used by the GPU workflows.
98+
for d in \
99+
/models \
100+
/shared_nfs/huggingface_models \
101+
/shared_nfs/models \
102+
/it-share/models \
103+
/mnt/raid0/pretrained_model \
104+
/shared/data/WRH/models \
105+
/data/models \
106+
/data/pretrained_model; do
107+
if [ -d "$d" ]; then
108+
MODEL_HOST_ROOT="$d"
109+
break
110+
fi
111+
done
112+
fi
97113
98114
MODEL_MOUNT=""
99115
if [ -n "$MODEL_HOST_ROOT" ]; then
100116
MODEL_MOUNT="-v ${MODEL_HOST_ROOT}:/models"
117+
echo "Using model cache root: ${MODEL_HOST_ROOT}"
101118
echo "MODEL_HOST_ROOT=${MODEL_HOST_ROOT}" >> "$GITHUB_ENV"
102119
else
103120
echo "Warning: no model cache directory found on runner; skipping /models mount and disabling model pre-download optimization."
@@ -108,6 +125,20 @@ runs:
108125
# (e.g. benchmark + regression) don't clobber each other's file.
109126
ENV_FILE="/tmp/atom_${CONTAINER_NAME}_env.txt"
110127
printenv MODEL_ENV_VARS | grep -v '^$' > "$ENV_FILE" || true
128+
USE_LOOPBACK_SOCKETS=false
129+
case "${RUNNER_LABEL}" in
130+
linux-atom-do-mi350x-8|linux-atom-do-mi350x-8.test|atom-mi355-8gpu.predownload)
131+
USE_LOOPBACK_SOCKETS=true
132+
;;
133+
esac
134+
if [ "${USE_LOOPBACK_SOCKETS}" = "true" ]; then
135+
grep -v -E '^(NCCL_SOCKET_IFNAME|MORI_SOCKET_IFNAME)=' "$ENV_FILE" > "${ENV_FILE}.tmp" || true
136+
mv "${ENV_FILE}.tmp" "$ENV_FILE"
137+
{
138+
echo "NCCL_SOCKET_IFNAME=lo"
139+
echo "MORI_SOCKET_IFNAME=lo"
140+
} >> "$ENV_FILE"
141+
fi
111142
112143
IMAGE_TAG="${RESOLVED_ATOM_BASE_IMAGE:-$ATOM_BASE_IMAGE}"
113144
echo "Starting container with image: $IMAGE_TAG"
@@ -129,13 +160,17 @@ runs:
129160
MMAP_FLAG=""
130161
[ "${DISABLE_MMAP}" = "true" ] && MMAP_FLAG="-e ATOM_DISABLE_MMAP=true"
131162
163+
GROUP_ADD_FLAGS="--group-add video"
164+
if getent group render >/dev/null 2>&1; then
165+
GROUP_ADD_FLAGS="${GROUP_ADD_FLAGS} --group-add $(getent group render | cut -d: -f3)"
166+
fi
167+
132168
docker run -dt $PULL_FLAG $NETWORK_FLAG --device=/dev/kfd $DEVICE_FLAG \
133169
-v "${GITHUB_WORKSPACE:-$PWD}":/workspace \
134170
$MODEL_MOUNT \
135171
-w /workspace \
136-
--ipc=host --group-add video \
172+
--ipc=host $GROUP_ADD_FLAGS \
137173
--shm-size=16G \
138-
--privileged \
139174
--cap-add=SYS_PTRACE \
140175
-e HF_TOKEN="${HF_TOKEN:-}" \
141176
-e ATOM_DOCKER_IMAGE="${ATOM_DASHBOARD_DOCKER_IMAGE:-}" \
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: Upload AIPerf Perfetto traces
2+
description: >-
3+
Convert profile_export.jsonl files into Chrome/Perfetto traces and upload
4+
them as a workflow artifact. No-ops when no AIPerf exports are present.
5+
6+
inputs:
7+
result-dir:
8+
description: Directory to scan for profile_export.jsonl
9+
required: true
10+
artifact-name:
11+
description: GitHub Actions artifact name
12+
required: true
13+
output-dir:
14+
description: Directory to write generated traces
15+
required: false
16+
default: aiperf-traces
17+
run-url:
18+
description: Workflow run URL for the Job Summary download links
19+
required: false
20+
default: ""
21+
retention-days:
22+
description: Artifact retention in days
23+
required: false
24+
default: "30"
25+
26+
outputs:
27+
has_traces:
28+
description: Whether any Chrome traces were generated
29+
value: ${{ steps.convert.outputs.has_traces }}
30+
artifact-url:
31+
description: Artifact download URL when traces were uploaded
32+
value: ${{ steps.upload.outputs.artifact-url }}
33+
34+
runs:
35+
using: composite
36+
steps:
37+
- name: Convert AIPerf exports to Chrome traces
38+
id: convert
39+
shell: bash
40+
env:
41+
RESULT_DIR: ${{ inputs.result-dir }}
42+
OUTPUT_DIR: ${{ inputs.output-dir }}
43+
RUN_URL: ${{ inputs.run-url }}
44+
run: |
45+
set -euo pipefail
46+
mkdir -p "${OUTPUT_DIR}"
47+
if [[ -d "${RESULT_DIR}" ]]; then
48+
extra=()
49+
if [[ -n "${RUN_URL}" ]]; then
50+
extra+=(--run-url "${RUN_URL}")
51+
fi
52+
if ! python3 "${GITHUB_WORKSPACE}/.github/scripts/generate_aiperf_traces.py" \
53+
"${RESULT_DIR}" \
54+
--output-dir "${OUTPUT_DIR}" \
55+
--index "${OUTPUT_DIR}/TRACE_INDEX.md" \
56+
"${extra[@]}"; then
57+
echo "::warning::AIPerf chrome-trace conversion reported errors"
58+
fi
59+
else
60+
echo "skip chrome traces: ${RESULT_DIR} does not exist"
61+
fi
62+
has_traces=false
63+
if [[ -n "$(find "${OUTPUT_DIR}" -type f \( -name '*.trace.json' -o -name '*.trace.json.gz' \) -print -quit)" ]]; then
64+
has_traces=true
65+
fi
66+
echo "has_traces=${has_traces}" >> "$GITHUB_OUTPUT"
67+
68+
- name: Upload Perfetto traces
69+
if: ${{ steps.convert.outputs.has_traces == 'true' }}
70+
id: upload
71+
uses: actions/upload-artifact@v7
72+
with:
73+
name: ${{ inputs.artifact-name }}
74+
path: ${{ inputs.output-dir }}/
75+
if-no-files-found: ignore
76+
retention-days: ${{ inputs.retention-days }}
77+
78+
- name: Publish Perfetto trace download links
79+
if: ${{ steps.convert.outputs.has_traces == 'true' }}
80+
shell: bash
81+
env:
82+
ARTIFACT_URL: ${{ steps.upload.outputs.artifact-url }}
83+
ARTIFACT_NAME: ${{ inputs.artifact-name }}
84+
OUTPUT_DIR: ${{ inputs.output-dir }}
85+
RUN_URL: ${{ inputs.run-url }}
86+
run: |
87+
set -euo pipefail
88+
{
89+
echo
90+
echo "### AIPerf Chrome Traces (Perfetto)"
91+
echo
92+
if [[ -n "${ARTIFACT_URL}" ]]; then
93+
echo "Download [\`${ARTIFACT_NAME}\`](${ARTIFACT_URL})."
94+
elif [[ -n "${RUN_URL}" ]]; then
95+
echo "Download artifact \`${ARTIFACT_NAME}\` from [this run](${RUN_URL})."
96+
else
97+
echo "Download artifact \`${ARTIFACT_NAME}\` from this workflow run."
98+
fi
99+
echo
100+
echo "Open the \`.trace.json.gz\` file in [Perfetto UI](https://ui.perfetto.dev) (\`Open trace file\`) or gunzip it and load \`chrome://tracing\`."
101+
echo
102+
if [[ -f "${OUTPUT_DIR}/TRACE_INDEX.md" ]]; then
103+
cat "${OUTPUT_DIR}/TRACE_INDEX.md"
104+
fi
105+
} >> "${GITHUB_STEP_SUMMARY}"

0 commit comments

Comments
 (0)