microspeech.yaml 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. # SPDX-FileCopyrightText: Copyright 2022 Arm Limited and/or its affiliates <open-source-office@arm.com>
  2. #
  3. # SPDX-License-Identifier: Apache-2.0
  4. #
  5. # Licensed under the Apache License, Version 2.0 (the License); you may
  6. # not use this file except in compliance with the License.
  7. # You may obtain a copy of the License at
  8. #
  9. # www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an AS IS BASIS, WITHOUT
  13. # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. name: TFL Microspeech Example on Arm Virtual Hardware
  17. on:
  18. push:
  19. branches:
  20. - microspeech
  21. workflow_run:
  22. workflows: ["Build documentation and pack"]
  23. types:
  24. - completed
  25. workflow_dispatch:
  26. env:
  27. AWS_ASSUME_ROLE: ${{ secrets.AWS_ASSUME_ROLE }}
  28. AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
  29. AWS_S3_BUCKET_NAME: ${{ secrets.AWS_S3_BUCKET_NAME }}
  30. AWS_IAM_PROFILE: ${{ secrets.AWS_IAM_PROFILE }}
  31. AWS_SECURITY_GROUP_ID: ${{ secrets.AWS_SECURITY_GROUP_ID }}
  32. AWS_SUBNET_ID: ${{ secrets.AWS_SUBNET_ID }}
  33. jobs:
  34. set_pending_status_to_pr:
  35. runs-on: ubuntu-latest
  36. steps:
  37. - name: Set a pending status to the PR
  38. if: github.event.workflow_run
  39. env:
  40. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  41. run: |
  42. curl --request POST \
  43. --url https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.event.workflow_run.head_commit.id }} \
  44. --header "authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
  45. --header 'content-type: application/json' \
  46. --data '{
  47. "state": "pending",
  48. "context": "Microspeech",
  49. "target_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
  50. }' \
  51. --fail
  52. build_and_run:
  53. name: Build and run projects on AVH
  54. runs-on: ubuntu-latest
  55. needs: set_pending_status_to_pr
  56. permissions:
  57. id-token: write
  58. contents: read
  59. issues: read
  60. checks: write
  61. pull-requests: write
  62. steps:
  63. - uses: actions/checkout@v4
  64. with:
  65. repository: ARM-software/AVH-TFLmicrospeech
  66. ref: main
  67. - name: Set up Python 3.10
  68. uses: actions/setup-python@v5
  69. with:
  70. python-version: '3.10'
  71. - name: Install AVH Client for Python
  72. run: |
  73. pip install arm-avhclient
  74. - name: Download pack from upstream workflow
  75. if: github.event.workflow_run
  76. env:
  77. GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
  78. run: |
  79. mkdir -p artifacts && cd artifacts
  80. artifacts_url=${{ github.event.workflow_run.artifacts_url }}
  81. gh api "$artifacts_url" -q '.artifacts[] | select(.name=="artifact") | [.name, .archive_download_url] | @tsv' | \
  82. while read artifact; do
  83. IFS=$'\t' read name url <<< "$artifact"
  84. gh api $url > "$name.zip"
  85. unzip -d "$name" "$name.zip"
  86. done
  87. cp artifact/ARM.CMSIS-NN.*.pack ../Platform_FVP_Corstone_SSE-300_Ethos-U55/
  88. - name: Download latest release pack
  89. if: ${{ ! github.event.workflow_run }}
  90. env:
  91. GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
  92. run: |
  93. gh -R ${{ github.repository }} release download -p "*.pack" -D Platform_FVP_Corstone_SSE-300_Ethos-U55
  94. - name: Configure AWS Credentials
  95. uses: aws-actions/configure-aws-credentials@v4.0.2
  96. with:
  97. role-to-assume: ${{ env.AWS_ASSUME_ROLE }}
  98. aws-region: ${{ env.AWS_DEFAULT_REGION }}
  99. - name: Apply patch
  100. run: |
  101. VERSION=$(\
  102. basename $(ls Platform_FVP_Corstone_SSE-300_Ethos-U55/ARM.CMSIS-NN.*.pack) | \
  103. cut -d. -f 3-5 | cut -d+ -f 1 \
  104. )
  105. patch -p0 <<EOF
  106. --- Platform_FVP_Corstone_SSE-300_Ethos-U55/microspeech.Example.Reference.cprj
  107. +++ Platform_FVP_Corstone_SSE-300_Ethos-U55/microspeech.Example.Reference.cprj
  108. @@ -11,2 +11,3 @@
  109. <packages>
  110. + <package name="CMSIS-NN" vendor="ARM" version="${VERSION}:${VERSION}"/>
  111. <package name="CMSIS" vendor="ARM" version="5.9.0:5.9.0"/>
  112. @@ -130,3 +131,2 @@
  113. <file category="sourceCpp" name="../micro_speech/src/recognize_commands.cc"/>
  114. - <file category="sourceC" name="../micro_speech/src/arm_nn_softmax_common_s8.c"/>
  115. </group>
  116. --- Platform_FVP_Corstone_SSE-300_Ethos-U55/microspeech.Example.SIMD.cprj
  117. +++ Platform_FVP_Corstone_SSE-300_Ethos-U55/microspeech.Example.SIMD.cprj
  118. @@ -11,2 +11,3 @@
  119. <packages>
  120. + <package name="CMSIS-NN" vendor="ARM" version="${VERSION}:${VERSION}"/>
  121. <package name="CMSIS" vendor="ARM" version="5.9.0:5.9.0"/>
  122. @@ -130,3 +131,2 @@
  123. <file category="sourceCpp" name="../micro_speech/src/recognize_commands.cc"/>
  124. - <file category="sourceC" name="../micro_speech/src/arm_nn_softmax_common_s8.c"/>
  125. </group>
  126. --- Platform_FVP_Corstone_SSE-300_Ethos-U55/microspeech.Example.Helium.cprj
  127. +++ Platform_FVP_Corstone_SSE-300_Ethos-U55/microspeech.Example.Helium.cprj
  128. @@ -11,2 +11,3 @@
  129. <packages>
  130. + <package name="CMSIS-NN" vendor="ARM" version="${VERSION}:${VERSION}"/>
  131. <package name="CMSIS" vendor="ARM" version="5.9.0:5.9.0"/>
  132. @@ -130,3 +131,2 @@
  133. <file category="sourceCpp" name="../micro_speech/src/recognize_commands.cc"/>
  134. - <file category="sourceC" name="../micro_speech/src/arm_nn_softmax_common_s8.c"/>
  135. </group>
  136. --- avh.yml Tue Nov 22 12:01:56 2022
  137. +++ avh.yml Tue Nov 22 12:02:08 2022
  138. @@ -12,2 +12,5 @@
  139. steps:
  140. + - run: |
  141. + cd Platform_FVP_Corstone_SSE-300_Ethos-U55
  142. + cpackget add ARM.CMSIS-NN.*.pack
  143. - run: |
  144. EOF
  145. - name: Execute test suite on Arm Virtual Hardware at AWS
  146. run: |
  147. avhclient -b aws execute --specfile ./avh.yml
  148. - name: Fetch results from Arm Virtual Hardware
  149. run: |
  150. cat ./Platform_FVP_Corstone_SSE-300_Ethos-U55/microspeech.Reference.log
  151. cat ./Platform_FVP_Corstone_SSE-300_Ethos-U55/microspeech.SIMD.log
  152. cat ./Platform_FVP_Corstone_SSE-300_Ethos-U55/microspeech.Helium.log
  153. - name: Decode EventRecorder logs
  154. run: |
  155. wget https://github.com/ARM-software/CMSIS-View/releases/download/tools%2Feventlist%2F1.0.10/eventlist-linux64.tar.gz
  156. tar -xvf eventlist-linux64.tar.gz
  157. chmod +x eventlist-linux64/eventlist
  158. eventlist-linux64/eventlist -s ./Platform_FVP_Corstone_SSE-300_Ethos-U55/microspeech.Reference.EventRecorder.log
  159. eventlist-linux64/eventlist -s ./Platform_FVP_Corstone_SSE-300_Ethos-U55/microspeech.SIMD.EventRecorder.log
  160. eventlist-linux64/eventlist -s ./Platform_FVP_Corstone_SSE-300_Ethos-U55/microspeech.Helium.EventRecorder.log
  161. set_success_status_to_pr:
  162. runs-on: ubuntu-latest
  163. needs: build_and_run
  164. if: github.event.workflow_run && success()
  165. steps:
  166. - name: Set success status to the PR
  167. env:
  168. GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
  169. run: |
  170. curl --request POST \
  171. --url https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.event.workflow_run.head_commit.id }} \
  172. --header "authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
  173. --header 'content-type: application/json' \
  174. --data '{
  175. "state": "success",
  176. "context": "Microspeech",
  177. "target_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
  178. }' \
  179. --fail
  180. set_failure_status_to_pr:
  181. runs-on: ubuntu-latest
  182. needs: build_and_run
  183. if: github.event.workflow_run && failure()
  184. steps:
  185. - name: Set failure status to the PR
  186. env:
  187. GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
  188. run: |
  189. curl --request POST \
  190. --url https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.event.workflow_run.head_commit.id }} \
  191. --header "authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
  192. --header 'content-type: application/json' \
  193. --data '{
  194. "state": "failure",
  195. "context": "Microspeech",
  196. "target_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
  197. }' \
  198. --fail