Skip to content

Commit 3dd036b

Browse files
committed
Merge GitHub changes into master
2 parents f8f4bbf + 06a55b7 commit 3dd036b

File tree

5 files changed

+749
-0
lines changed

5 files changed

+749
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Commit Message Enforcement
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, edited, reopened]
6+
7+
jobs:
8+
check-commit-messages:
9+
runs-on: jira_check_runner
10+
steps:
11+
- name: Checkout PR commits
12+
uses: actions/checkout@v3
13+
with:
14+
fetch-depth: 0 # Ensure full history is available
15+
16+
- name: Check each commit message for Signed-off-by and Change-Id
17+
run: |
18+
set -e
19+
base_ref="${{ github.event.pull_request.base.sha }}"
20+
head_ref="${{ github.event.pull_request.head.sha }}"
21+
# Get all commits in the PR range (excluding merge base)
22+
commits=$(git rev-list ${base_ref}..${head_ref})
23+
fail=0
24+
for commit in $commits; do
25+
msg=$(git log -1 --pretty=%B $commit)
26+
if ! grep -qE '^Change-Id: I[a-f0-9]{40}' <<< "$msg"; then
27+
echo "::error::Commit $commit is missing a valid Change-Id line."
28+
echo "To fix: Use the following shell hook in your repo's .git/hooks/commit-msg:"
29+
echo
30+
echo "#!/bin/sh"
31+
echo "if ! grep -q '^Change-Id: I[a-f0-9]\\{40\\}' \"\$1\"; then"
32+
echo " CHANGE_ID=\$(uuidgen | sha1sum | awk '{print substr(\$1,1,40)}')"
33+
echo " echo \"Change-Id: I\$CHANGE_ID\" >> \"\$1\""
34+
echo "fi"
35+
fail=1
36+
fi
37+
if ! grep -qE '^Signed-off-by: ' <<< "$msg"; then
38+
echo "::error::Commit $commit is missing a Signed-off-by line."
39+
echo "To fix: Use 'git commit -s' to sign off your commit."
40+
echo "Or add this check to your repo's .git/hooks/commit-msg:"
41+
echo
42+
echo "#!/bin/sh"
43+
echo "if ! grep -q '^Signed-off-by: ' \"\$1\"; then"
44+
echo " echo \"ERROR: Commit message is missing a Signed-off-by line.\""
45+
echo " echo \"Please use 'git commit -s' to sign off your commit.\""
46+
echo " exit 1"
47+
echo "fi"
48+
fail=1
49+
fi
50+
done
51+
if [ $fail -ne 0 ]; then
52+
echo "ERROR: One or more commits in this PR are missing Signed-off-by or Change-Id."
53+
exit 1
54+
fi

.github/workflows/zentorch_pr.yml

