-
Notifications
You must be signed in to change notification settings - Fork 1k
139 lines (125 loc) · 4.38 KB
/
_test_backend.yml
File metadata and controls
139 lines (125 loc) · 4.38 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: Test Backend
on:
workflow_call:
inputs:
backend:
description: 'Backend to test (xnnpack, coreml, vulkan, qnn)'
required: true
type: string
flows:
description: 'JSON array of flows to test'
required: true
type: string
ref:
description: 'Git ref to checkout'
required: false
type: string
default: ${{ github.sha }}
timeout:
description: 'Job timeout in minutes'
required: false
type: number
default: 120
run-linux:
description: 'Whether to run Linux tests'
required: false
type: boolean
default: false
run-macos:
description: 'Whether to run macOS tests'
required: false
type: boolean
default: false
runner-linux:
description: 'Runner type for Linux jobs'
required: false
type: string
default: linux.4xlarge.memory
jobs:
test-backend-linux:
if: ${{ inputs.run-linux }}
strategy:
fail-fast: false
matrix:
flow: ${{ fromJSON(inputs.flows) }}
suite: [models, operators]
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
with:
ref: ${{ inputs.ref }}
runner: ${{ inputs.runner-linux }}
docker-image: ci-image:executorch-ubuntu-22.04-clang12
submodules: recursive
timeout: ${{ inputs.timeout }}
upload-artifact: test-report-${{ matrix.flow }}-${{ matrix.suite }}
script: |
set -eux
source .ci/scripts/test_backend.sh "${{ matrix.suite }}" "${{ matrix.flow }}" "${RUNNER_ARTIFACT_DIR}"
package-golden-artifacts:
if: ${{ inputs.run-linux }}
needs: test-backend-linux
runs-on: linux.2xlarge
steps:
- name: Download model test artifacts
uses: actions/download-artifact@v4
with:
pattern: test-report-*-models
path: downloaded/
- name: Package golden artifacts
run: |
set -eux
TIMESTAMP=$(date -u +%y%m%d%H)
mkdir -p golden_combined
# Collect golden artifacts preserving flow directory structure.
# Raw files live under downloaded/*/golden-artifacts/{flow}/.
for flow_dir in downloaded/*/golden-artifacts/*/; do
[ -d "$flow_dir" ] || continue
flow_name=$(basename "$flow_dir")
if ls "$flow_dir"/*.pte 1>/dev/null 2>&1; then
mkdir -p "golden_combined/${flow_name}"
cp "$flow_dir"/*.pte "$flow_dir"/*_input*.bin "$flow_dir"/*_expected_output*.bin \
"golden_combined/${flow_name}/" 2>/dev/null || true
fi
done
if find golden_combined -name '*.pte' | grep -q .; then
(cd golden_combined && zip -r "../golden_artifacts_${TIMESTAMP}.zip" .)
echo "Created golden_artifacts_${TIMESTAMP}.zip"
find golden_combined -type f | head -20
else
echo "No golden artifacts found."
fi
- name: Upload combined golden artifacts
uses: actions/upload-artifact@v4
with:
name: golden-artifacts-${{ inputs.backend }}
path: golden_artifacts_*.zip
if-no-files-found: ignore
- name: Upload golden artifacts to S3
uses: seemethere/upload-artifact-s3@v5
if: ${{ hashFiles('golden_artifacts_*.zip') != '' }}
with:
s3-bucket: gha-artifacts
s3-prefix: |
${{ github.repository }}/test-backend-artifacts/golden-artifacts-${{ inputs.backend }}
retention-days: 90
if-no-files-found: ignore
path: golden_artifacts_*.zip
test-backend-macos:
if: ${{ inputs.run-macos }}
strategy:
fail-fast: false
matrix:
flow: ${{ fromJSON(inputs.flows) }}
suite: [models, operators]
uses: pytorch/test-infra/.github/workflows/macos_job.yml@main
with:
ref: ${{ inputs.ref }}
runner: macos-m1-stable
python-version: "3.12"
submodules: recursive
timeout: ${{ inputs.timeout }}
upload-artifact: test-report-${{ matrix.flow }}-${{ matrix.suite }}
script: |
set -eux
# This is needed to get the prebuilt PyTorch wheel from S3
${CONDA_RUN} --no-capture-output pip install awscli==1.37.21
source .ci/scripts/test_backend.sh "${{ matrix.suite }}" "${{ matrix.flow }}" "${RUNNER_ARTIFACT_DIR}"