Skip to content

Commit 56543a2

Browse files
authored
Merge 92db8ca into 91f2c06
2 parents 91f2c06 + 92db8ca commit 56543a2

File tree

18 files changed

+965
-32
lines changed

18 files changed

+965
-32
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ Describe the intent of your PR here.
1717
## PR Merge Checklist
1818

1919
1. [ ] The PR is rebased on the latest `devel` commit and pointing to `devel`.
20-
2. [ ] Your PR reviewed and approved.
20+
2. [ ] Your PR has been reviewed and approved.
2121
3. [ ] All checks are passing.

.github/actions/build/action.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# SPDX-FileCopyrightText: Copyright (C) 2025 Advanced Micro Devices, Inc. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
name: "Build IRON"
5+
6+
inputs:
7+
rebuild_flags:
8+
required: false
9+
default: ""
10+
env_name:
11+
required: false
12+
default: "ci_env"
13+
cmake_extra_flags:
14+
required: false
15+
default: ""
16+
17+
runs:
18+
using: "composite"
19+
steps:
20+
- name: Build
21+
env:
22+
HOME: /workspace
23+
shell: bash
24+
run: |
25+
source ${{ inputs.env_name }}/bin/activate
26+
set -euxo pipefail
27+
if [ -n "${{ inputs.cmake_extra_flags }}" ]; then
28+
echo "Using extra CMake flags: ${{ inputs.cmake_extra_flags }}"
29+
fi
30+
cmake -B build -DCMAKE_BUILD_TYPE=Release -DIRONCLAD_AIE_TARGET=aie2p ${{ inputs.cmake_extra_flags }}
31+
cmake --build build -- -j1 VERBOSE=1
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# SPDX-FileCopyrightText: Copyright (C) 2025 Advanced Micro Devices, Inc. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
name: "Commit Test Results to a Branch"
5+
6+
inputs:
7+
pretty_flags:
8+
required: false
9+
default: "--metric='Latency (mean)' --metric='Bandwidth (mean)' --metric='GFLOP/s (mean)' -o pretty.md"
10+
input_csv:
11+
required: false
12+
default: "tests_latest.csv"
13+
branch:
14+
required: false
15+
default: "ci"
16+
dir:
17+
required: true
18+
19+
outputs:
20+
results_dir:
21+
description: "Absolute path to the directory containing generated test results"
22+
value: ${{ steps.merge_results.outputs.results_dir }}
23+
24+
runs:
25+
using: "composite"
26+
steps:
27+
- name: Format results and receive previous results from branch
28+
id: merge_results
29+
env:
30+
HOME: /workspace
31+
shell: bash
32+
run: |
33+
export DATE=$(printf '%(%Y_%m_%d_%H_%M_%S)T')
34+
export COMMIT_SHA=$(git rev-parse --short HEAD)
35+
36+
./ci/scripts/pretty.py --date=${DATE} --commit=${COMMIT_SHA} ${{ inputs.pretty_flags }} ${{ inputs.input_csv }}
37+
38+
git fetch origin ${{ inputs.branch }}:${{ inputs.branch }}
39+
git worktree add ../results ${{ inputs.branch }}
40+
41+
mkdir -p ../results/${{ inputs.dir }}
42+
cp ${{ inputs.input_csv }} ../results/${{ inputs.dir }}/latest.csv
43+
cp pretty.md ../results/${{ inputs.dir }}/readme.md
44+
touch ../results/${{ inputs.dir }}/all.csv
45+
46+
RESULTS_DIR=$(realpath ../results/${{ inputs.dir }})
47+
48+
./ci/scripts/merge_all.py --all ${RESULTS_DIR}/all.csv --latest ${RESULTS_DIR}/latest.csv
49+
./ci/scripts/pretty_trends.py ${RESULTS_DIR}/all.csv -o ${RESULTS_DIR}/trends.md
50+
51+
echo "commit_sha=${COMMIT_SHA}" >> $GITHUB_OUTPUT
52+
echo "date=${DATE}" >> $GITHUB_OUTPUT
53+
echo "results_dir=${RESULTS_DIR}" >> $GITHUB_OUTPUT
54+
55+
- name: Comment results on PR
56+
if: ${{ startsWith(github.event_name, 'pull_request') }}
57+
continue-on-error: true # This step will fail for PRs from forks because of permission issues; ignore
58+
uses: actions/github-script@v7
59+
with:
60+
github-token: ${{ github.token }}
61+
script: |
62+
const fs = require('fs');
63+
const commitSha = '${{ steps.merge_results.outputs.commit_sha }}';
64+
const date = '${{ steps.merge_results.outputs.date }}';
65+
const server = '${{ github.server_url }}';
66+
const repo = '${{ github.repository }}';
67+
68+
let prettyContent = '';
69+
try {
70+
prettyContent = fs.readFileSync(`${{ steps.merge_results.outputs.results_dir }}/readme.md`, 'utf8');
71+
} catch (error) {
72+
prettyContent = 'Pretty output not available.';
73+
}
74+
75+
// Read the trends.md content
76+
let trendsContent = '';
77+
try {
78+
trendsContent = fs.readFileSync(`${{ steps.merge_results.outputs.results_dir }}/trends.md`, 'utf8');
79+
} catch (error) {
80+
trendsContent = 'Trends not available.';
81+
}
82+
83+
const body = `<details>
84+
<summary>📊 Test Results for ${process.env.GITHUB_WORKFLOW}</summary>
85+
86+
[${commitSha}](${server}/${repo}/commit/${commitSha}) (${date})
87+
88+
${prettyContent}
89+
90+
</details>
91+
92+
<details>
93+
<summary>📈 Trends (vs main branch) for ${process.env.GITHUB_WORKFLOW}</summary>
94+
95+
[${commitSha}](${server}/${repo}/commit/${commitSha}) (${date})
96+
97+
${trendsContent}
98+
99+
</details>`;
100+
101+
github.rest.issues.createComment({
102+
issue_number: context.issue.number,
103+
owner: context.repo.owner,
104+
repo: context.repo.repo,
105+
body: body
106+
});
107+
108+
- name: Push new test results to branch
109+
if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/devel') }}
110+
continue-on-error: true # This step will fail for PRs from forks because of permission issues; ignore
111+
shell: bash
112+
run: |
113+
cd ../results
114+
git add ${{ inputs.dir }}/all.csv ${{ inputs.dir }}/latest.csv ${{ inputs.dir }}/readme.md ${{ inputs.dir }}/trends.md
115+
git config user.name "github-actions[bot]"
116+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
117+
git commit -m "Add test results testing commit \`${{ steps.merge_results.outputs.commit_sha }}\` at ${{ steps.merge_results.outputs.date }}" || echo "No changes to commit"
118+
git push origin ${{ inputs.branch }}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# SPDX-FileCopyrightText: Copyright (C) 2025 Advanced Micro Devices, Inc. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
name: "Install IRONCLAD Prerequisites"
5+
6+
inputs:
7+
env_name:
8+
required: false
9+
default: "ci_env"
10+
11+
runs:
12+
using: "composite"
13+
steps:
14+
- name: Install Prerequisites
15+
env:
16+
HOME: /workspace
17+
shell: bash
18+
run: |
19+
set -euxo pipefail
20+
python3 -m venv ${{ inputs.env_name }}
21+
source ${{ inputs.env_name }}/bin/activate
22+
pip install --upgrade pip
23+
env MLIR_PYTHON_EXTRAS_SET_VERSION="0.0.8.3" HOST_MLIR_PYTHON_PACKAGE_PREFIX="aie" pip install -r requirements.txt
24+
echo "Prerequisites installed into ${{ inputs.env_name }}"

