-
Notifications
You must be signed in to change notification settings - Fork 1k
139 lines (131 loc) · 4.4 KB
/
Copy pathbench.yml
File metadata and controls
139 lines (131 loc) · 4.4 KB
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
name: Geniex Bench
on:
workflow_dispatch:
inputs:
device:
description: "QDC chipsets, comma-separated (blank = all)"
type: string
default: ""
model:
description: "Model names from bench-models.json, comma-separated (blank = all)"
type: string
default: ""
permissions:
contents: read
packages: read
jobs:
build-sdk:
uses: ./.github/workflows/_build-sdk.yml
secrets: inherit
with:
upload_artifact: true
load-models:
needs: [build-sdk]
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set.outputs.matrix }}
devices: ${{ steps.set.outputs.devices }}
steps:
- uses: actions/checkout@v7
- id: set
env:
PICK_DEVICE: ${{ github.event.inputs.device }}
PICK_MODEL: ${{ github.event.inputs.model }}
run: |
set -euo pipefail
MODELS_FILE=sdk/benchmark/qdc/bench-models.json
all_devs='["QCS9075M","SC8380XP","SC8480XP","SM8750","SM8850"]'
if [ -n "$PICK_DEVICE" ]; then
devices=$(jq -cn --arg s "$PICK_DEVICE" \
'$s | split(",") | map(gsub("^\\s+|\\s+$"; "")) | map(select(length>0))')
else
devices="$all_devs"
fi
echo "devices=$devices" >> "$GITHUB_OUTPUT"
if [ -n "$PICK_MODEL" ]; then
matrix=$(jq -c --arg s "$PICK_MODEL" '
($s | split(",") | map(gsub("^\\s+|\\s+$"; "")) | map(select(length>0))) as $pick
| map(select(.name as $n | $pick | index($n)))
' "$MODELS_FILE")
picked_n=$(jq 'length' <<<"$matrix")
want_n=$(jq -n --arg s "$PICK_MODEL" \
'$s | split(",") | map(gsub("^\\s+|\\s+$"; "")) | map(select(length>0)) | length')
if [ "$picked_n" != "$want_n" ]; then
echo "::error::model input has unknown name(s): $PICK_MODEL"
echo "::error::available: $(jq -r '.[].name' "$MODELS_FILE" | paste -sd, -)"
exit 1
fi
else
matrix=$(jq -c . "$MODELS_FILE")
fi
echo "matrix=$matrix" >> "$GITHUB_OUTPUT"
bench:
name: ${{ matrix.device }} · ${{ matrix.model.plugin }} · ${{ matrix.model.name }}
needs: [build-sdk, load-models]
runs-on: ubuntu-latest
timeout-minutes: 180
strategy:
fail-fast: false
max-parallel: 4
matrix:
device: ${{ fromJson(needs.load-models.outputs.devices) }}
model: ${{ fromJson(needs.load-models.outputs.matrix) }}
env:
QDC_API_KEY: ${{ secrets.QDC_API_KEY }}
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: "3.11"
- id: sdk
env:
DEVICE: ${{ matrix.device }}
run: |
case "$DEVICE" in
SM*) echo "name=sdk-android-arm64" ;;
SC*|CRD*|X*) echo "name=sdk-windows-arm64" ;;
*) echo "name=sdk-linux-arm64" ;;
esac >> "$GITHUB_OUTPUT"
- uses: actions/download-artifact@v8
with:
name: ${{ steps.sdk.outputs.name }}
path: pkg-geniex
- uses: ./.github/actions/install-qdc-sdk
- env:
DEVICE: ${{ matrix.device }}
MODEL_NAME: ${{ matrix.model.name }}
run: |
python sdk/benchmark/qdc/run_qdc_jobs.py \
--pkg-dir pkg-geniex \
--device "$DEVICE" \
--model-name "$MODEL_NAME" \
--cells-out "$DEVICE-$MODEL_NAME.json"
- uses: actions/upload-artifact@v7
if: always()
with:
name: bench-cells-${{ matrix.device }}-${{ matrix.model.name }}
path: ${{ matrix.device }}-${{ matrix.model.name }}.json
if-no-files-found: ignore
aggregate:
name: aggregate · ${{ matrix.device }}
needs: [load-models, bench]
if: always()
runs-on: ubuntu-latest
strategy:
matrix:
device: ${{ fromJson(needs.load-models.outputs.devices) }}
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: "3.11"
- uses: actions/download-artifact@v8
with:
pattern: bench-cells-${{ matrix.device }}-*
path: cells
- env:
DEVICE: ${{ matrix.device }}
run: |
python sdk/benchmark/qdc/run_qdc_jobs.py \
--device "$DEVICE" \
--render-dir cells