Repository navigation
363 lines (352 loc) · 14.3 KB
/
Copy pathvalidate.yml
File metadata and controls
363 lines (352 loc) · 14.3 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
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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
name: Validate
on:
pull_request:
push:
branches: [main]
concurrency:
group: validate-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
contents: read
jobs:
tools:
name: tools (ubuntu-latest)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# The wrapper tests compile against upstream's and ggml's headers.
submodules: recursive
- name: Fetch exact historical source controls
# checkout may initialize shallow submodules. These immutable objects
# supply the old ABI and per-carry allocator negatives; never fetch
# a moving branch or silently skip them when absent.
run: |
git -C third_party/stable-diffusion.cpp fetch --depth=1 origin be486498eadc29dc3cd234d944c2180ed42b1415
git -C third_party/stable-diffusion.cpp/ggml fetch --depth=1 origin a5915eb0e47adef21c3f25b889a008925ea838c2
- run: python3 -m unittest discover -s tests -v
dart-vm:
name: dart vm (ubuntu-latest)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: dart-lang/setup-dart@v1
with:
# Pinned: the harness expects this VM's aborts in its controls.
sdk: 3.13.5
- name: Report progress while the Dart VM shuts down
run: python3 -m unittest discover -s tests -p test_progress_stress.py -v
env:
SD_REQUIRE_DART: "1"
SD_PROGRESS_STRESS_RUNS: "25"
macos-tools:
# macOS runs the Mach-O import audit tests that other hosts skip.
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
with:
# The wrapper tests compile against upstream's and ggml's headers.
submodules: recursive
- name: Fetch exact historical source controls
# checkout may initialize shallow submodules. These immutable objects
# supply the old ABI and per-carry allocator negatives; never fetch
# a moving branch or silently skip them when absent.
run: |
git -C third_party/stable-diffusion.cpp fetch --depth=1 origin be486498eadc29dc3cd234d944c2180ed42b1415
git -C third_party/stable-diffusion.cpp/ggml fetch --depth=1 origin a5915eb0e47adef21c3f25b889a008925ea838c2
- run: python3 -m unittest discover -s tests -v
- uses: dart-lang/setup-dart@v1
if: ${{ !cancelled() }}
id: dart
with:
# Pinned: the harness expects this VM's aborts in its controls.
sdk: 3.13.5
- name: Report progress while the Dart VM shuts down
if: ${{ !cancelled() && steps.dart.outcome == 'success' }}
run: python3 -m unittest discover -s tests -p test_progress_stress.py -v
env:
SD_REQUIRE_DART: "1"
SD_PROGRESS_STRESS_RUNS: "25"
exit-teardown:
name: exit teardown (${{ matrix.runtime }})
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
include:
# The runtime as shipped, and one in which a use after free aborts.
- { runtime: release, sanitizer: "" }
- { runtime: address sanitizer, sanitizer: address }
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: ./.github/actions/setup-toolchain
with:
target: macos-arm64
- uses: dart-lang/setup-dart@v1
if: ${{ !matrix.sanitizer }}
with:
sdk: 3.13.5
- name: Build
if: ${{ !matrix.sanitizer }}
run: python3 tools/build.py build --target macos-arm64
- name: Free tracked contexts at exit
# With a sanitizer the test builds its own runtime, which the Dart VM
# cannot load. The model is written by the test; nothing is
# downloaded.
run: python3 -m unittest discover -s tests -p test_exit_teardown_runtime.py -v
env:
SD_REQUIRE_RUNTIME: "1"
SD_REQUIRE_DART: ${{ !matrix.sanitizer && '1' || '' }}
SD_EXIT_TEARDOWN_SANITIZER: ${{ matrix.sanitizer }}
SD_EXIT_TEARDOWN_RUNS: "3"
linux-asan-native:
name: exit teardown (Linux native address sanitizer)
runs-on: ubuntu-24.04
timeout-minutes: 25
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: ./.github/actions/setup-toolchain
with:
target: linux-x64
- name: Verify the existing GCC floor
run: |
test "$(g++ -dumpversion | cut -d. -f1)" -ge 13
g++ --version
- name: Run the native ASan shutdown matrix
# The test builds its ASan runtime and generated fixture, then runs
# every Linux native scenario. Missing runtime/build/checks fail.
# Sanitized Dart and Apple-only tests explicitly skip; ordinary Dart
# stays in the separate Linux release-runtime build lane below.
run: python3 -B -m unittest discover -s tests -p test_exit_teardown_runtime.py -v
env:
SD_EXIT_TEARDOWN_TARGET: linux-x64
SD_EXIT_TEARDOWN_SANITIZER: address
SD_EXIT_TEARDOWN_RUNS: "1"
SD_REQUIRE_RUNTIME: "1"
CMAKE_BUILD_PARALLEL_LEVEL: "4"
build:
name: build (${{ matrix.target }})
runs-on: ${{ matrix.runs_on }}
strategy:
fail-fast: false
matrix:
include:
- { target: android-arm64, runs_on: ubuntu-latest }
- { target: linux-x64, runs_on: ubuntu-24.04, smoke: "--expect-device CPU" }
- { target: linux-x64-vulkan, runs_on: ubuntu-24.04, smoke: "--expect-device Vulkan" }
- { target: windows-x64, runs_on: windows-2022, smoke: "--expect-device CPU" }
- { target: windows-x64-vulkan, runs_on: windows-2022, smoke: "--expect-device CPU" }
steps:
- name: Enable long Git paths on the Windows runner
if: runner.os == 'Windows'
shell: pwsh
# CUTLASS exceeds MAX_PATH during recursive checkout, before CMake's
# short build paths apply. System scope survives checkout's temporary
# HOME and affects only this disposable hosted runner.
run: git config --system core.longpaths true
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: ./.github/actions/setup-toolchain
with:
target: ${{ matrix.target }}
- name: Set up MSVC
if: runner.os == 'Windows'
uses: TheMrMilchmann/setup-msvc-dev@v4.1.0
with:
arch: x64
- name: Build
shell: bash
run: python tools/build.py build --target ${{ matrix.target }}
env:
ANDROID_NDK_HOME: ${{ env.ANDROID_NDK_LATEST_HOME }}
- name: Validate exports and dependencies
shell: bash
run: |
args=()
if [[ "$RUNNER_OS" == Windows ]]; then args+=(--dumpbin dumpbin); fi
python tools/validate_artifacts.py ${{ matrix.target }} "${args[@]}"
env:
ANDROID_NDK_HOME: ${{ env.ANDROID_NDK_LATEST_HOME }}
- name: Check that unsigned Visual C++ fixtures are rejected
if: matrix.target == 'windows-x64'
run: python -m unittest discover -s tests -p test_windows_runtime.py -v
env:
SD_NATIVE_UNSIGNED_PE: bin/windows-x64/lib/stable-diffusion.dll
- name: Load the app-local Visual C++ runtime
if: runner.os == 'Windows'
shell: pwsh
run: |
$smoke = Join-Path $env:RUNNER_TEMP "windows_load_smoke.exe"
cl /nologo /MT /W4 tools/windows_load_smoke.c /Fe:$smoke
if ($LASTEXITCODE) { throw "Failed to build the Windows load smoke" }
& $smoke "bin/${{ matrix.target }}/lib" stable-diffusion.dll
if ($LASTEXITCODE) { throw "Windows bundle did not load its own runtime" }
- name: Load and list devices
# Linux Vulkan runs on Mesa lavapipe (software): functional check only.
if: matrix.smoke
shell: bash
run: python tools/smoke_test.py ${{ matrix.target }} ${{ matrix.smoke }}
env:
# ggml skips CPU-type Vulkan devices such as lavapipe unless listed.
GGML_VK_VISIBLE_DEVICES: "0"
- name: Stage the Windows load check artifacts
if: runner.os == 'Windows'
shell: pwsh
run: |
New-Item "windows-load-check" -ItemType Directory
Copy-Item "bin/${{ matrix.target }}/lib/*.dll" "windows-load-check"
Copy-Item "$env:RUNNER_TEMP/windows_load_smoke.exe" "windows-load-check"
- uses: actions/upload-artifact@v4
if: runner.os == 'Windows'
with:
name: smoke-${{ matrix.target }}
path: windows-load-check/
if-no-files-found: error
retention-days: 7
- name: Check the context defaults and conversion ABI
if: runner.os != 'Windows' && matrix.smoke
run: python3 -m unittest discover -s tests -p test_runtime_api.py -v
env:
SD_RUNTIME_API_TARGET: ${{ matrix.target }}
SD_REQUIRE_RUNTIME: "1"
- name: Generate from FP8 weights
# Metal needs a Mac: GitHub's macOS runners list no Metal device.
if: runner.os != 'Windows' && matrix.smoke
run: python3 -m unittest discover -s tests -p test_fp8_runtime.py -v
env:
SD_FP8_TARGET: ${{ matrix.target }}
SD_REQUIRE_RUNTIME: "1"
GGML_VK_VISIBLE_DEVICES: "0"
- name: Split graph evaluation
# Metal needs a Mac: GitHub's macOS runners list no Metal device.
if: runner.os != 'Windows' && matrix.smoke
run: python3 -m unittest discover -s tests -p test_graph_split_runtime.py -v
env:
SD_GRAPH_SPLIT_TARGET: ${{ matrix.target }}
SD_REQUIRE_RUNTIME: "1"
GGML_VK_VISIBLE_DEVICES: "0"
- uses: dart-lang/setup-dart@v1
if: runner.os == 'Linux' && matrix.smoke
- name: Verify cooperative host shutdown
# On Linux the host joins workers before exit(). The scenarios pass on the
# CPU; the Vulkan target's on lavapipe are reported.
if: runner.os == 'Linux' && matrix.smoke
run: python3 -m unittest discover -s tests -p test_exit_teardown_runtime.py -v
env:
SD_EXIT_TEARDOWN_TARGET: ${{ matrix.target }}
SD_EXIT_TEARDOWN_RUNS: "3"
SD_REQUIRE_RUNTIME: "1"
SD_REQUIRE_DART: "1"
GGML_VK_VISIBLE_DEVICES: "0"
build-apple:
name: build (${{ matrix.family }})
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
include:
- { family: macOS, first: macos-arm64, second: macos-x64 }
- { family: iOS, first: ios-arm64, second: ios-arm64-sim, third: ios-x64-sim }
steps:
- uses: actions/checkout@v4
with:
# The wrapper tests compile against upstream's and ggml's headers.
submodules: recursive
- uses: ./.github/actions/setup-toolchain
with:
target: ${{ matrix.first }}
- name: Build and validate Apple targets
shell: bash
env:
FIRST_TARGET: ${{ matrix.first }}
SECOND_TARGET: ${{ matrix.second }}
THIRD_TARGET: ${{ matrix.third }}
run: |
for target in "$FIRST_TARGET" "$SECOND_TARGET" "$THIRD_TARGET"; do
[ -n "$target" ] || continue
python tools/build.py build --target "$target"
python tools/validate_artifacts.py "$target"
done
- name: Load and list devices
if: matrix.first == 'macos-arm64'
shell: bash
run: python tools/smoke_test.py macos-arm64 --expect-device CPU
- name: Check the context defaults and conversion ABI
if: matrix.first == 'macos-arm64'
run: python3 -m unittest discover -s tests -p test_runtime_api.py -v
env:
SD_RUNTIME_API_TARGET: macos-arm64
SD_REQUIRE_RUNTIME: "1"
- name: Generate from FP8 weights
# Metal needs a Mac: GitHub's macOS runners list no Metal device.
if: matrix.first == 'macos-arm64'
run: python3 -m unittest discover -s tests -p test_fp8_runtime.py -v
env:
SD_FP8_TARGET: macos-arm64
SD_REQUIRE_RUNTIME: "1"
GGML_VK_VISIBLE_DEVICES: "0"
- name: Split graph evaluation
# Metal needs a Mac: GitHub's macOS runners list no Metal device.
if: matrix.first == 'macos-arm64'
run: python3 -m unittest discover -s tests -p test_graph_split_runtime.py -v
env:
SD_GRAPH_SPLIT_TARGET: macos-arm64
SD_REQUIRE_RUNTIME: "1"
GGML_VK_VISIBLE_DEVICES: "0"
- name: Check loader scratch memory
# Metal needs a Mac: GitHub's macOS runners list no Metal device.
if: matrix.first == 'macos-arm64'
run: python3 -m unittest discover -s tests -p test_loader_scratch_runtime.py -v
env:
SD_REQUIRE_RUNTIME: "1"
- uses: actions/upload-artifact@v4
with:
name: bin-${{ matrix.first }}
path: bin/${{ matrix.first }}
if-no-files-found: error
- uses: actions/upload-artifact@v4
with:
name: bin-${{ matrix.second }}
path: bin/${{ matrix.second }}
if-no-files-found: error
- uses: actions/upload-artifact@v4
if: matrix.third
with:
name: bin-${{ matrix.third }}
path: bin/${{ matrix.third }}
if-no-files-found: error
apple-xcframework:
needs: [build, build-apple]
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- uses: actions/download-artifact@v4
with:
pattern: bin-*
path: artifacts
- name: Stage payloads
run: |
for dir in artifacts/bin-*; do
mkdir -p "bin/${dir#artifacts/bin-}"
cp -R "$dir"/. "bin/${dir#artifacts/bin-}/"
done
- name: Build and validate the XCFramework
run: python3 tools/apple_xcframework.py build --tag v0.0.0 --dist dist
- name: Validate the XCFramework privacy manifests
run: >-
python3 tools/apple_privacy_manifest.py --audit-imports
dist/stable-diffusion-native-apple-xcframework-v0.0.0.zip
- name: Link the XCFramework into a SwiftPM consumer
run: python3 tools/apple_xcframework.py consumer dist/stable-diffusion-native-apple-xcframework-v0.0.0.zip