.github/actions/test/action.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# SPDX-FileCopyrightText: Copyright (C) 2025 Advanced Micro Devices, Inc. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
name: "Run test suite"
5+
6+
inputs:
7+
test_flags:
8+
required: false
9+
default: "--log tests.log --csv-latest tests_latest.csv"
10+
env_name:
11+
required: false
12+
default: "ci_env"
13+
build_dir:
14+
required: false
15+
default: "build"
16+
17+
runs:
18+
using: "composite"
19+
steps:
20+
- name: Test
21+
env:
22+
HOME: /workspace
23+
shell: "bash"
24+
run: |
25+
source ${{ inputs.env_name }}/bin/activate
26+
./scripts/run_tests.py ${{ inputs.test_flags }} ${{ inputs.build_dir }}

.github/workflows/extensive.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# SPDX-FileCopyrightText: Copyright (C) 2025 Advanced Micro Devices, Inc. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
name: Extensive Benchmark/Test Suite
5+
6+
on:
7+
workflow_dispatch:
8+
schedule:
9+
- cron: '0 9 * * *' # 2 AM MT
10+
push:
11+
branches:
12+
- main
13+
- devel
14+
15+
# VJUNG: Introduce concurrency groups named with branch refs.
16+
# VJUNG: If one pushes 5 times on its branch only the most recent commit will trigger CI.
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.ref }}
19+
cancel-in-progress: true
20+
21+
jobs:
22+
Test:
23+
runs-on: [self-hosted, docker]
24+
steps:
25+
- name: Pull
26+
uses: actions/checkout@v4
27+
env:
28+
HOME: /workspace
29+
30+
- name: Prerequisites
31+
uses: ./.github/actions/prereqs
32+
with:
33+
env_name: ci_env
34+
35+
- name: Build
36+
uses: ./.github/actions/build
37+
with:
38+
env_name: ci_env
39+
cmake_extra_flags: "-DEXTENSIVE_TESTING=ON"
40+
41+
- name: Test
42+
id: test
43+
continue-on-error: true
44+
uses: ./.github/actions/test
45+
with:
46+
env_name: ci_env
47+
48+
- name: Commit test results
49+
id: commit_results
50+
env:
51+
HOME: /workspace
52+
uses: ./.github/actions/commit_results
53+
with:
54+
dir: extensive
55+
56+
- name: Upload test results
57+
uses: actions/upload-artifact@v4
58+
with:
59+
name: results-extensive
60+
path: ${{ steps.commit_results.outputs.results_dir }}
61+
retention-days: 7
62+
63+
- name: Mark workflow as failed if tests failed
64+
if: steps.test.outcome == 'failure'
65+
run: exit 1

