diff --git a/CHANGELOG.md b/CHANGELOG.md
index 48dded8e0..b447aab4a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,7 @@ Releases before 0.10.0 are in the
- Fixed the generic JSON tool fallback replacing your system message with its JSON instruction when tools are passed with `ToolChoice.auto` or `required`; the instruction now follows the system message ([#1973](https://github.com/leehack/llamadart/issues/1973)).
- Native LiteRT-LM strict `responseFormat` now also runs on the Windows x64 GPU (NVIDIA L4 over Direct3D 12, GRID driver 596.86, Qwen3 and Gemma 4); `ComputeDevice.gpu` there no longer needs `ComputeDevice.cpu`. Other drivers are untested and the Linux arm64 GPU stays unqualified ([#174](https://github.com/leehack/llamadart/issues/174)).
+- Adopt stable-diffusion `v0.3.0-6` with Apple host-buffer and model-loader scratch release fixes ([#2004](https://github.com/leehack/llamadart/issues/2004)); full-VAE load/dispose checks passed on iOS 18 and 26 with small residual memory.
- Documented that the Android llama.cpp `opencl` module needs the `libOpenCL.so` `` manifest declaration on target API 31+; without it the module cannot load and `ComputeDevice.gpu` with OpenCL throws. ggml-opencl admits only Adreno (and Intel) GPUs. With it, EmbeddingGemma 2 ran fully on OpenCL on a Galaxy S24 ([#1189](https://github.com/leehack/llamadart/issues/1189)).
- Fixed Android llama.cpp loads that ask for another GPU backend (such as `opencl`) and land on an already registered Vulkan device skipping the Android Vulkan context settings and the 8-token prompt cap ([#2016](https://github.com/leehack/llamadart/issues/2016)).
diff --git a/README.md b/README.md
index 82fbc64e3..90e30931f 100644
--- a/README.md
+++ b/README.md
@@ -149,10 +149,12 @@ creation fails, `ComputeDevice.auto` retries on the CPU with a warning;
Image generation
is not available on the web. On iOS, use
-`ImageModelPlacement(vaeOnCpu: true)` to keep diffusion on Metal, or CPU
-generation. The pinned `v0.3.0-4` runtime splits Metal graphs, so a full VAE
+`ImageModelPlacement(vaeOnCpu: true)` for CPU VAE decoding with Metal
+diffusion, or choose CPU generation. The pinned `v0.3.0-6` runtime splits Metal graphs, so a full VAE
is admitted on iOS Metal (qualified: SD-Turbo's embedded VAE at 512x512); a runtime without the split keeps the intrinsic SDXS
tiny-decoder policy and refuses full-VAE Metal decoding.
+SD `v0.3.0-6` passed four full-VAE load/dispose cycles and eight decodes per device on iPhone 16 Pro (iOS 18.3.2) and iPhone 17 Pro (iOS 26.5.1), tested at `6b191b28`. Small nonzero residual memory remains; this single session is not proof of zero leaks (#2004).
+
Per-target support, device limitations and runtime options:
- [Platform and backend support matrix](https://llamadart.leehack.com/docs/platforms/support-matrix), including
diff --git a/doc/cross_platform_validation.md b/doc/cross_platform_validation.md
index 8afa0d32e..2d2f0323c 100644
--- a/doc/cross_platform_validation.md
+++ b/doc/cross_platform_validation.md
@@ -2477,10 +2477,59 @@ with the SD-Turbo full-VAE harness:
| C1, split off | iPhone 16 Pro, iOS 18.3 | third decode failed with the GPU command-buffer error (watchdog) |
| C2b soak | iPhone 16 Pro, iPhone 17 Pro | 30 of 30 decodes passed, one image hash, flat footprint |
-Known limit ([#2004](https://github.com/leehack/llamadart/issues/2004)): on
-the iPhone 17 Pro (iOS 26.5.1) the second engine dispose kept about 2 GB
+On the iPhone 17 Pro (iOS 26.5.1) the second engine dispose kept about 2 GB
resident and later loads failed the memory check; the iPhone 16 Pro returned to
-its baseline. Whether it is a leak or delayed reclaim is undecided.
+its baseline ([#2004](https://github.com/leehack/llamadart/issues/2004)).
+Runtime `v0.3.0-5` carries the ggml `vm_allocate` host-buffer fix for it.
+
+The current `v0.3.0-6` pin adds Apple model-loader scratch release; its
+qualification is recorded below, separately from these historical v5 measurements.
+
+Repin soak of runtime `v0.3.0-5` (source `f7dcae3bb`): DDP session
+`session-790c4db5-300b-4c86-aeb0-2e74585a34a2`, record `R1047`, SD-Turbo q8_0 with its embedded full VAE,
+4 load/dispose cycles per device. The preserved harness calls
+`profile.buildModel(modelPath: modelFile)` without `taesdPath`; the original
+v5 soak and the v4/v5 A/B therefore both used full VAE. Both jobs passed with no `load_failed`
+and stable decode hashes.
+
+| Device | Peak per load | After dispose |
+| --- | --- | --- |
+| iPhone 17 Pro, iOS 26.5.1 | about 2.4 GB | 163 to 190 MB (148 MB baseline); the old runtime kept about 2 GB |
+| iPhone 16 Pro, iOS 18.3.2 | about 2.4 GB | about 370 MB, flat across cycles (125 MB first-cycle baseline; earlier v3/v4 measured about 150 MB on this device/model) |
+
+#### v0.3.0-6 full-VAE disposal qualification (2026-11-15)
+
+Tested source: `6b191b28b0f39eae1368fc76ea37f8051c5d2cb8`, session
+`session-5511bf15-6626-4b14-b920-70836728c503`, test ZIP SHA-256
+`a7af0af3d97606d2e93d0eacb84f4307d521ca6120a6ae50bbbb601f255881a8`.
+Both devices completed four loads/disposals and eight successful decodes with
+no failures on Metal (`MTL0`). The preserved harness used the same SD-Turbo
+q8_0 model with its embedded full VAE, no `taesdPath`, at 512x512, one step,
+guidance 1 and seed 42. Per-device PNG hashes were unchanged across v4/v5/v6.
+
+| Device / OS | v4 end residual (MiB) | v5 end residual (MiB) | v6 end residual (MiB) |
+| --- | --- | --- | --- |
+| iPhone 16 Pro / iOS 18.3.2 | 21.38–25.56 | 239.66–240.56 | 37.91–40.05 |
+| iPhone 17 Pro / iOS 26.5.1 | about 1.9 GiB retained after the first cycle | 28.23–43.63 | 32.36–43.95 |
+
+Residuals are relative to each run's first baseline, before epilogue heap
+churn. V6 substantially reduces the v5 iOS 18 residual and keeps iOS 26 near
+v5; small nonzero residuals remain. These are single-session observations,
+not proof of zero leaks. The historical v4 iOS 26 provider result was PASS,
+but its raw log has one `load_failed` and five disposal records; it was not a
+clean functional pass.
+
+Raw configs report `runtime_version: unknown`. Independent binary provenance
+verified the published v6 XCFramework SHA-256
+`7e5a79218d731ce7fb6b54020190a79630bd843d9a1dbafb24e5f0442ab95cb8`,
+matching UUID `7C8D9AC4-524A-309E-A24B-FF6FF5A7B673` and byte equality after
+signature removal and normalization of `__LINKEDIT.vmsize`. The evidence bundle
+retains `results/ab-v6/evidence-report.md`, `comparison.json`,
+`bundles/ab-v6/state.json` and `artifact-verification.json` under
+`llamadart-evidence/issue-2004`. Original logs remain unchanged. This follow-up
+changes documentation only; tested source and v6 native binary are unchanged.
+
+#### v0.3.0-4 public API qualification
Final qualification of the public API at PR head `6109c8d1e` with the published
`v0.3.0-4` pin: DDP session `session-954952c8-39c6-4878-9f17-ca2c6efed56b`,
diff --git a/example/chat_app/README.md b/example/chat_app/README.md
index aa544acb5..204f07c64 100644
--- a/example/chat_app/README.md
+++ b/example/chat_app/README.md
@@ -306,7 +306,7 @@ layouts) opens a separate screen for the experimental `ImageGenerationEngine`
runtime…** meanwhile. With an empty Metal shader cache the first check
compiles ggml's Metal library, about 16 s on an M4 Max; with the cache warm
it takes under 0.5 s.
-- On iOS, the pinned SD runtime (`v0.3.0-4`) splits Metal graphs, so full-VAE recipes decode on the GPU; the app has no iOS-specific gating. A runtime without the split refuses them and needs CPU VAE placement or CPU generation. On iOS 26 the second engine dispose can leave about 2 GB resident ([#2004](https://github.com/leehack/llamadart/issues/2004)).
+- On iOS, the pinned SD runtime (`v0.3.0-6`) splits Metal graphs, so full-VAE recipes decode on the GPU; the app has no iOS-specific gating. A runtime without the split refuses them and needs CPU VAE placement or CPU generation. On iOS 26 the runtime returns an image model's memory on dispose; earlier runtimes could leave about 2 GB resident ([#2004](https://github.com/leehack/llamadart/issues/2004)).
- Models: **SDXS-512** (683 MB, recommended, fits most phones) and
**SD-Turbo + TAESD** (2.0 GB). Both download into the app's model cache
from pinned Hugging Face revisions with exact sizes and SHA-256 checks; an
@@ -350,6 +350,8 @@ layouts) opens a separate screen for the experimental `ImageGenerationEngine`
scratch test using the seed entry this test now uses generated with seed 42
there, but this test itself has not been re-run on a physical iPhone.
+SD `v0.3.0-6` passed four full-VAE load/dispose cycles and eight decodes per device on iPhone 16 Pro (iOS 18.3.2) and iPhone 17 Pro (iOS 26.5.1), tested at `6b191b28`. Small nonzero residual memory remains; this single session is not proof of zero leaks (#2004).
+
### 3. Advanced Configuration (Optional)
1. Tap the settings control in the top bar.
2. Adjust **GPU Layers**, **Context Size**, and **Preferred Backend**. Expand
diff --git a/lib/src/hook/native_release_pins.dart b/lib/src/hook/native_release_pins.dart
index c566d68e7..5e46ec0e6 100644
--- a/lib/src/hook/native_release_pins.dart
+++ b/lib/src/hook/native_release_pins.dart
@@ -217,10 +217,10 @@ const liteRtLmBundleSpecs = [
/// `leehack/stable-diffusion-native` release tag downloaded for the opt-in
/// stable-diffusion.cpp runtime.
-const stableDiffusionReleaseTag = 'v0.3.0-4';
+const stableDiffusionReleaseTag = 'v0.3.0-6';
/// First Apple companion release containing [stableDiffusionReleaseTag].
-const stableDiffusionAppleCompanionVersion = '0.19.10';
+const stableDiffusionAppleCompanionVersion = '0.19.11';
/// Explicitly qualified older Apple SD pins that preserve existing app locks.
///
@@ -229,11 +229,14 @@ const stableDiffusionAppleCompanionVersion = '0.19.10';
/// native generation returns images; the newer native guard remains preferred.
/// Clear and requalify this map whenever [stableDiffusionReleaseTag] changes.
///
-/// `v0.3.0-3` has the same upstream as `v0.3.0-4` and lacks only the
-/// `sd_dart_graph_split_*` exports, which the bindings load as an optional
-/// group, so an older framework keeps the iOS full-VAE refusal.
+/// `v0.3.0-3` and `v0.3.0-4` share the pinned upstream and its C headers.
+/// `v0.3.0-3` lacks the `sd_dart_graph_split_*` exports, which the bindings
+/// load as an optional group, so it keeps the iOS full-VAE refusal; `v0.3.0-4`
+/// lacks the Apple host-buffer and model-loader scratch release fixes.
const stableDiffusionCompatibleAppleCompanionTags = {
- 'v0.3.0-3': 'the sd_dart_graph_split_* exports (iOS full-VAE decoding)',
+ 'v0.3.0-3':
+ 'the sd_dart_graph_split_* exports (iOS full-VAE decoding) and Apple host-buffer and model-loader scratch release fixes',
+ 'v0.3.0-4': 'the Apple host-buffer and model-loader scratch release fixes',
};
/// Checksums of the exact published XCFrameworks accepted by the SD hook.
@@ -242,11 +245,13 @@ const stableDiffusionAppleCompanionChecksums = {
'8f35c67f72d1d4bf86d31f20f3437d04baaf3b6ac7389908000fd166e387783f',
'v0.3.0-4':
'0d022638f54be80aa75fd8e73a94d139ad8887f4f3c73084501369ca5e7ac354',
+ 'v0.3.0-6':
+ '7e5a79218d731ce7fb6b54020190a79630bd843d9a1dbafb24e5f0442ab95cb8',
};
/// stable_diffusion cache directory version derived from
/// [stableDiffusionReleaseTag].
-const stableDiffusionVersion = '0.3.0-4';
+const stableDiffusionVersion = '0.3.0-6';
/// A published stable-diffusion-native runtime archive and the library it must
/// contain under `lib/`.
@@ -273,62 +278,62 @@ class StableDiffusionBundleSpec {
const stableDiffusionBundleSpecs = [
StableDiffusionBundleSpec(
'android-arm64',
- sha256: 'fdc1a614bc7b50d838dfee4416a8ffea04eb01a0042f2d65821e80225e4000cd',
+ sha256: '56ab35a9e1b941fab1169b6308c0e2a1fceaea0e97499e19f849242ee2d076f8',
requiredLibraries: {'libstable-diffusion.so'},
),
StableDiffusionBundleSpec(
'ios-arm64',
- sha256: 'c24c7df0a7c21370d026668cd12a98baf646d7951829088e6957f25ad13cdce9',
+ sha256: '87e5a91bf2b68fac21722aac7bc22ec265ba4946cb54a83e75e7ff3b69aaa801',
requiredLibraries: {'libstable-diffusion.dylib'},
),
StableDiffusionBundleSpec(
'ios-arm64-sim',
- sha256: 'be5ab833a7a902ba75bce16c3020565372bef672106e5b91a2d9bcb7e85d0fb2',
+ sha256: '30f65bcebf4044b87085b8c130322398d3212530ad0948e6166a11e838966731',
requiredLibraries: {'libstable-diffusion.dylib'},
),
StableDiffusionBundleSpec(
'ios-x64-sim',
- sha256: 'eae74517da056d3cd44964a5ada097b4ec58158be4978721efdb9801d90e7540',
+ sha256: 'ff135eca41f75798dd3edc16da31af515b10f5793d35e8d70c340f02479fdfcd',
requiredLibraries: {'libstable-diffusion.dylib'},
),
StableDiffusionBundleSpec(
'macos-arm64',
- sha256: 'd34dbaf3c9ecfbbaa97e1c89687e27cefdae824ed27a1a8cf694a9c9489d3eae',
+ sha256: '2a2468ecd8aa284a093179ecf28f17e93b31d4359ab553a4010353063cb410dc',
requiredLibraries: {'libstable-diffusion.dylib'},
),
StableDiffusionBundleSpec(
'macos-x64',
- sha256: '7f5954264d0e904a5049822e320eb6b06696c38a59428868537915b439eec478',
+ sha256: 'e2f49a8ecbc898cfafa9feefaca1b4703f23af19e74b3b2a6bd407f8730eb8ff',
requiredLibraries: {'libstable-diffusion.dylib'},
),
StableDiffusionBundleSpec(
'linux-arm64',
- sha256: '71277d3a6f2c3a500b69fae829318c19ef00ed035a86cef09215865167b354a4',
+ sha256: 'd394acffe3a9de8cc86abb4f1176f1bb1b5af5ed83efc013384e2b6e220d831f',
requiredLibraries: {'libstable-diffusion.so'},
),
StableDiffusionBundleSpec(
'linux-arm64-vulkan',
- sha256: '58b362b189473334d3ca92f40eb998228ef723b740efc1f1d9b885c7ad711be6',
+ sha256: 'd2412bc1ee28dd87a353d37181c060e1e0287d37ffc6c231dae5b3b399071dab',
requiredLibraries: {'libstable-diffusion.so'},
),
StableDiffusionBundleSpec(
'linux-x64',
- sha256: '4b5405c319f500d1190e2e363386d561484ebcc88fe41cdfb6fa67fe863e68f4',
+ sha256: '6dd33ff5cede6b9468006dcd08b6b60d5d3ac32c65863df1475942b7c6d9baac',
requiredLibraries: {'libstable-diffusion.so'},
),
StableDiffusionBundleSpec(
'linux-x64-vulkan',
- sha256: '43c3331afc6c72dd5ac16eef6625abdbc8fbed29544b442d3299e11c36d1caba',
+ sha256: 'dda3969e18974ddd2dc110ca2576927548bcc0e9355932cd25249803ff1f816c',
requiredLibraries: {'libstable-diffusion.so'},
),
StableDiffusionBundleSpec(
'windows-x64',
- sha256: '5eff9c03d5a8b13412df02816d451b9f5e53aba689d8b65118cc2e4862dd1848',
+ sha256: '8da3d2d03634bcd9a76e52d84d92995a02b956ed697cc23e4303f45b3d1fdc5e',
requiredLibraries: {'stable-diffusion.dll'},
),
StableDiffusionBundleSpec(
'windows-x64-vulkan',
- sha256: '19351af58dc09ee6d66b2b09b3206518a4920e28377c86a5f1ebf2fb8dfac8c4',
+ sha256: 'eb15f8673c87cfbfd0a8a9f133dc96af1316bc1b58009e33f9f851e43b8d3d39',
requiredLibraries: {'stable-diffusion.dll'},
),
];
diff --git a/packages/llamadart_stable_diffusion_flutter/CHANGELOG.md b/packages/llamadart_stable_diffusion_flutter/CHANGELOG.md
index 33b0b70a1..c1e8c1afe 100644
--- a/packages/llamadart_stable_diffusion_flutter/CHANGELOG.md
+++ b/packages/llamadart_stable_diffusion_flutter/CHANGELOG.md
@@ -1,3 +1,7 @@
+## Unreleased
+
+- Updated Apple SwiftPM native pin to `leehack/stable-diffusion-native@v0.3.0-6`.
+
## 0.19.10
- Updated Apple SwiftPM native pin to `leehack/stable-diffusion-native@v0.3.0-4`.
diff --git a/packages/llamadart_stable_diffusion_flutter/README.md b/packages/llamadart_stable_diffusion_flutter/README.md
index 2e13d614d..c07680dab 100644
--- a/packages/llamadart_stable_diffusion_flutter/README.md
+++ b/packages/llamadart_stable_diffusion_flutter/README.md
@@ -34,7 +34,7 @@ Flutter iOS and macOS it does so only with this package.
This package has no runtime Dart API of its own. Import `package:llamadart`
normally from the core package and use `ImageGenerationEngine` there.
-The Apple SwiftPM manifest pins `leehack/stable-diffusion-native@v0.3.0-4`.
+The Apple SwiftPM manifest pins `leehack/stable-diffusion-native@v0.3.0-6`.
Apps bound for the App Store should use this package: the Apple privacy
manifest for the stable-diffusion.cpp runtime ships inside this XCFramework,
diff --git a/packages/llamadart_stable_diffusion_flutter/darwin/llamadart_stable_diffusion_flutter/Package.swift b/packages/llamadart_stable_diffusion_flutter/darwin/llamadart_stable_diffusion_flutter/Package.swift
index 402ce12de..213705e94 100644
--- a/packages/llamadart_stable_diffusion_flutter/darwin/llamadart_stable_diffusion_flutter/Package.swift
+++ b/packages/llamadart_stable_diffusion_flutter/darwin/llamadart_stable_diffusion_flutter/Package.swift
@@ -4,7 +4,7 @@ import PackageDescription
let packageRoot = URL(fileURLWithPath: #filePath).deletingLastPathComponent()
let artifactsRoot = packageRoot.appendingPathComponent("Artifacts")
-let stableDiffusionTag = "v0.3.0-4"
+let stableDiffusionTag = "v0.3.0-6"
func localArtifactPath(_ name: String) -> String? {
let path = artifactsRoot.appendingPathComponent(name).path
@@ -47,7 +47,7 @@ let package = Package(
repository: "leehack/stable-diffusion-native",
artifactName: "stable-diffusion-native-apple-xcframework-\(stableDiffusionTag).zip",
tag: stableDiffusionTag,
- checksum: "0d022638f54be80aa75fd8e73a94d139ad8887f4f3c73084501369ca5e7ac354"
+ checksum: "7e5a79218d731ce7fb6b54020190a79630bd843d9a1dbafb24e5f0442ab95cb8"
),
.target(
name: "llamadart_stable_diffusion_flutter",
diff --git a/skills/llamadart-image-generation/SKILL.md b/skills/llamadart-image-generation/SKILL.md
index 7b29771ea..2648b099f 100644
--- a/skills/llamadart-image-generation/SKILL.md
+++ b/skills/llamadart-image-generation/SKILL.md
@@ -53,10 +53,9 @@ description: >-
`xcodebuild` show both. Use the companion with the core's `MAJOR.MINOR`. Adding it
opts the app into the runtime (about 37 MB per Apple target).
The core accepts only an Apple SD companion pinning its own runtime
-(`v0.3.0-4`): runtimes before `v0.3.0-1` abort on FP8 weights on Metal, and those before
+(`v0.3.0-6`, or `v0.3.0-4`/`v0.3.0-3` with an upgrade warning): runtimes before `v0.3.0-1` abort on FP8 weights on Metal, and those before
`v0.3.0` have a smaller `sd_ctx_params_t`. Upgrade the
-core and `llamadart_stable_diffusion_flutter` together.
-
+core and `llamadart_stable_diffusion_flutter` together. SD `v0.3.0-6` passed four full-VAE load/dispose cycles and eight decodes per device on iPhone 16 Pro (iOS 18.3.2) and iPhone 17 Pro (iOS 26.5.1), tested at `6b191b28`. Small nonzero residual memory remains; this single session is not proof of zero leaks (#2004).
- Platforms: Android arm64 (CPU only; Armv8.2 dot-product and fp16), iOS 16.4+
and macOS 13.3+ (Metal), Linux arm64/x64 and Windows x64 (CPU or Vulkan; x64
CPUs need AVX2, FMA, F16C and BMI2). Web, Android x64 and Windows arm64
@@ -283,10 +282,10 @@ core and `llamadart_stable_diffusion_flutter` together.
true` on iOS Metal throws `LlamaUnsupportedException` at load: every decode
tripped the GPU watchdog and returned a corrupt image
([#1044](https://github.com/leehack/llamadart/issues/1044)). Full-VAE Metal
- decoding on iOS is refused only without the graph split (pinned `v0.3.0-4`
+ decoding on iOS is refused only without the graph split (pinned `v0.3.0-6`
has it, #1047); only SD-Turbo's embedded VAE at 512x512 is qualified, and a
Metal command-buffer failure is an error. An older runtime needs an SDXS
- intrinsic decoder, `vaeOnCpu: true` or CPU. iOS 26: 2 GB may stay resident (#2004).
+ intrinsic decoder, `vaeOnCpu: true` or CPU. iOS 26: fixed in runtime `v0.3.0-5` (measured on iPhone 17 Pro; iPhone 16 Pro retained memory above baseline, #2004).
- `ImageConditioningCacheParams(capacity: ...)`: ordinary `ImageModelParams`
preserve the native default of 4 prompt-conditioning entries. `0` disables
reuse; positive values set an LRU entry limit up to `2147483647` (the signed 32-bit ABI
diff --git a/test/fixtures/native/stable_diffusion_v0_3_0_6_manifest.json b/test/fixtures/native/stable_diffusion_v0_3_0_6_manifest.json
new file mode 100644
index 000000000..f24a21a3e
--- /dev/null
+++ b/test/fixtures/native/stable_diffusion_v0_3_0_6_manifest.json
@@ -0,0 +1,326 @@
+{
+ "schemaVersion": 1,
+ "package": "stable-diffusion-native",
+ "tag": "v0.3.0-6",
+ "source": {
+ "repository": "leehack/stable-diffusion-native",
+ "commit": "0ec6c1fa1e60d5124413b6c14b8fe510f112567d"
+ },
+ "upstream": {
+ "repository": "leejet/stable-diffusion.cpp",
+ "commit": "be486498eadc29dc3cd234d944c2180ed42b1415",
+ "patches": [
+ "fp8_metal_f16_load.patch",
+ "ggml_apple_vm_allocate.patch",
+ "ggml_metal_apple_vm_allocate.patch",
+ "intrinsic_tiny_decoder_policy.patch",
+ "loader_scratch_vm_allocate.patch",
+ "lora_immediate_fallback.patch",
+ "pickle_line_span.patch",
+ "torch_zip_entry_lookup.patch"
+ ]
+ },
+ "artifacts": [
+ {
+ "target": "macos-arm64",
+ "kind": "runtime",
+ "file": "stable-diffusion-native-runtime-macos-arm64-v0.3.0-6.tar.gz",
+ "sha256": "2a2468ecd8aa284a093179ecf28f17e93b31d4359ab553a4010353063cb410dc",
+ "size": 16471383,
+ "library": "libstable-diffusion.dylib",
+ "accelerators": [
+ "metal",
+ "cpu"
+ ]
+ },
+ {
+ "target": "macos-arm64",
+ "kind": "symbols",
+ "file": "stable-diffusion-native-symbols-macos-arm64-v0.3.0-6.tar.gz",
+ "sha256": "d1dde5dd67f4a581a97f1e4ec8080c2c71006bea43a5e7124486da606d7301ec",
+ "size": 16778701,
+ "library": "libstable-diffusion.dylib",
+ "accelerators": [
+ "metal",
+ "cpu"
+ ]
+ },
+ {
+ "target": "macos-x64",
+ "kind": "runtime",
+ "file": "stable-diffusion-native-runtime-macos-x64-v0.3.0-6.tar.gz",
+ "sha256": "e2f49a8ecbc898cfafa9feefaca1b4703f23af19e74b3b2a6bd407f8730eb8ff",
+ "size": 16453679,
+ "library": "libstable-diffusion.dylib",
+ "accelerators": [
+ "metal",
+ "cpu"
+ ]
+ },
+ {
+ "target": "macos-x64",
+ "kind": "symbols",
+ "file": "stable-diffusion-native-symbols-macos-x64-v0.3.0-6.tar.gz",
+ "sha256": "9db5beec1ccc4bdff4c434cdfee76e7187a23f6cd23b763c9837ad1456ced7cc",
+ "size": 16738320,
+ "library": "libstable-diffusion.dylib",
+ "accelerators": [
+ "metal",
+ "cpu"
+ ]
+ },
+ {
+ "target": "ios-arm64",
+ "kind": "runtime",
+ "file": "stable-diffusion-native-runtime-ios-arm64-v0.3.0-6.tar.gz",
+ "sha256": "87e5a91bf2b68fac21722aac7bc22ec265ba4946cb54a83e75e7ff3b69aaa801",
+ "size": 16073482,
+ "library": "libstable-diffusion.dylib",
+ "accelerators": [
+ "metal",
+ "cpu"
+ ]
+ },
+ {
+ "target": "ios-arm64",
+ "kind": "symbols",
+ "file": "stable-diffusion-native-symbols-ios-arm64-v0.3.0-6.tar.gz",
+ "sha256": "507d28fce9844e36a10b3ce4e492fe743a7b584bb30ab550d87af470ef8e01b6",
+ "size": 16362367,
+ "library": "libstable-diffusion.dylib",
+ "accelerators": [
+ "metal",
+ "cpu"
+ ]
+ },
+ {
+ "target": "ios-arm64-sim",
+ "kind": "runtime",
+ "file": "stable-diffusion-native-runtime-ios-arm64-sim-v0.3.0-6.tar.gz",
+ "sha256": "30f65bcebf4044b87085b8c130322398d3212530ad0948e6166a11e838966731",
+ "size": 16471141,
+ "library": "libstable-diffusion.dylib",
+ "accelerators": [
+ "metal",
+ "cpu"
+ ]
+ },
+ {
+ "target": "ios-arm64-sim",
+ "kind": "symbols",
+ "file": "stable-diffusion-native-symbols-ios-arm64-sim-v0.3.0-6.tar.gz",
+ "sha256": "f53859beb0c59d30b24c2c39da0176072ab2acfd1032084963e3214fe35abbe9",
+ "size": 16778235,
+ "library": "libstable-diffusion.dylib",
+ "accelerators": [
+ "metal",
+ "cpu"
+ ]
+ },
+ {
+ "target": "ios-x64-sim",
+ "kind": "runtime",
+ "file": "stable-diffusion-native-runtime-ios-x64-sim-v0.3.0-6.tar.gz",
+ "sha256": "ff135eca41f75798dd3edc16da31af515b10f5793d35e8d70c340f02479fdfcd",
+ "size": 16469500,
+ "library": "libstable-diffusion.dylib",
+ "accelerators": [
+ "metal",
+ "cpu"
+ ]
+ },
+ {
+ "target": "ios-x64-sim",
+ "kind": "symbols",
+ "file": "stable-diffusion-native-symbols-ios-x64-sim-v0.3.0-6.tar.gz",
+ "sha256": "ba6ec33eb0ee218487f776be38826a6bf32c47bf7b53d554ec3f67580056c4d4",
+ "size": 16749943,
+ "library": "libstable-diffusion.dylib",
+ "accelerators": [
+ "metal",
+ "cpu"
+ ]
+ },
+ {
+ "target": "android-arm64",
+ "kind": "runtime",
+ "file": "stable-diffusion-native-runtime-android-arm64-v0.3.0-6.tar.gz",
+ "sha256": "56ab35a9e1b941fab1169b6308c0e2a1fceaea0e97499e19f849242ee2d076f8",
+ "size": 15481928,
+ "library": "libstable-diffusion.so",
+ "accelerators": [
+ "cpu"
+ ]
+ },
+ {
+ "target": "android-arm64",
+ "kind": "symbols",
+ "file": "stable-diffusion-native-symbols-android-arm64-v0.3.0-6.tar.gz",
+ "sha256": "9d1b7055ffc79de99a52f65d4b2d52187952c46a3ed0045965f76be5a833b02a",
+ "size": 61624304,
+ "library": "libstable-diffusion.so",
+ "accelerators": [
+ "cpu"
+ ]
+ },
+ {
+ "target": "linux-x64",
+ "kind": "runtime",
+ "file": "stable-diffusion-native-runtime-linux-x64-v0.3.0-6.tar.gz",
+ "sha256": "6dd33ff5cede6b9468006dcd08b6b60d5d3ac32c65863df1475942b7c6d9baac",
+ "size": 16457244,
+ "library": "libstable-diffusion.so",
+ "accelerators": [
+ "cpu"
+ ]
+ },
+ {
+ "target": "linux-x64",
+ "kind": "symbols",
+ "file": "stable-diffusion-native-symbols-linux-x64-v0.3.0-6.tar.gz",
+ "sha256": "e472cea84566d64328c37a4030f8d5d00f194edc7e95256b82322de98fd2b863",
+ "size": 16781322,
+ "library": "libstable-diffusion.so",
+ "accelerators": [
+ "cpu"
+ ]
+ },
+ {
+ "target": "linux-x64-vulkan",
+ "kind": "runtime",
+ "file": "stable-diffusion-native-runtime-linux-x64-vulkan-v0.3.0-6.tar.gz",
+ "sha256": "dda3969e18974ddd2dc110ca2576927548bcc0e9355932cd25249803ff1f816c",
+ "size": 26518552,
+ "library": "libstable-diffusion.so",
+ "accelerators": [
+ "vulkan",
+ "cpu"
+ ]
+ },
+ {
+ "target": "linux-x64-vulkan",
+ "kind": "symbols",
+ "file": "stable-diffusion-native-symbols-linux-x64-vulkan-v0.3.0-6.tar.gz",
+ "sha256": "9a15963e576e6bd6bbeb3e3bc32d392cefcbe12345099e894c4fca85ca05f171",
+ "size": 26926391,
+ "library": "libstable-diffusion.so",
+ "accelerators": [
+ "vulkan",
+ "cpu"
+ ]
+ },
+ {
+ "target": "linux-arm64",
+ "kind": "runtime",
+ "file": "stable-diffusion-native-runtime-linux-arm64-v0.3.0-6.tar.gz",
+ "sha256": "d394acffe3a9de8cc86abb4f1176f1bb1b5af5ed83efc013384e2b6e220d831f",
+ "size": 16023114,
+ "library": "libstable-diffusion.so",
+ "accelerators": [
+ "cpu"
+ ]
+ },
+ {
+ "target": "linux-arm64",
+ "kind": "symbols",
+ "file": "stable-diffusion-native-symbols-linux-arm64-v0.3.0-6.tar.gz",
+ "sha256": "935db7f5be47a5211062e2acf3798a839faaaf4378381f88bd14382aa4fa2991",
+ "size": 16369141,
+ "library": "libstable-diffusion.so",
+ "accelerators": [
+ "cpu"
+ ]
+ },
+ {
+ "target": "linux-arm64-vulkan",
+ "kind": "runtime",
+ "file": "stable-diffusion-native-runtime-linux-arm64-vulkan-v0.3.0-6.tar.gz",
+ "sha256": "d2412bc1ee28dd87a353d37181c060e1e0287d37ffc6c231dae5b3b399071dab",
+ "size": 26054424,
+ "library": "libstable-diffusion.so",
+ "accelerators": [
+ "vulkan",
+ "cpu"
+ ]
+ },
+ {
+ "target": "linux-arm64-vulkan",
+ "kind": "symbols",
+ "file": "stable-diffusion-native-symbols-linux-arm64-vulkan-v0.3.0-6.tar.gz",
+ "sha256": "91adc514a7dc323c35584bc81f95a3e35bec68c3d8f216b9db2042ce374773dc",
+ "size": 26484719,
+ "library": "libstable-diffusion.so",
+ "accelerators": [
+ "vulkan",
+ "cpu"
+ ]
+ },
+ {
+ "target": "windows-x64",
+ "kind": "runtime",
+ "file": "stable-diffusion-native-runtime-windows-x64-v0.3.0-6.tar.gz",
+ "sha256": "8da3d2d03634bcd9a76e52d84d92995a02b956ed697cc23e4303f45b3d1fdc5e",
+ "size": 15013952,
+ "library": "stable-diffusion.dll",
+ "accelerators": [
+ "cpu"
+ ]
+ },
+ {
+ "target": "windows-x64",
+ "kind": "symbols",
+ "file": "stable-diffusion-native-symbols-windows-x64-v0.3.0-6.tar.gz",
+ "sha256": "42cc4c3d8c57075a4773a2e9e40ea8ae40f360bcf308127fdae07f250200b651",
+ "size": 14990900,
+ "library": "stable-diffusion.dll",
+ "accelerators": [
+ "cpu"
+ ]
+ },
+ {
+ "target": "windows-x64-vulkan",
+ "kind": "runtime",
+ "file": "stable-diffusion-native-runtime-windows-x64-vulkan-v0.3.0-6.tar.gz",
+ "sha256": "eb15f8673c87cfbfd0a8a9f133dc96af1316bc1b58009e33f9f851e43b8d3d39",
+ "size": 27188745,
+ "library": "stable-diffusion.dll",
+ "accelerators": [
+ "vulkan",
+ "cpu"
+ ]
+ },
+ {
+ "target": "windows-x64-vulkan",
+ "kind": "symbols",
+ "file": "stable-diffusion-native-symbols-windows-x64-vulkan-v0.3.0-6.tar.gz",
+ "sha256": "231eb85108887ae72ea472ab0778fff1bcec1813bd2fbbe8049c2e7790b32ac9",
+ "size": 27167270,
+ "library": "stable-diffusion.dll",
+ "accelerators": [
+ "vulkan",
+ "cpu"
+ ]
+ },
+ {
+ "target": "apple",
+ "kind": "xcframework",
+ "file": "stable-diffusion-native-apple-xcframework-v0.3.0-6.zip",
+ "sha256": "7e5a79218d731ce7fb6b54020190a79630bd843d9a1dbafb24e5f0442ab95cb8",
+ "size": 82470620,
+ "library": "stable_diffusion.framework",
+ "accelerators": [
+ "metal",
+ "cpu"
+ ],
+ "slices": [
+ "ios-arm64",
+ "ios-arm64_x86_64-simulator",
+ "macos-arm64_x86_64"
+ ],
+ "minimumOS": {
+ "ios": "16.4",
+ "macos": "13.3"
+ }
+ }
+ ]
+}
diff --git a/test/unit/hook/build_hook_stable_diffusion_integration_test.dart b/test/unit/hook/build_hook_stable_diffusion_integration_test.dart
index abe765f25..423447bea 100644
--- a/test/unit/hook/build_hook_stable_diffusion_integration_test.dart
+++ b/test/unit/hook/build_hook_stable_diffusion_integration_test.dart
@@ -816,78 +816,80 @@ dependencies:
);
}
- test('accepts a locked companion pinning the earlier v0.3.0-3 XCFramework '
- 'with an upgrade warning', () async {
- final defines = await _flutterAppleApp(
- companions: const [_stableDiffusionCompanionName],
- editManifest: (manifest) => manifest
- .replaceFirst(
- 'let stableDiffusionTag = "$stableDiffusionReleaseTag"',
- 'let stableDiffusionTag = "v0.3.0-3"',
- )
- .replaceFirst(
- stableDiffusionAppleCompanionChecksums[stableDiffusionReleaseTag]!,
- stableDiffusionAppleCompanionChecksums['v0.3.0-3']!,
- ),
- );
- var emitted = false;
- final records = [];
- final subscription = Logger.root.onRecord.listen(
- (record) => records.add(record.message),
- );
- addTearDown(subscription.cancel);
- await project.testCodeBuildHook(
- mainMethod: build_hook.main,
- targetOS: OS.iOS,
- targetArchitecture: Architecture.arm64,
- targetIOSSdk: IOSSdk.iPhoneOS,
- userDefines: defines,
- check: (_, _) => emitted = true,
- );
- expect(emitted, isTrue);
- expect(
- records,
- contains(
- allOf(
- contains('leehack/stable-diffusion-native@v0.3.0-3'),
- contains(
- 'Its frameworks lack '
- '${stableDiffusionCompatibleAppleCompanionTags['v0.3.0-3']}.',
- ),
- contains(stableDiffusionReleaseTag),
- ),
- ),
- );
- });
-
- test('rejects a locked companion pinning v0.3.0-3 with another '
- 'checksum', () async {
- final defines = await _flutterAppleApp(
- companions: const [_stableDiffusionCompanionName],
- editManifest: (manifest) => manifest.replaceFirst(
- 'let stableDiffusionTag = "$stableDiffusionReleaseTag"',
- 'let stableDiffusionTag = "v0.3.0-3"',
- ),
- );
- await expectLater(
- project.testCodeBuildHook(
+ for (final earlier in stableDiffusionCompatibleAppleCompanionTags.keys) {
+ test('accepts a locked companion pinning the earlier $earlier XCFramework '
+ 'with an upgrade warning', () async {
+ final defines = await _flutterAppleApp(
+ companions: const [_stableDiffusionCompanionName],
+ editManifest: (manifest) => manifest
+ .replaceFirst(
+ 'let stableDiffusionTag = "$stableDiffusionReleaseTag"',
+ 'let stableDiffusionTag = "$earlier"',
+ )
+ .replaceFirst(
+ stableDiffusionAppleCompanionChecksums[stableDiffusionReleaseTag]!,
+ stableDiffusionAppleCompanionChecksums[earlier]!,
+ ),
+ );
+ var emitted = false;
+ final records = [];
+ final subscription = Logger.root.onRecord.listen(
+ (record) => records.add(record.message),
+ );
+ addTearDown(subscription.cancel);
+ await project.testCodeBuildHook(
mainMethod: build_hook.main,
targetOS: OS.iOS,
targetArchitecture: Architecture.arm64,
targetIOSSdk: IOSSdk.iPhoneOS,
userDefines: defines,
- check: (_, _) => fail('Must not emit in-process assets'),
- ),
- throwsA(
- predicate(
- (error) => error.toString().contains(
- 'Companion XCFramework checksum does not match the qualified '
- 'published artifact for v0.3.0-3',
+ check: (_, _) => emitted = true,
+ );
+ expect(emitted, isTrue);
+ expect(
+ records,
+ contains(
+ allOf(
+ contains('leehack/stable-diffusion-native@$earlier'),
+ contains(
+ 'Its frameworks lack '
+ '${stableDiffusionCompatibleAppleCompanionTags[earlier]}.',
+ ),
+ contains(stableDiffusionReleaseTag),
),
),
- ),
- );
- });
+ );
+ });
+
+ test('rejects a locked companion pinning $earlier with another '
+ 'checksum', () async {
+ final defines = await _flutterAppleApp(
+ companions: const [_stableDiffusionCompanionName],
+ editManifest: (manifest) => manifest.replaceFirst(
+ 'let stableDiffusionTag = "$stableDiffusionReleaseTag"',
+ 'let stableDiffusionTag = "$earlier"',
+ ),
+ );
+ await expectLater(
+ project.testCodeBuildHook(
+ mainMethod: build_hook.main,
+ targetOS: OS.iOS,
+ targetArchitecture: Architecture.arm64,
+ targetIOSSdk: IOSSdk.iPhoneOS,
+ userDefines: defines,
+ check: (_, _) => fail('Must not emit in-process assets'),
+ ),
+ throwsA(
+ predicate(
+ (error) => error.toString().contains(
+ 'Companion XCFramework checksum does not match the qualified '
+ 'published artifact for $earlier',
+ ),
+ ),
+ ),
+ );
+ });
+ }
// v0.3.0 grew sd_ctx_params_t: the bindings would overrun the
// allocation of a v0.2.0-4 runtime. The v0.3.0 runtime aborts on FP8
diff --git a/test/unit/hook/native_release_pins_test.dart b/test/unit/hook/native_release_pins_test.dart
index b2dd0a59c..67728cc6c 100644
--- a/test/unit/hook/native_release_pins_test.dart
+++ b/test/unit/hook/native_release_pins_test.dart
@@ -222,13 +222,13 @@ void main() {
},
);
- test('stable_diffusion pins the qualified v0.3.0-4 release artifacts', () {
+ test('stable_diffusion pins the published v0.3.0-6 release artifacts', () {
// Exact published owner manifest, independently checked against GitHub
// asset digests before adoption. This also binds the Apple binary target.
final manifest =
jsonDecode(
File(
- 'test/fixtures/native/stable_diffusion_v0_3_0_4_manifest.json',
+ 'test/fixtures/native/stable_diffusion_v0_3_0_6_manifest.json',
).readAsStringSync(),
)
as Map;
@@ -256,7 +256,7 @@ void main() {
final apple = artifacts.singleWhere(
(artifact) =>
artifact['file'] ==
- 'stable-diffusion-native-apple-xcframework-v0.3.0-4.zip',
+ 'stable-diffusion-native-apple-xcframework-v0.3.0-6.zip',
);
final swift = File(
'packages/llamadart_stable_diffusion_flutter/darwin/'
@@ -266,34 +266,41 @@ void main() {
expect(swift, contains(apple['sha256'] as String));
});
- // No older XCFramework is requalified: v0.3.0 aborts on FP8 weights on
- // Metal, and earlier pins have a smaller sd_ctx_params_t.
- test('the SD hook accepts only the pinned Apple companion artifact', () {
+ // Only checksum-proven older XCFrameworks are admitted; v0.3.0 aborts on
+ // FP8 weights on Metal, and earlier pins have a smaller sd_ctx_params_t.
+ test('the SD hook validates the current Apple companion artifact', () {
final manifest =
jsonDecode(
File(
- 'test/fixtures/native/stable_diffusion_v0_3_0_4_manifest.json',
+ 'test/fixtures/native/stable_diffusion_v0_3_0_6_manifest.json',
).readAsStringSync(),
)
as Map;
final apple = (manifest['artifacts'] as List)
.cast