forked from ROCm/migraphx-benchmark
-
Notifications
You must be signed in to change notification settings - Fork 0
224 lines (204 loc) · 9.68 KB
/
rocMLIR_sync.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
name: rocMLIR sync with extended accuracy
#UPDATE SECRET TOKEN
#UPDATE PR REVIEWER/ASSIGNEE
on:
workflow_call:
inputs:
rocm_release:
type: string
description: ROCm release version
required: true
base_image:
type: string
description: Base image for rocm Docker build
required: true
docker_image:
type: string
description: Docker image name for rocm Docker build
required: true
build_navi:
type: string
description: Build navi number
required: true
benchmark_utils_repo:
type: string
description: Repository where benchmark utils are stored
required: true
performance_reports_repo:
type: string
description: Repository where performance reports are stored
required: true
organization:
type: string
description: Organization based on which location of files will be different
required: true
secrets:
gh_token:
description: 'Github Access Token'
required: true
env:
REPORTS_DIR: migraphx-reports
TEST_RESULTS_PATH: /usr/share/migraphx/${{ inputs.organization }}/test-results
jobs:
sync_rocMLIR:
name: Sync rocMLIR and run extended accuracy
runs-on: self-hosted
steps:
- name: Get date
if: ${{ github.event_name != 'pull_request' }}
run: echo todays_date="$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- name: Extract SHA1
if: ${{ github.event_name != 'pull_request' }}
run: echo rocmlirsha="$(git ls-remote https://github.com/ROCm/rocMLIR.git develop | awk '{print $1}')" >> $GITHUB_ENV
- name: Checkout code
if: ${{ github.event_name != 'pull_request' }}
uses: actions/[email protected]
- name: Check for changes
if: ${{ github.event_name != 'pull_request' }}
run: |
rocMLIR=$(grep ROCm/rocMLIR requirements.txt | grep -oP '(?<=@)[a-f0-9]{40}')
if [ "${rocMLIR}" == ${{ env.rocmlirsha }} ]; then
echo "skip=true" >> $GITHUB_ENV
else
echo "skip=false" >> $GITHUB_ENV
fi
- name: Update file
if: ${{ github.event_name != 'pull_request' && env.skip != 'true' }}
run: |
sed -i "s/ROCm\/rocMLIR@[^ ]*/ROCm\/rocMLIR@${{ env.rocmlirsha }}/g" requirements.txt
- name: Create branch and PR
if: ${{ github.event_name != 'pull_request' && env.skip != 'true' }}
uses: peter-evans/[email protected]
with:
#token: ${{ secrets.GITHUB_TOKEN }}
token: ${{ secrets.gh_token }}
commit-message: Update rocMLIR main ${{ env.rocmlirsha }}
committer: Github <[email protected]>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
signoff: false
branch: rocMLIR-sync-${{ env.todays_date }}
delete-branch: true
title: 'rocMLIR Weekly Sync ${{ env.todays_date }}'
body: |
Update rocMLIR version
- Updated with changes from ${{ env.todays_date }}
- Auto-generated by [create-pull-request][1]
- Update requirements.txt to rocMLIR@${{ env.rocmlirsha }}
[1]: https://github.com/peter-evans/create-pull-request
labels: |
rocMLIR
dependencies
automated
skip bot checks
assignees: |
IgorMirosavljevicHTEC
draft: false
base: develop
- name: Checkout new branch
if: ${{ github.event_name != 'pull_request' && env.skip != 'true' }}
uses: actions/[email protected]
with:
ref: rocMLIR-sync-${{ env.todays_date }}
- name: Calculate HASH
id: hash
run: |
cd $GITHUB_WORKSPACE
rocm_hash=$(echo ${{hashFiles('**/Dockerfile', '**/hip-clang.docker', '**/*requirements.txt', '**/requirements-py.txt', '**/install_prereqs.sh', '**/rbuild.ini')}} | cut -c 1-6)
echo "HASH=$rocm_hash" >> $GITHUB_ENV
echo $rocm_hash
- name: Checkout utils
if: ${{ github.event_name != 'pull_request' && env.skip != 'true' }}
uses: actions/[email protected]
with:
repository: ${{ inputs.benchmark_utils_repo }}
path: migraphx-benchmark-utils
token: ${{ secrets.gh_token }}
ref: main
- name: Rebuild base image
if: ${{ github.event_name != 'pull_request' && env.skip != 'true' }}
env:
ROCM_RELEASE: ${{ inputs.rocm_release }}
ROCM_BASE: ${{ inputs.base_image }}:${{ inputs.rocm_release }}
#DOCKERIMAGE: ${{ inputs.docker_image }}:${{ inputs.rocm_release }}-temp
DOCKERIMAGE: ${{ inputs.docker_image }}:${{ inputs.rocm_release }}-${{ env.HASH }}
BUILD_NAVI: ${{ inputs.build_navi }}
TOKEN: ${{ secrets.gh_token }}
run: |
cd $GITHUB_WORKSPACE/migraphx-benchmark-utils/scripts
./build_migraphx_docker.sh ${{ inputs.benchmark_utils_repo }} $GITHUB_REPOSITORY rocMLIR-sync-${{ env.todays_date }}
- name: Build temp docker
if: ${{ github.event_name != 'pull_request' && env.skip != 'true' }}
run: >
cd $GITHUB_WORKSPACE && git fetch &&
git checkout rocMLIR-sync-${{ env.todays_date }} &&
cd $GITHUB_WORKSPACE/migraphx-benchmark-utils &&
docker build --no-cache
--build-arg BRANCH=rocMLIR-sync-${{ env.todays_date }}
--build-arg DOCKERBASE=rocm-migraphx:${{ inputs.rocm_release }}-${{ env.HASH }}
--build-arg MIOPENTUNE=miopen-dbs/rocm${{ inputs.rocm_release }}
--build-arg benchmark_utils_repo=${{ inputs.benchmark_utils_repo }}
-t "migraphx-rocm:${{ inputs.rocm_release }}-rocMLIR"
-f dockerfiles/Daily.Dockerfile .
- name: Run extended accuracy test
if: ${{ github.event_name != 'pull_request' && env.skip != 'true' }}
run: >
docker run
-e TZ=America/Chicago
-e TARGET=gpu
-e PYTHONPATH=/src/AMDMIGraphX/build/lib
-e USE_RBUILD=1
--device=/dev/dri
--device=/dev/kfd
--network=host
--group-add=video
-v /usr/share/migraphx/saved-models:/saved-models:ro
-v /usr/share/migraphx/new-saved-models:/new-saved-models:ro
-v $GITHUB_WORKSPACE/migraphx-benchmark-utils/scripts:/migraphx/sh:ro
-v /usr/share/migraphx/AMD/test-results:/data/test-results
--workdir /migraphx/sh
migraphx-rocm:${{ inputs.rocm_release }}-rocMLIR /bin/bash -c "./build_migraphx.sh && ./accuracy_test-extended.sh"
- name: Get accuracy result
if: ${{ github.event_name != 'pull_request' && env.skip != 'true' }}
run: |
cd ${{ env.TEST_RESULTS_PATH }}
echo last_extended="$(ls -td extended_accuracy* | head -1)" >> $GITHUB_ENV
echo comment_file="$(ls -td extended_accuracy* | head -1)/results.md" >> $GITHUB_ENV
- name: Checkout reports
if: ${{ github.event_name != 'pull_request' && env.skip != 'true' }}
uses: actions/[email protected]
with:
repository: ${{ inputs.performance_reports_repo }}
path: ${{ env.REPORTS_DIR }}
token: ${{ secrets.gh_token }}
- name: Push accuracy to repo
if: ${{ github.event_name != 'pull_request' && env.skip != 'true' }}
run: |
cd ${{ env.TEST_RESULTS_PATH }}
mkdir -p $GITHUB_WORKSPACE/${{ env.REPORTS_DIR }}/extended_accuracy_reports/${{ env.todays_date }}
cp -r ${{ env.last_extended }}/. $GITHUB_WORKSPACE/${{ env.REPORTS_DIR }}/extended_accuracy_reports/${{ env.todays_date }}
cd $GITHUB_WORKSPACE/${{ env.REPORTS_DIR }}
git add .
git config --local user.email [email protected]
git config --local user.name github-actions
git commit -m "Extended accuracy results run https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" -a
git push
- name: Accuracy comment on PR
if: ${{ github.event_name != 'pull_request' && env.skip != 'true' }}
uses: thollander/[email protected]
with:
filePath: ${{ env.TEST_RESULTS_PATH }}/${{ env.comment_file }}
#GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.gh_token }}
pr_number: ${{ env.PULL_REQUEST_NUMBER }}
# - name: Replace base docker after merge
# if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'rocMLIR-sync-')
# run: |
# if [[ $(docker images --filter=reference="${{ inputs.docker_image }}:${{ inputs.rocm_release }}-old" | awk 'NR>1 {print $3}') ]]; then
# docker rmi -f $(docker images --filter=reference="${{ inputs.docker_image }}:${{ inputs.rocm_release }}-old" | awk 'NR>1 {print $3}')
# echo "Removed ${{ inputs.docker_image }}:${{ inputs.rocm_release }}-old image"
# fi
# docker tag ${{ inputs.docker_image }}:${{ inputs.rocm_release }} ${{ inputs.docker_image }}:${{ inputs.rocm_release }}-old
# echo "Current image ${{ inputs.docker_image }}:${{ inputs.rocm_release }} renamed to ${{ inputs.docker_image }}:${{ inputs.rocm_release }}-old"
# docker tag ${{ inputs.docker_image }}:${{ inputs.rocm_release }}-temp ${{ inputs.docker_image }}:${{ inputs.rocm_release }}
# echo "Temp image ${{ inputs.docker_image }}:${{ inputs.rocm_release }}-temp renamed to ${{ inputs.docker_image }}:${{ inputs.rocm_release }}"
# docker rmi ${{ inputs.docker_image }}:${{ inputs.rocm_release }}-temp