.github/workflows/small.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# SPDX-FileCopyrightText: Copyright (C) 2025 Advanced Micro Devices, Inc. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
name: Small Benchmark/Test Suite
5+
6+
on:
7+
pull_request:
8+
workflow_dispatch:
9+
push:
10+
branches:
11+
- main
12+
- devel
13+
14+
# VJUNG: Introduce concurrency groups named with branch refs.
15+
# VJUNG: If one pushes 5 times on its branch only the most recent commit will trigger CI.
16+
concurrency:
17+
group: ${{ github.workflow }}-${{ github.ref }}
18+
cancel-in-progress: true
19+
20+
jobs:
21+
Test:
22+
runs-on: [self-hosted, docker]
23+
steps:
24+
- name: Pull
25+
uses: actions/checkout@v4
26+
env:
27+
HOME: /workspace
28+
29+
- name: Prerequisites
30+
uses: ./.github/actions/prereqs
31+
with:
32+
env_name: ci_env
33+
34+
- name: Build
35+
uses: ./.github/actions/build
36+
with:
37+
env_name: ci_env
38+
39+
- name: Test
40+
id: test
41+
continue-on-error: true
42+
uses: ./.github/actions/test
43+
with:
44+
env_name: ci_env
45+
46+
- name: Commit test results
47+
id: commit_results
48+
env:
49+
HOME: /workspace
50+
uses: ./.github/actions/commit_results
51+
with:
52+
dir: small
53+
54+
- name: Upload test results
55+
uses: actions/upload-artifact@v4
56+
with:
57+
name: results-small
58+
path: ${{ steps.commit_results.outputs.results_dir }}
59+
retention-days: 7
60+
61+
- name: Mark workflow as failed if tests failed
62+
if: steps.test.outcome == 'failure'
63+
run: exit 1
64+

ci/docker-based/Dockerfile

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# SPDX-FileCopyrightText: Copyright (C) 2025 Advanced Micro Devices, Inc. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
# IRON dev container with GitHub Actions runner
5+
# To run with NPU device passthrough, use:
6+
# docker run -v /dev/accel/accel0:/dev/accel/accel0 --device-cgroup-rule 'c 261:* rmw' --ulimit memlock=-1:-1 <image>
7+
8+
# To build this docker, run from the repo root:
9+
# docker build -f ci/docker-based/Dockerfile -t iron-dev-github-runner
10+
11+
FROM ubuntu:24.04
12+
13+
ARG DEBIAN_FRONTEND=noninteractive
14+
15+
RUN apt-get update && apt-get install -y --no-install-recommends \
16+
# MLIR-AIE build requirements
17+
build-essential ninja-build python3 python3-dev python3.12-venv unzip \
18+
libssl-dev libboost-dev libboost-filesystem-dev libboost-program-options-dev uuid-dev \
19+
# Required by MHA kernel
20+
llvm-18 \
21+
# GitHub Actions runner requirements
22+
git jq curl tar \
23+
&& rm -rf /var/lib/apt/lists/*
24+
25+
ARG USER=iron
26+
RUN useradd -m -s /bin/bash ${USER}
27+
28+
USER ${USER}
29+
WORKDIR /workspace
30+
31+
COPY ./requirements.txt /workspace/requirements.txt
32+
33+
# Environment setup
34+
# ---
35+
36+
ENV HOME=/workspace
37+
38+
# Ensure XRT is mounted by the host
39+
# This errors if it does not exist.
40+
# copy entrypoint into image and make it executable (ensure file is in the build context)
41+
COPY --chown=${USER}:${USER} ./ci/docker-based/inside_docker /opt/inside_docker/
42+
RUN chmod +x /opt/inside_docker/entrypoint.sh /opt/inside_docker/actions_runner.sh
43+
ENTRYPOINT ["/opt/inside_docker/entrypoint.sh"]
44+
45+
CMD ["/opt/inside_docker/actions_runner.sh"]

ci/docker-based/build_docker.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
# SPDX-FileCopyrightText: Copyright (C) 2025 Advanced Micro Devices, Inc. All rights reserved.
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
IMAGE_NAME="iron-public-dev-github-runner"
7+
8+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
9+
cd "${SCRIPT_DIR}/../.."
10+
docker build -f ci/docker-based/Dockerfile -t ${IMAGE_NAME} .

0 commit comments

Comments
 (0)