-
Notifications
You must be signed in to change notification settings - Fork 57
217 lines (198 loc) · 8.67 KB
/
microspeech.yaml
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
# SPDX-FileCopyrightText: Copyright 2022 Arm Limited and/or its affiliates <[email protected]>
#
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the License); you may
# not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an AS IS BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: TFL Microspeech Example on Arm Virtual Hardware
on:
push:
branches:
- microspeech
workflow_run:
workflows: ["Build documentation and pack"]
types:
- completed
workflow_dispatch:
env:
AWS_ASSUME_ROLE: ${{ secrets.AWS_ASSUME_ROLE }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
AWS_S3_BUCKET_NAME: ${{ secrets.AWS_S3_BUCKET_NAME }}
AWS_IAM_PROFILE: ${{ secrets.AWS_IAM_PROFILE }}
AWS_SECURITY_GROUP_ID: ${{ secrets.AWS_SECURITY_GROUP_ID }}
AWS_SUBNET_ID: ${{ secrets.AWS_SUBNET_ID }}
jobs:
set_pending_status_to_pr:
runs-on: ubuntu-latest
steps:
- name: Set a pending status to the PR
if: github.event.workflow_run
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
curl --request POST \
--url https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.event.workflow_run.head_commit.id }} \
--header "authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
--header 'content-type: application/json' \
--data '{
"state": "pending",
"context": "Microspeech",
"target_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}' \
--fail
build_and_run:
name: Build and run projects on AVH
runs-on: ubuntu-latest
needs: set_pending_status_to_pr
permissions:
id-token: write
contents: read
issues: read
checks: write
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
repository: ARM-software/AVH-TFLmicrospeech
ref: main
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install AVH Client for Python
run: |
pip install arm-avhclient
- name: Download pack from upstream workflow
if: github.event.workflow_run
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: |
mkdir -p artifacts && cd artifacts
artifacts_url=${{ github.event.workflow_run.artifacts_url }}
gh api "$artifacts_url" -q '.artifacts[] | select(.name=="artifact") | [.name, .archive_download_url] | @tsv' | \
while read artifact; do
IFS=$'\t' read name url <<< "$artifact"
gh api $url > "$name.zip"
unzip -d "$name" "$name.zip"
done
cp artifact/ARM.CMSIS-NN.*.pack ../Platform_FVP_Corstone_SSE-300_Ethos-U55/
- name: Download latest release pack
if: ${{ ! github.event.workflow_run }}
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: |
gh -R ${{ github.repository }} release download -p "*.pack" -D Platform_FVP_Corstone_SSE-300_Ethos-U55
- name: Configure AWS Credentials
uses: aws-actions/[email protected]
with:
role-to-assume: ${{ env.AWS_ASSUME_ROLE }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: Apply patch
run: |
VERSION=$(\
basename $(ls Platform_FVP_Corstone_SSE-300_Ethos-U55/ARM.CMSIS-NN.*.pack) | \
cut -d. -f 3-5 | cut -d+ -f 1 \
)
patch -p0 <<EOF
--- Platform_FVP_Corstone_SSE-300_Ethos-U55/microspeech.Example.Reference.cprj
+++ Platform_FVP_Corstone_SSE-300_Ethos-U55/microspeech.Example.Reference.cprj
@@ -11,2 +11,3 @@
<packages>
+ <package name="CMSIS-NN" vendor="ARM" version="${VERSION}:${VERSION}"/>
<package name="CMSIS" vendor="ARM" version="5.9.0:5.9.0"/>
@@ -130,3 +131,2 @@
<file category="sourceCpp" name="../micro_speech/src/recognize_commands.cc"/>
- <file category="sourceC" name="../micro_speech/src/arm_nn_softmax_common_s8.c"/>
</group>
--- Platform_FVP_Corstone_SSE-300_Ethos-U55/microspeech.Example.SIMD.cprj
+++ Platform_FVP_Corstone_SSE-300_Ethos-U55/microspeech.Example.SIMD.cprj
@@ -11,2 +11,3 @@
<packages>
+ <package name="CMSIS-NN" vendor="ARM" version="${VERSION}:${VERSION}"/>
<package name="CMSIS" vendor="ARM" version="5.9.0:5.9.0"/>
@@ -130,3 +131,2 @@
<file category="sourceCpp" name="../micro_speech/src/recognize_commands.cc"/>
- <file category="sourceC" name="../micro_speech/src/arm_nn_softmax_common_s8.c"/>
</group>
--- Platform_FVP_Corstone_SSE-300_Ethos-U55/microspeech.Example.Helium.cprj
+++ Platform_FVP_Corstone_SSE-300_Ethos-U55/microspeech.Example.Helium.cprj
@@ -11,2 +11,3 @@
<packages>
+ <package name="CMSIS-NN" vendor="ARM" version="${VERSION}:${VERSION}"/>
<package name="CMSIS" vendor="ARM" version="5.9.0:5.9.0"/>
@@ -130,3 +131,2 @@
<file category="sourceCpp" name="../micro_speech/src/recognize_commands.cc"/>
- <file category="sourceC" name="../micro_speech/src/arm_nn_softmax_common_s8.c"/>
</group>
--- avh.yml Tue Nov 22 12:01:56 2022
+++ avh.yml Tue Nov 22 12:02:08 2022
@@ -12,2 +12,5 @@
steps:
+ - run: |
+ cd Platform_FVP_Corstone_SSE-300_Ethos-U55
+ cpackget add ARM.CMSIS-NN.*.pack
- run: |
EOF
- name: Execute test suite on Arm Virtual Hardware at AWS
run: |
avhclient -b aws execute --specfile ./avh.yml
- name: Fetch results from Arm Virtual Hardware
run: |
cat ./Platform_FVP_Corstone_SSE-300_Ethos-U55/microspeech.Reference.log
cat ./Platform_FVP_Corstone_SSE-300_Ethos-U55/microspeech.SIMD.log
cat ./Platform_FVP_Corstone_SSE-300_Ethos-U55/microspeech.Helium.log
- name: Decode EventRecorder logs
run: |
wget https://github.com/ARM-software/CMSIS-View/releases/download/tools%2Feventlist%2F1.0.10/eventlist-linux64.tar.gz
tar -xvf eventlist-linux64.tar.gz
chmod +x eventlist-linux64/eventlist
eventlist-linux64/eventlist -s ./Platform_FVP_Corstone_SSE-300_Ethos-U55/microspeech.Reference.EventRecorder.log
eventlist-linux64/eventlist -s ./Platform_FVP_Corstone_SSE-300_Ethos-U55/microspeech.SIMD.EventRecorder.log
eventlist-linux64/eventlist -s ./Platform_FVP_Corstone_SSE-300_Ethos-U55/microspeech.Helium.EventRecorder.log
set_success_status_to_pr:
runs-on: ubuntu-latest
needs: build_and_run
if: github.event.workflow_run && success()
steps:
- name: Set success status to the PR
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: |
curl --request POST \
--url https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.event.workflow_run.head_commit.id }} \
--header "authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
--header 'content-type: application/json' \
--data '{
"state": "success",
"context": "Microspeech",
"target_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}' \
--fail
set_failure_status_to_pr:
runs-on: ubuntu-latest
needs: build_and_run
if: github.event.workflow_run && failure()
steps:
- name: Set failure status to the PR
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: |
curl --request POST \
--url https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.event.workflow_run.head_commit.id }} \
--header "authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
--header 'content-type: application/json' \
--data '{
"state": "failure",
"context": "Microspeech",
"target_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}' \
--fail