Lines changed: 286 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,286 @@
1+
name: ZenDNN PYTORCH CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
workflow_dispatch:
9+
inputs:
10+
zendnn_ref:
11+
description: 'ZenDNN branch or PR ref (optional, e.g. refs/pull/123/head)'
12+
required: false
13+
default: ''
14+
zendnnTorch_ref:
15+
description: 'Zentorch branch or PR ref (optional, e.g. refs/pull/123/head)'
16+
required: false
17+
default: ''
18+
zentorch_use_local_zendnn:
19+
description: 'Set to 1 to use local ZenDNN'
20+
required: false
21+
default: '1'
22+
zentorch_use_local_blis:
23+
description: 'Set to 1 to use local BLIS'
24+
required: false
25+
default: '1'
26+
repository_dispatch:
27+
types: [zendnn-pr , zendnnTools-pr]
28+
29+
jobs:
30+
build:
31+
runs-on: [amd-zenai-arc-xlarge-dind]
32+
env:
33+
PYTHON_VERSION: '3.10'
34+
ZENTORCH_VERSION: '5.2.0'
35+
NATIVE_TORCH_VERSION: '2.8.0'
36+
UNWANTED_KEYWORDS: 'stackoverflow,MSDN,wiki,microsoft'
37+
# WORKSPACE and PARENT_DIR will be set dynamically in the steps
38+
ZENTORCH_USE_LOCAL_ZENDNN: ${{ github.event.inputs.zentorch_use_local_zendnn || github.event.client_payload.zentorch_use_local_zendnn || '1' }}
39+
ZENTORCH_USE_LOCAL_BLIS: ${{ github.event.inputs.zentorch_use_local_blis || github.event.client_payload.zentorch_use_local_blis || '1' }}
40+
BLIS_TAR_BALL: 'AOCL-Sep2025-b1.tar.gz'
41+
ZENDNN_REF: ${{ github.event.inputs.zendnn_ref || github.event.client_payload.zendnn_ref || '' }}
42+
ZENTORCH_REF: ${{ github.event.inputs.zendnnTorch_ref || github.event.client_payload.zendnnTorch_ref || '' }}
43+
steps:
44+
- name: Clean workspace before checkout
45+
run: |
46+
echo "Cleaning old workspace data..."
47+
ls -al $GITHUB_WORKSPACE || true
48+
rm -rf $GITHUB_WORKSPACE/* || true
49+
rm -rf $GITHUB_WORKSPACE/.[!.]* || true
50+
echo "Workspace cleaned."
51+
ls -al $GITHUB_WORKSPACE
52+
shell: bash
53+
- name: Checkout ZenDNN_PyTorch_Plugin
54+
uses: actions/checkout@v4
55+
with:
56+
fetch-depth: 0
57+
58+
- name: Set WORKSPACE and PARENT_DIR to parent of repo
59+
run: |
60+
echo "proj/zendai:"
61+
ls /proj/zendai
62+
echo "PARENT_DIR=$(dirname "${GITHUB_WORKSPACE}")" >> $GITHUB_ENV
63+
echo "WORKSPACE=$(dirname "${GITHUB_WORKSPACE}")" >> $GITHUB_ENV
64+
65+
- name: Clone ZenDNN if needed
66+
if: env.ZENTORCH_USE_LOCAL_ZENDNN == '1'
67+
run: |
68+
git clone --branch main https://${{ secrets.ZIAIE_PAT }}@github.com/AMD-Zenai/ZenDNN.git "$PARENT_DIR/ZenDNN"
69+
if [ "${ZENDNN_REF}" != "" ]; then
70+
cd "$PARENT_DIR/ZenDNN"
71+
git fetch origin "${ZENDNN_REF}"
72+
git checkout FETCH_HEAD
73+
cd "$PARENT_DIR"
74+
fi
75+
76+
- name: Copy and extract BLIS tarball if needed
77+
if: env.ZENTORCH_USE_LOCAL_BLIS == '1'
78+
run: |
79+
cp /proj/zendai/datasets/ci_zendnn_presub_dependencies/$BLIS_TAR_BALL "$PARENT_DIR"
80+
tar -xzf "$PARENT_DIR/$BLIS_TAR_BALL" -C "$PARENT_DIR"
81+
82+
- name: Clone ZenDNN_tools
83+
run: |
84+
git clone --branch main https://${{ secrets.ZIAIE_PAT }}@github.com/AMD-Zenai/ZenDNN_tools.git "$PARENT_DIR/ZenDNN_tools"
85+
- name: PR INFO
86+
shell: bash
87+
run: |
88+
echo "======================================"
89+
echo " ZENDTORCH & ZENDNN & ZENDNN_TOOLS INFO "
90+
echo "======================================"
91+
92+
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
93+
94+
if [ "${GITHUB_EVENT_NAME}" = "pull_request" ]; then
95+
BASE_BRANCH="${{ github.event.pull_request.base.ref }}"
96+
BASE_SHA="${{ github.event.pull_request.base.sha }}"
97+
SOURCE_BRANCH="${{ github.event.pull_request.head.ref }}"
98+
HEAD_SHA="${{ github.event.pull_request.head.sha }}"
99+
echo "=== PULL REQUEST INFO ==="
100+
elif [ "${GITHUB_EVENT_NAME}" = "push" ]; then
101+
BASE_BRANCH="main"
102+
BASE_SHA="$(git rev-parse origin/main)"
103+
SOURCE_BRANCH="${GITHUB_REF_NAME}"
104+
HEAD_SHA="$(git rev-parse HEAD)"
105+
echo "=== PUSH EVENT INFO ==="
106+
else
107+
BASE_BRANCH="main"
108+
BASE_SHA="$(git rev-parse origin/main || echo 'N/A')"
109+
SOURCE_BRANCH="${GITHUB_REF_NAME:-workflow_dispatch}"
110+
HEAD_SHA="$(git rev-parse HEAD)"
111+
echo "=== WORKFLOW DISPATCH INFO ==="
112+
fi
113+
114+
echo "PR BASE BRANCH : $BASE_BRANCH"
115+
echo "PR BASE SHA : $BASE_SHA"
116+
echo "PR SOURCE BRANCH : $SOURCE_BRANCH"
117+
echo "PR HEAD SHA : $HEAD_SHA"
118+
echo ""
119+
120+
echo "Fetching branches..."
121+
git fetch --no-tags origin +refs/heads/$BASE_BRANCH:refs/remotes/origin/$BASE_BRANCH || true
122+
git fetch --no-tags origin +refs/heads/$SOURCE_BRANCH:refs/remotes/origin/$SOURCE_BRANCH || true
123+
echo ""
124+
125+
echo "COMMITS BETWEEN BASE AND HEAD"
126+
git log --oneline -20 || echo "No commits found"
127+
echo ""
128+
echo "=============================="
129+
echo " ZENDNN INFO"
130+
echo "=============================="
131+
if [ -d "$PARENT_DIR/ZenDNN" ]; then
132+
cd "$PARENT_DIR/ZenDNN"
133+
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/AMD-Zenai/ZenDNN.git
134+
git fetch --all --no-tags || true
135+
136+
BRANCH=${GITHUB_REF_NAME:-main}
137+
HEAD_SHA=$(git rev-parse HEAD)
138+
BASE_BRANCH="main"
139+
BASE_SHA=$(git rev-parse origin/main || echo "N/A")
140+
141+
echo "CURRENT BRANCH : $BRANCH"
142+
echo "HEAD SHA : $HEAD_SHA"
143+
echo "BASE BRANCH : $BASE_BRANCH"
144+
echo "BASE SHA : $BASE_SHA"
145+
echo ""
146+
147+
echo "LAST 20 COMMITS (ZenDNN)"
148+
git log --oneline -20 || echo "No commits found"
149+
else
150+
echo "ZenDNN directory not found — skipping."
151+
fi
152+
153+
echo "=============================="
154+
echo " ZENDNN_TOOLS INFO"
155+
echo "=============================="
156+
if [ -d "$PARENT_DIR/ZenDNN_tools" ]; then
157+
cd "$PARENT_DIR/ZenDNN_tools"
158+
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/AMD-Zenai/ZenDNN_tools.git
159+
git fetch --all --no-tags || true
160+
161+
BRANCH=${GITHUB_REF_NAME:-main}
162+
HEAD_SHA=$(git rev-parse HEAD)
163+
BASE_BRANCH="main"
164+
BASE_SHA=$(git rev-parse origin/main || echo "N/A")
165+
166+
echo "CURRENT BRANCH : $BRANCH"
167+
echo "HEAD SHA : $HEAD_SHA"
168+
echo "BASE BRANCH : $BASE_BRANCH"
169+
echo "BASE SHA : $BASE_SHA"
170+
echo ""
171+
172+
echo "LAST 20 COMMITS (ZenDNN_tools)"
173+
git log --oneline -20 || echo "No commits found"
174+
else
175+
echo "ZenDNN_tools directory not found — skipping."
176+
fi
177+
178+
- name: Run CI script
179+
run: |
180+
#sed -i 's/sudo//g' "$PARENT_DIR/ZenDNN_tools/scripts/ci/zendnn_ci_pt_plugin_presub_build.sh"
181+
#sed -i '/mkmhub/ s/mkmhub/-v \/proj\/zendai:\/proj\/zendai -v \/home\/runner:\/home\/runner mkmhub/' "$PARENT_DIR/ZenDNN_tools/scripts/ci/zendnn_ci_pt_plugin_presub_build.sh"
182+
#sed -i '/git config --global --add/ s/^/# /' "$PARENT_DIR/ZenDNN_tools/scripts/ci/zendnn_ci_pt_plugin_presub_build.sh"
183+
#sed -i 's|torch-\$NATIVE_TORCH_VERSION|torch-\$NATIVE_TORCH_VERSION-xco|g' "$PARENT_DIR/ZenDNN_tools/scripts/ci/zendnn_ci_pt_plugin_presub_build.sh"
184+
#sed -i 's/^\(conda init bash\|conda config --set auto_activate_base false\|source ~\/.bashrc\)/# \1/' "$PARENT_DIR/ZenDNN_tools/scripts/ci/zendnn_ci_PT_PLUGIN_build.sh"
185+
#sed -i 's|/root/anaconda3/|/proj/zendai_conda/miniforge3/|g' "$PARENT_DIR/ZenDNN_tools/scripts/ci/zendnn_ci_PT_PLUGIN_build.sh"
186+
export PYTHON_VERSION=${{ env.PYTHON_VERSION }}
187+
export BUILD_PYTHON_VERSIONS=${{ env.PYTHON_VERSION }}
188+
export ZENTORCH_VERSION=${{ env.ZENTORCH_VERSION }}
189+
export WORKSPACE=${{ env.WORKSPACE }}
190+
export ZENTORCH_USE_LOCAL_ZENDNN=${{ env.ZENTORCH_USE_LOCAL_ZENDNN }}
191+
export ZENTORCH_USE_LOCAL_BLIS=${{ env.ZENTORCH_USE_LOCAL_BLIS }}
192+
export NATIVE_TORCH_VERSION=${{ env.NATIVE_TORCH_VERSION }}
193+
export UNWANTED_KEYWORDS=${{ env.UNWANTED_KEYWORDS }}
194+
export BLIS_TAR_BALL=${{ env.BLIS_TAR_BALL }}
195+
export PARENT_DIR=${PARENT_DIR}
196+
#git config --global --add safe.directory ${WORKSPACE}/ZenDNN_PyTorch_Plugin
197+
#git config --global --add safe.directory ${WORKSPACE}/ZenDNN
198+
#git config --global --add safe.directory ${WORKSPACE}/blis
199+
echo "========= FILE: zendnn_ci_pt_plugin_presub_build.sh ========="
200+
cat "$PARENT_DIR/ZenDNN_tools/scripts/ci/zendnn_ci_pt_plugin_presub_build.sh"
201+
echo "============================================================="
202+
203+
echo "========= FILE: zendnn_ci_PT_PLUGIN_build.sh ========="
204+
cat "$PARENT_DIR/ZenDNN_tools/scripts/ci/zendnn_ci_PT_PLUGIN_build.sh"
205+
echo "======================================================"
206+
bash "$PARENT_DIR/ZenDNN_tools/scripts/ci/zendnn_ci_pt_plugin_presub_build.sh"
207+
shell: bash
208+
209+
- name: Fail if script failed
210+
if: failure()
211+
run: exit 1
212+
213+
- name: Cleanup workspace (delete everything from parent dir)
214+
if: always()
215+
run: |
216+
echo "Cleaning up $PARENT_DIR"
217+
rm -rf "$PARENT_DIR/ZenDNN" "$PARENT_DIR/ZenDNN_tools" "$PARENT_DIR/$BLIS_TAR_BALL" "$PARENT_DIR/ZenDNNL"
218+
# Optionally, also remove ZenDNN_PyTorch_Plugin if you want to delete the repo itself
219+
rm -rf "$PARENT_DIR/ZenDNN_PyTorch_Plugin/*"
220+
rm -rf "$PARENT_DIR/*.txt"
221+
rm -rf "$PARENT_DIR/blis" "$PARENT_DIR/$BLIS_TAR_BALL"
222+
ls $PARENT_DIR
223+
- name: Report status back to ZenDNN repo
224+
if: always()
225+
run: |
226+
state="success"
227+
if [ "${{ job.status }}" != "success" ]; then
228+
state="failure"
229+
fi
230+
curl -s -X POST \
231+
-H "Accept: application/vnd.github.v3+json" \
232+
-H "Authorization: token ${{ secrets.ZIAIE_PAT }}" \
233+
"https://api.github.com/repos/AMD-Zenai/ZenDNN/statuses/${{ github.event.client_payload.zendnn_ref_sha }}" \
234+
-d "{\"state\":\"${state}\",\"context\":\"${{ github.repository }} CI\",\"description\":\"${{ github.repository }} ${state}\"}"
235+
- name: Report status back to ZenDNNTOOLS repo
236+
if: always()
237+
run: |
238+
state="success"
239+
if [ "${{ job.status }}" != "success" ]; then
240+
state="failure"
241+
fi
242+
curl -s -X POST \
243+
-H "Accept: application/vnd.github.v3+json" \
244+
-H "Authorization: token ${{ secrets.ZIAIE_PAT }}" \
245+
"https://api.github.com/repos/AMD-Zenai/ZenDNN_tools/statuses/${{ github.event.client_payload.zendnntools_ref_sha }}" \
246+
-d "{\"state\":\"${state}\",\"context\":\"${{ github.repository }} CI\",\"description\":\"${{ github.repository }} ${state}\"}"
247+
- name: Report status back for workflow_dispatch commits
248+
if: always() && github.event_name == 'workflow_dispatch'
249+
run: |
250+
state="success"
251+
if [ "${{ job.status }}" != "success" ]; then
252+
state="failure"
253+
fi
254+
255+
echo "Final job state: $state"
256+
echo "ZenDNN_REF: ${{ github.event.inputs.zendnn_ref }}"
257+
echo "ZENTORCH_REF: ${{ github.event.inputs.zendnnTorch_ref }}"
258+
259+
# Report to ZenDNN repo if zendnn_ref commit SHA was provided
260+
if [ -n "${{ github.event.inputs.zendnn_ref }}" ]; then
261+
echo "Reporting $state to ZenDNN commit ${{ github.event.inputs.zendnn_ref }}"
262+
curl -s -X POST \
263+
-H "Accept: application/vnd.github.v3+json" \
264+
-H "Authorization: token ${{ secrets.ZIAIE_PAT }}" \
265+
"https://api.github.com/repos/AMD-Zenai/ZenDNN/statuses/${{ github.event.inputs.zendnn_ref }}" \
266+
-d "{\"state\":\"${state}\",\"context\":\"ZenDNN_PyTorch_Plugin CI\",\"description\":\"ZenDNN_PyTorch_Plugin run ${state}\"}"
267+
else
268+
echo "Skipping ZenDNN status update (no commit SHA provided)"
269+
fi
270+
271+
# Report to ZenDNN_PyTorch_Plugin repo if zendnnTorch_ref commit SHA was provided
272+
if [ -n "${{ github.event.inputs.zendnnTorch_ref }}" ]; then
273+
echo "Reporting $state to ZenDNN_PyTorch_Plugin commit ${{ github.event.inputs.zendnnTorch_ref }}"
274+
curl -s -X POST \
275+
-H "Accept: application/vnd.github.v3+json" \
276+
-H "Authorization: token ${{ secrets.ZIAIE_PAT }}" \
277+
"https://api.github.com/repos/AMD-Zenai/ZenDNN_PyTorch_Plugin/statuses/${{ github.event.inputs.zendnnTorch_ref }}" \
278+
-d "{\"state\":\"${state}\",\"context\":\"ZenDNN_PyTorch_Plugin CI\",\"description\":\"ZenDNN_PyTorch_Plugin run ${state}\"}"
279+
else
280+
echo "Skipping ZenDNN_PyTorch_Plugin status update (no commit SHA provided)"
281+
fi
282+
283+
284+
285+
286+

0 commit comments

Comments
 (0)