Skip to content

armgit / kokon

Public Imported from GitHub
0

Edit photos by describing the change, on your own GPU. A free, open-source alternative to Nano Banana and ChatGPT image editing: photos stay on your computer, no daily limit. One installer for Windows, Mac and Linux sets up the best open model (Qwen-Image 2.1). MCP server for AI agents.

feat(engine): Kokon's own engines on every platform (kokon-992-dfaab76)

Gabriele Lozuponef5fbf1bfd4e3
diff --git a/crates/qls-core/src/catalog.rs b/crates/qls-core/src/catalog.rs
index 0dc78b8..8bd9a17 100644
--- a/crates/qls-core/src/catalog.rs
+++ b/crates/qls-core/src/catalog.rs
@@ -28,7 +28,7 @@ pub enum FileKind {
/// Release of the engine builds below. Written into [`ENGINE_MARKER`] after extraction, so an
/// engine of another release (files present, marker missing or different) is updated. A newer
/// release published in the engine manifest replaces these at runtime ([`engine_tag`]).
-pub const ENGINE_TAG: &str = "master-964-1d0a58a";
+pub const ENGINE_TAG: &str = "kokon-992-dfaab76";
/// File in an engine's folder naming the release it was extracted from.
pub const ENGINE_MARKER: &str = "kokon-engine.txt";
@@ -112,25 +112,33 @@ impl Download {
}
}
-/// Upstream release the CUDA runtime comes from (byte-identical in every release since).
+/// Kokon's engine release: every engine is built from branch `kokon` of Kokon's
+/// stable-diffusion.cpp fork (upstream plus the prompt enhancer's text generation and Kokon's
+/// fixes) by `.github/workflows/kokon.yml`, with upstream's flags otherwise. CUDA builds use CUDA
+/// graphs (ggml from Kokon's fork). Linux builds on Ubuntu 22.04 (smoke-tested on Ubuntu
+/// 22.04/24.04, Debian 12, Fedora 40/42); macOS for 15.0 (upstream's Mac zip needs macOS 26).
+/// Sizes and SHA-256 from GitHub's asset digests.
+const KOKON_RELEASE: &str = "https://github.com/GabrieleLozupone/stable-diffusion.cpp/releases/tag/kokon-992-dfaab76";
+/// Upstream release the Windows CUDA runtime comes from (CUDA 12.8.1, the version the engines
+/// are built with).
+#[cfg(not(target_os = "linux"))]
const SDCPP_UPSTREAM_RELEASE: &str = "https://github.com/leejet/stable-diffusion.cpp/releases/tag/master-929-3f8527a";
-const SDCPP_RELEASE: &str = "https://github.com/leejet/stable-diffusion.cpp/releases/tag/master-964-1d0a58a";
+/// Release the Linux CUDA runtime comes from (CUDA 12.8).
+#[cfg(target_os = "linux")]
+const KOKON_LINUX_RELEASE: &str = "https://github.com/GabrieleLozupone/stable-diffusion.cpp/releases/tag/kokon-linux-1d0a58a";
-/// Official stable-diffusion.cpp release master-964-1d0a58a (2026-10-13): the first with the
-/// MoSR upscaler merged (PR #2128, commit 792bcd3), plus automatic flash-attention and
-/// direct/implicit-GEMM convolution selection. CUDA 12 build; it runs on RTX 20xx to RTX 50xx.
-/// Sizes and SHA-256 from GitHub's asset digests.
+/// CUDA 12 build; it runs on GTX 10xx to RTX 50xx.
#[cfg(not(target_os = "linux"))]
pub const ENGINE_CUDA: Download = Download {
id: "engine_cuda",
label: "stable-diffusion.cpp (CUDA 12)",
kind: FileKind::Engine,
- url: "https://github.com/leejet/stable-diffusion.cpp/releases/download/master-964-1d0a58a/sd-master-1d0a58a-bin-win-cuda12-x64.zip",
+ url: "https://github.com/GabrieleLozupone/stable-diffusion.cpp/releases/download/kokon-992-dfaab76/sd-kokon-dfaab76-bin-win-cuda12-x64.zip",
fallback_urls: &[],
- page: SDCPP_RELEASE,
- size: 338_016_915,
- sha256: "2f08572e143f0b15a764197ea937d219dd70f0cc7eefb30eb84c9dae6a7cba6d",
- dest: "sd-master-1d0a58a-bin-win-cuda12-x64.zip",
+ page: KOKON_RELEASE,
+ size: WIN_CUDA_SIZE,
+ sha256: WIN_CUDA_SHA256,
+ dest: "sd-kokon-dfaab76-bin-win-cuda12-x64.zip",
provides: &["sd-server.exe", "stable-diffusion.dll", "ggml-cuda.dll"],
engine_tag: Some(ENGINE_TAG),
};
@@ -159,40 +167,35 @@ pub const ENGINE_VULKAN: Download = Download {
id: "engine_vulkan",
label: "stable-diffusion.cpp (Vulkan)",
kind: FileKind::Engine,
- url: "https://github.com/leejet/stable-diffusion.cpp/releases/download/master-964-1d0a58a/sd-master-1d0a58a-bin-win-vulkan-x64.zip",
+ url: "https://github.com/GabrieleLozupone/stable-diffusion.cpp/releases/download/kokon-992-dfaab76/sd-kokon-dfaab76-bin-win-vulkan-x64.zip",
fallback_urls: &[],
- page: SDCPP_RELEASE,
- size: 30_155_040,
- sha256: "74211cb5c382aec2aeb086b64f2fdf525efec5faec4200a2d3257bc2328954ab",
- dest: "engine-vulkan/sd-master-1d0a58a-bin-win-vulkan-x64.zip",
+ page: KOKON_RELEASE,
+ size: WIN_VULKAN_SIZE,
+ sha256: WIN_VULKAN_SHA256,
+ dest: "engine-vulkan/sd-kokon-dfaab76-bin-win-vulkan-x64.zip",
provides: &["engine-vulkan/sd-server.exe", "engine-vulkan/stable-diffusion.dll", "engine-vulkan/ggml-vulkan.dll"],
engine_tag: Some(ENGINE_TAG),
};
-/// Linux builds of the same commit, made by Kokon: upstream's Linux zips need glibc 2.38 (no
-/// Ubuntu 22.04 / Debian 12) and have no CUDA variant. Built on Ubuntu 22.04 with upstream's flags
-/// and CUDA architectures by `.github/workflows/kokon-linux.yml` on the kokon-linux branch of
-/// Kokon's stable-diffusion.cpp fork, smoke-tested on Ubuntu 22.04/24.04, Debian 12, Fedora 40/42.
-/// The libraries find each other and the CUDA runtime next to them (RPATH `$ORIGIN`).
-#[cfg(target_os = "linux")]
-const KOKON_LINUX_RELEASE: &str = "https://github.com/GabrieleLozupone/stable-diffusion.cpp/releases/tag/kokon-linux-1d0a58a";
-
+/// Linux builds (upstream's Linux zips need glibc 2.38 and have no CUDA variant). The libraries
+/// find each other and the CUDA runtime next to them (RPATH `$ORIGIN`).
#[cfg(target_os = "linux")]
pub const ENGINE_CUDA: Download = Download {
id: "engine_cuda",
label: "stable-diffusion.cpp (CUDA 12)",
kind: FileKind::Engine,
- url: "https://github.com/GabrieleLozupone/stable-diffusion.cpp/releases/download/kokon-linux-1d0a58a/sd-master-1d0a58a-bin-Linux-Ubuntu-22.04-x86_64-cuda12.zip",
+ url: "https://github.com/GabrieleLozupone/stable-diffusion.cpp/releases/download/kokon-992-dfaab76/sd-kokon-dfaab76-bin-Linux-Ubuntu-22.04-x86_64-cuda12.zip",
fallback_urls: &[],
- page: KOKON_LINUX_RELEASE,
+ page: KOKON_RELEASE,
size: LINUX_CUDA_SIZE,
sha256: LINUX_CUDA_SHA256,
- dest: "sd-master-1d0a58a-bin-Linux-Ubuntu-22.04-x86_64-cuda12.zip",
+ dest: "sd-kokon-dfaab76-bin-Linux-Ubuntu-22.04-x86_64-cuda12.zip",
provides: &["sd-server", "libstable-diffusion.so", "libggml-cuda.so"],
engine_tag: Some(ENGINE_TAG),
};
-/// CUDA 12.8 runtime libraries (NVIDIA redistributables), next to the CUDA engine.
+/// CUDA 12.8 runtime libraries (NVIDIA redistributables), next to the CUDA engine. Unchanged
+/// since kokon-linux-1d0a58a: no marker, never downloaded again.
#[cfg(target_os = "linux")]
pub const CUDA_RUNTIME: Download = Download {
id: "cuda_runtime",
@@ -201,8 +204,8 @@ pub const CUDA_RUNTIME: Download = Download {
url: "https://github.com/GabrieleLozupone/stable-diffusion.cpp/releases/download/kokon-linux-1d0a58a/cudart-sd-bin-linux-cu12-x64.zip",
fallback_urls: &[],
page: KOKON_LINUX_RELEASE,
- size: LINUX_CUDART_SIZE,
- sha256: LINUX_CUDART_SHA256,
+ size: 593_744_419,
+ sha256: "5b05f377ed203691ad22b471697efccd5c304ee0c6cc6f06c1acabcaa121f097",
dest: "cudart-sd-bin-linux-cu12-x64.zip",
provides: &["libcudart.so.12", "libcublas.so.12", "libcublasLt.so.12"],
engine_tag: None,
@@ -213,53 +216,51 @@ pub const ENGINE_VULKAN: Download = Download {
id: "engine_vulkan",
label: "stable-diffusion.cpp (Vulkan)",
kind: FileKind::Engine,
- url: "https://github.com/GabrieleLozupone/stable-diffusion.cpp/releases/download/kokon-linux-1d0a58a/sd-master-1d0a58a-bin-Linux-Ubuntu-22.04-x86_64-vulkan.zip",
+ url: "https://github.com/GabrieleLozupone/stable-diffusion.cpp/releases/download/kokon-992-dfaab76/sd-kokon-dfaab76-bin-Linux-Ubuntu-22.04-x86_64-vulkan.zip",
fallback_urls: &[],
- page: KOKON_LINUX_RELEASE,
+ page: KOKON_RELEASE,
size: LINUX_VULKAN_SIZE,
sha256: LINUX_VULKAN_SHA256,
- dest: "engine-vulkan/sd-master-1d0a58a-bin-Linux-Ubuntu-22.04-x86_64-vulkan.zip",
+ dest: "engine-vulkan/sd-kokon-dfaab76-bin-Linux-Ubuntu-22.04-x86_64-vulkan.zip",
provides: &["engine-vulkan/sd-server", "engine-vulkan/libstable-diffusion.so", "engine-vulkan/libggml-vulkan.so"],
engine_tag: Some(ENGINE_TAG),
};
-// From the kokon-linux-1d0a58a release (GitHub asset digests, 2026-10-16).
-#[cfg(target_os = "linux")]
-const LINUX_CUDA_SIZE: u64 = 346_387_087;
-#[cfg(target_os = "linux")]
-const LINUX_CUDA_SHA256: &str = "cda5ea4c6b2ef9fcee5dc73923e9f0bba3680f3aaf72b77e076fedd900b6d6fb";
-#[cfg(target_os = "linux")]
-const LINUX_CUDART_SIZE: u64 = 593_744_419;
-#[cfg(target_os = "linux")]
-const LINUX_CUDART_SHA256: &str = "5b05f377ed203691ad22b471697efccd5c304ee0c6cc6f06c1acabcaa121f097";
-#[cfg(target_os = "linux")]
-const LINUX_VULKAN_SIZE: u64 = 38_456_278;
-#[cfg(target_os = "linux")]
-const LINUX_VULKAN_SHA256: &str = "d998e8b831e9228571e7203020f503a3fea70b87f57ba5e0a106ae4e3afb7f60";
-
-/// Kokon's macOS build of the same commit (fork `kokon-linux`, workflow kokon-macos.yml): upstream's
-/// Mac zip declares macOS 26 as its minimum (built with the 26 SDK, no deployment target); this one
-/// is built for macOS 15 (#24), upstream's flags otherwise. Universal binary with the Metal shaders
-/// embedded. Ad-hoc signed; downloaded by the app (not a browser) it gets no quarantine flag.
-const KOKON_MACOS_RELEASE: &str = "https://github.com/GabrieleLozupone/stable-diffusion.cpp/releases/tag/kokon-macos-1d0a58a";
-
+/// macOS 15+, universal binary with the Metal shaders embedded. Ad-hoc signed; downloaded by the
+/// app (not a browser) it gets no quarantine flag.
pub const ENGINE_METAL: Download = Download {
id: "engine_metal",
label: "stable-diffusion.cpp (Metal)",
kind: FileKind::Engine,
- url: "https://github.com/GabrieleLozupone/stable-diffusion.cpp/releases/download/kokon-macos-1d0a58a/sd-master-1d0a58a-bin-Darwin-macOS-15.0-arm64.zip",
+ url: "https://github.com/GabrieleLozupone/stable-diffusion.cpp/releases/download/kokon-992-dfaab76/sd-kokon-dfaab76-bin-Darwin-macOS-15.0-universal.zip",
fallback_urls: &[],
- page: KOKON_MACOS_RELEASE,
+ page: KOKON_RELEASE,
size: MACOS_METAL_SIZE,
sha256: MACOS_METAL_SHA256,
- dest: "engine-metal/sd-master-1d0a58a-bin-Darwin-macOS-15.0-arm64.zip",
+ dest: "engine-metal/sd-kokon-dfaab76-bin-Darwin-macOS-15.0-universal.zip",
provides: &["engine-metal/sd-server", "engine-metal/libstable-diffusion.dylib"],
engine_tag: Some(ENGINE_TAG),
};
-// From the kokon-macos-1d0a58a release (run 38907832092, 2026-10-16: minos 15.0, Metal initialised on a macOS 15.7 runner).
-const MACOS_METAL_SIZE: u64 = 35_215_022;
-const MACOS_METAL_SHA256: &str = "d9b2d6885e0b0cdbdb5a1acd629cf0191e748c2806d3e529d4a6ae1a60bd207e";
+// From the kokon-992-dfaab76 release (GitHub asset digests, run 39228893955).
+#[cfg(not(target_os = "linux"))]
+const WIN_CUDA_SIZE: u64 = 343_689_852;
+#[cfg(not(target_os = "linux"))]
+const WIN_CUDA_SHA256: &str = "d4655d52d28cc8c60e01d11b6ef443671befad6731d68ff7bf75e56b5c324a10";
+#[cfg(not(target_os = "linux"))]
+const WIN_VULKAN_SIZE: u64 = 29_407_760;
+#[cfg(not(target_os = "linux"))]
+const WIN_VULKAN_SHA256: &str = "856310e71bec67a3323013d07af0cff48a73b915e2a95fe485070e9bfb8303f4";
+#[cfg(target_os = "linux")]
+const LINUX_CUDA_SIZE: u64 = 352_447_322;
+#[cfg(target_os = "linux")]
+const LINUX_CUDA_SHA256: &str = "6977f8d57acdc551bdaf3471aeca3076989717f16a8464ea0bfefbccab2adc65";
+#[cfg(target_os = "linux")]
+const LINUX_VULKAN_SIZE: u64 = 37_904_697;
+#[cfg(target_os = "linux")]
+const LINUX_VULKAN_SHA256: &str = "3a45ef1f2c4ea128d03edbcf162017fb1b6ff8bb2a8997a957a66879ba8b3842";
+const MACOS_METAL_SIZE: u64 = 36_587_314;
+const MACOS_METAL_SHA256: &str = "af7e6b376cca3cf86fffafc1efb48ddfc480bbf34364f6d648a3388dc7f1b07d";
/// The engine files of a backend, in download order: the engine manifest's release when one
/// newer than the built-in pins was applied ([`apply_engine_release`]), else the pins.
@@ -300,27 +301,31 @@ pub struct ManifestAsset {
pub sha256: String,
}
-/// `engine.json` in the Kokon repository: the newest stable-diffusion.cpp release tested
-/// with Kokon. Lets a tested engine reach users without an app release.
+/// A release of Kokon's engines (`kokon-<n>-<commit>` in Kokon's stable-diffusion.cpp fork).
#[derive(Debug, Clone, PartialEq, serde::Deserialize, Serialize)]
-pub struct EngineManifest {
- /// An upstream release tag, `master-<n>-<commit>`.
+pub struct KokonEngines {
pub tag: String,
/// Oldest app version the release works with (older apps ignore it).
pub min_app: String,
- pub cuda: ManifestAsset,
- pub vulkan: ManifestAsset,
- /// Upstream's Mac build (macOS 26+), for apps up to 0.9.3.
- pub metal: ManifestAsset,
- /// Kokon's macOS 15 build of the same commit (`kokon-macos-<commit>` in the fork), used by
- /// apps from 0.9.4. Without it Macs keep their pinned engine: upstream's needs macOS 26.
+ pub win_cuda: ManifestAsset,
+ pub win_vulkan: ManifestAsset,
+ pub linux_cuda: ManifestAsset,
+ pub linux_vulkan: ManifestAsset,
+ pub macos: ManifestAsset,
+}
+
+/// `engine.json` in the Kokon repository: the newest engine release tested with Kokon. Lets a
+/// tested engine reach users without an app release. Apps from 0.10 read only the `kokon` entry;
+/// the file's other keys (an upstream release) serve apps up to 0.9.4, which ignore this one.
+#[derive(Debug, Clone, Default, PartialEq, serde::Deserialize, Serialize)]
+pub struct EngineManifest {
#[serde(default, skip_serializing_if = "Option::is_none")]
- pub metal_macos15: Option<ManifestAsset>,
+ pub kokon: Option<KokonEngines>,
}
-/// Build number of an upstream release tag (`master-964-1d0a58a` -> 964).
+/// Build number of a Kokon engine release tag (`kokon-992-dfaab76` -> 992).
pub fn release_number(tag: &str) -> Option<u32> {
- tag.strip_prefix("master-")?.split('-').next()?.parse().ok()
+ tag.strip_prefix("kokon-")?.split('-').next()?.parse().ok()
}
fn version_tuple(v: &str) -> Option<(u32, u32, u32)> {
@@ -328,18 +333,18 @@ fn version_tuple(v: &str) -> Option<(u32, u32, u32)> {
Some((it.next()??, it.next()??, it.next().flatten().unwrap_or(0)))
}
-/// Uses `m` as the engine release when it is valid, meant for `app_version`, and newer than
-/// the built-in pins (an app update that pins a newer engine is never downgraded by an old
-/// manifest). Returns whether it is now in use.
+/// Uses the manifest's Kokon release as the engine release when it is valid, meant for
+/// `app_version`, and newer than the built-in pins (an app update that pins a newer engine is
+/// never downgraded by an old manifest). Returns whether it is now in use.
pub fn apply_engine_release(m: &EngineManifest, app_version: &str) -> Result<bool, String> {
- // The manifest lists upstream's Windows and Mac builds; Linux keeps Kokon's own pinned build.
- if cfg!(target_os = "linux") {
+ let Some(k) = &m.kokon else {
+ *ENGINE_OVERRIDE.write().unwrap() = None;
return Ok(false);
- }
- let (Some(n), Some(builtin)) = (release_number(&m.tag), release_number(ENGINE_TAG)) else {
- return Err(format!("not an upstream release tag: {}", m.tag));
};
- if version_tuple(app_version) < version_tuple(&m.min_app) || version_tuple(&m.min_app).is_none() {
+ let (Some(n), Some(builtin)) = (release_number(&k.tag), release_number(ENGINE_TAG)) else {
+ return Err(format!("not a Kokon engine release tag: {}", k.tag));
+ };
+ if version_tuple(app_version) < version_tuple(&k.min_app) || version_tuple(&k.min_app).is_none() {
return Ok(false);
}
if n <= builtin {
@@ -347,33 +352,27 @@ pub fn apply_engine_release(m: &EngineManifest, app_version: &str) -> Result<boo
return Ok(false);
}
let leak = |s: String| -> &'static str { Box::leak(s.into_boxed_str()) };
- let tag = leak(m.tag.clone());
- let upstream = format!("https://github.com/leejet/stable-diffusion.cpp/releases/download/{}/", m.tag);
- let upstream_page = leak(format!("https://github.com/leejet/stable-diffusion.cpp/releases/tag/{}", m.tag));
- let commit = m.tag.rsplit('-').next().unwrap_or_default();
- let kokon = format!("https://github.com/GabrieleLozupone/stable-diffusion.cpp/releases/download/kokon-macos-{commit}/");
- let kokon_page = leak(format!("https://github.com/GabrieleLozupone/stable-diffusion.cpp/releases/tag/kokon-macos-{commit}"));
- let build = |a: &ManifestAsset, base: Download, folder: &str, prefix: &str, page: &'static str| -> Result<Download, String> {
- let file = a.url.strip_prefix(prefix).filter(|f| !f.is_empty() && !f.contains(['/', '\\'])).ok_or_else(|| format!("unexpected engine URL: {}", a.url))?;
+ let tag = leak(k.tag.clone());
+ let commit = k.tag.rsplit('-').next().unwrap_or_default();
+ let release = format!("https://github.com/GabrieleLozupone/stable-diffusion.cpp/releases/download/{}/", k.tag);
+ let page = leak(format!("https://github.com/GabrieleLozupone/stable-diffusion.cpp/releases/tag/{}", k.tag));
+ let prefix = format!("sd-kokon-{commit}-bin-");
+ let build = |a: &ManifestAsset, base: Download, folder: &str| -> Result<Download, String> {
+ let file = a
+ .url
+ .strip_prefix(&release)
+ .filter(|f| f.starts_with(&prefix) && f.ends_with(".zip") && !f.contains(['/', '\\']))
+ .ok_or_else(|| format!("unexpected engine URL: {}", a.url))?;
if a.sha256.len() != 64 || !a.sha256.chars().all(|c| c.is_ascii_hexdigit() && !c.is_ascii_uppercase()) || a.size == 0 {
return Err(format!("bad size or SHA-256 for {}", a.url));
}
Ok(Download { url: leak(a.url.clone()), page, size: a.size, sha256: leak(a.sha256.clone()), dest: leak(format!("{folder}{file}")), engine_tag: Some(tag), ..base })
};
- let cuda = build(&m.cuda, ENGINE_CUDA, "", &upstream, upstream_page)?;
- let vulkan = build(&m.vulkan, ENGINE_VULKAN, "engine-vulkan/", &upstream, upstream_page)?;
- let upstream_metal = build(&m.metal, ENGINE_METAL, "engine-metal/", &upstream, upstream_page)?;
- let metal15 = m.metal_macos15.as_ref().map(|a| build(a, ENGINE_METAL, "engine-metal/", &kokon, kokon_page)).transpose()?;
- let metal = if cfg!(target_os = "macos") {
- // Macs run only Kokon's macOS 15 builds: no such build, no engine update.
- let Some(metal) = metal15 else {
- *ENGINE_OVERRIDE.write().unwrap() = None;
- return Ok(false);
- };
- metal
- } else {
- upstream_metal
- };
+ // Every build is checked, whatever the platform: a manifest is good or ignored as a whole.
+ let win = (build(&k.win_cuda, ENGINE_CUDA, "")?, build(&k.win_vulkan, ENGINE_VULKAN, "engine-vulkan/")?);
+ let linux = (build(&k.linux_cuda, ENGINE_CUDA, "")?, build(&k.linux_vulkan, ENGINE_VULKAN, "engine-vulkan/")?);
+ let metal = build(&k.macos, ENGINE_METAL, "engine-metal/")?;
+ let (cuda, vulkan) = if cfg!(target_os = "linux") { linux } else { win };
*ENGINE_OVERRIDE.write().unwrap() = Some(EngineRelease { tag, cuda, vulkan, metal });
Ok(true)
}
@@ -798,60 +797,67 @@ mod tests {
fn manifest(n: u32) -> EngineManifest {
let asset = |f: &str| ManifestAsset {
- url: format!("https://github.com/leejet/stable-diffusion.cpp/releases/download/master-{n}-abcdef0/sd-master-abcdef0-bin-{f}.zip"),
+ url: format!("https://github.com/GabrieleLozupone/stable-diffusion.cpp/releases/download/kokon-{n}-abcdef0/sd-kokon-abcdef0-bin-{f}.zip"),
size: 1,
sha256: "0".repeat(64),
};
- EngineManifest { tag: format!("master-{n}-abcdef0"), min_app: "0.9.2".into(), cuda: asset("win-cuda12-x64"), vulkan: asset("win-vulkan-x64"), metal: asset("Darwin-macOS-26.6.2-arm64"), metal_macos15: Some(ManifestAsset {
- url: "https://github.com/GabrieleLozupone/stable-diffusion.cpp/releases/download/kokon-macos-abcdef0/sd-master-abcdef0-bin-Darwin-macOS-15.0-arm64.zip".into(),
- size: 1,
- sha256: "1".repeat(64),
- }) }
+ EngineManifest {
+ kokon: Some(KokonEngines {
+ tag: format!("kokon-{n}-abcdef0"),
+ min_app: "0.10.0".into(),
+ win_cuda: asset("win-cuda12-x64"),
+ win_vulkan: asset("win-vulkan-x64"),
+ linux_cuda: asset("Linux-Ubuntu-22.04-x86_64-cuda12"),
+ linux_vulkan: asset("Linux-Ubuntu-22.04-x86_64-vulkan"),
+ macos: asset("Darwin-macOS-15.0-universal"),
+ }),
+ }
+ }
+
+ fn edit(n: u32, f: impl FnOnce(&mut KokonEngines)) -> EngineManifest {
+ let mut m = manifest(n);
+ f(m.kokon.as_mut().unwrap());
+ m
}
#[test]
- #[cfg(not(target_os = "linux"))]
fn engine_manifest_overrides_only_newer_releases() {
let _guard = ENGINE_TEST_LOCK.lock().unwrap_or_else(|e| e.into_inner());
- assert_eq!(release_number(ENGINE_TAG), Some(964));
- assert_eq!(apply_engine_release(&manifest(964), "0.9.2"), Ok(false), "same as built in");
+ assert_eq!(release_number(ENGINE_TAG), Some(992));
+ assert_eq!(apply_engine_release(&manifest(992), "0.10.0"), Ok(false), "same as built in");
assert_eq!(engine_tag(), ENGINE_TAG);
- assert_eq!(apply_engine_release(&manifest(970), "0.9.1"), Ok(false), "too old an app");
- assert_eq!(apply_engine_release(&manifest(970), "0.9.2"), Ok(true));
- assert_eq!(engine_tag(), "master-970-abcdef0");
+ assert_eq!(apply_engine_release(&manifest(1000), "0.9.4"), Ok(false), "too old an app");
+ assert_eq!(apply_engine_release(&manifest(1000), "0.10.0"), Ok(true));
+ assert_eq!(engine_tag(), "kokon-1000-abcdef0");
let cuda = &engine_downloads(GpuBackend::Cuda);
- assert_eq!(cuda[0].engine_tag, Some("master-970-abcdef0"));
- assert_eq!(cuda[0].dest, "sd-master-abcdef0-bin-win-cuda12-x64.zip");
+ assert_eq!(cuda[0].engine_tag, Some("kokon-1000-abcdef0"));
assert_eq!(cuda[0].provides, ENGINE_CUDA.provides);
+ assert!(cuda[0].page.ends_with("/kokon-1000-abcdef0"));
assert_eq!(cuda[1].id, "cuda_runtime");
- assert_eq!(engine_downloads(GpuBackend::Vulkan)[0].dest, "engine-vulkan/sd-master-abcdef0-bin-win-vulkan-x64.zip");
- let metal = engine_downloads(GpuBackend::Metal)[0];
- if cfg!(target_os = "macos") {
- // Kokon's macOS 15 build, never upstream's (macOS 26).
- assert_eq!(metal.dest, "engine-metal/sd-master-abcdef0-bin-Darwin-macOS-15.0-arm64.zip");
- assert!(metal.page.ends_with("/kokon-macos-abcdef0"));
+ let vulkan = engine_downloads(GpuBackend::Vulkan)[0];
+ if cfg!(target_os = "linux") {
+ assert_eq!(cuda[0].dest, "sd-kokon-abcdef0-bin-Linux-Ubuntu-22.04-x86_64-cuda12.zip");
+ assert_eq!(vulkan.dest, "engine-vulkan/sd-kokon-abcdef0-bin-Linux-Ubuntu-22.04-x86_64-vulkan.zip");
} else {
- assert_eq!(metal.dest, "engine-metal/sd-master-abcdef0-bin-Darwin-macOS-26.6.2-arm64.zip");
+ assert_eq!(cuda[0].dest, "sd-kokon-abcdef0-bin-win-cuda12-x64.zip");
+ assert_eq!(vulkan.dest, "engine-vulkan/sd-kokon-abcdef0-bin-win-vulkan-x64.zip");
}
- // Only official release downloads of that tag, with a real hash.
- let mut bad = manifest(971);
- bad.cuda.url = "https://example.com/sd.zip".into();
- assert!(apply_engine_release(&bad, "0.9.2").is_err());
- let mut bad = manifest(971);
- bad.metal.sha256 = "xyz".into();
- assert!(apply_engine_release(&bad, "0.9.2").is_err());
- assert!(apply_engine_release(&EngineManifest { tag: "kokon-x".into(), ..manifest(971) }, "0.9.2").is_err());
- assert_eq!(engine_tag(), "master-970-abcdef0", "a bad manifest keeps the last good release");
- // Kokon's macOS 15 build must come from the fork release of the same commit.
- let mut bad = manifest(971);
- bad.metal_macos15.as_mut().unwrap().url = "https://github.com/GabrieleLozupone/stable-diffusion.cpp/releases/download/kokon-macos-1234567/x.zip".into();
- assert!(apply_engine_release(&bad, "0.9.2").is_err(), "another commit's build");
- // A manifest without it (written for apps up to 0.9.3) updates PCs; Macs keep their pin.
- let old = EngineManifest { metal_macos15: None, ..manifest(972) };
- assert!(!serde_json::to_string(&old).unwrap().contains("metal_macos15"));
- assert_eq!(apply_engine_release(&old, "0.9.2"), Ok(!cfg!(target_os = "macos")));
+ assert_eq!(engine_downloads(GpuBackend::Metal)[0].dest, "engine-metal/sd-kokon-abcdef0-bin-Darwin-macOS-15.0-universal.zip");
+ // Only that release's downloads in the fork, with a real hash; any bad build rejects it all.
+ assert!(apply_engine_release(&edit(1001, |k| k.win_cuda.url = "https://example.com/sd.zip".into()), "0.10.0").is_err());
+ assert!(apply_engine_release(&edit(1001, |k| k.macos.sha256 = "xyz".into()), "0.10.0").is_err());
+ let other_commit = "https://github.com/GabrieleLozupone/stable-diffusion.cpp/releases/download/kokon-1001-abcdef0/sd-kokon-1234567-bin-win-vulkan-x64.zip";
+ assert!(apply_engine_release(&edit(1001, |k| k.linux_vulkan.url = other_commit.into()), "0.10.0").is_err(), "another commit's build");
+ assert!(apply_engine_release(&edit(1001, |k| k.tag = "master-1001-abcdef0".into()), "0.10.0").is_err());
+ assert_eq!(engine_tag(), "kokon-1000-abcdef0", "a bad manifest keeps the last good release");
// An app that pins a newer engine drops an older manifest release.
- assert_eq!(apply_engine_release(&manifest(960), "0.9.2"), Ok(false));
+ assert_eq!(apply_engine_release(&manifest(980), "0.10.0"), Ok(false));
+ assert_eq!(engine_tag(), ENGINE_TAG);
+ // engine.json as published: the upstream keys for apps up to 0.9.4 next to Kokon's.
+ let json = include_str!("../../../engine.json");
+ let m: EngineManifest = serde_json::from_str(json).unwrap();
+ assert!(apply_engine_release(&m, "0.10.0").is_ok());
+ assert_eq!(apply_engine_release(&EngineManifest::default(), "0.10.0"), Ok(false));
assert_eq!(engine_tag(), ENGINE_TAG);
}
diff --git a/crates/qls-core/src/engine_manifest.rs b/crates/qls-core/src/engine_manifest.rs
index 0c474f1..d3e3eff 100644
--- a/crates/qls-core/src/engine_manifest.rs
+++ b/crates/qls-core/src/engine_manifest.rs
@@ -39,7 +39,7 @@ fn read_cache() -> Option<Cached> {
fn apply(m: &EngineManifest, app_version: &str) {
match catalog::apply_engine_release(m, app_version) {
- Ok(true) => tracing::info!("engine manifest: release {} available", m.tag),
+ Ok(true) => tracing::info!("engine manifest: release {} available", m.kokon.as_ref().map_or("", |k| k.tag.as_str())),
Ok(false) => {}
Err(e) => tracing::warn!("engine manifest ignored: {e}"),
}
diff --git a/docs/engineering-notes.md b/docs/engineering-notes.md
index 188f956..10f9a63 100644
--- a/docs/engineering-notes.md
+++ b/docs/engineering-notes.md
@@ -141,14 +141,18 @@ merged upstream as PR #2128 on 2026-10-12; since 0.9.2 the engine is the officia
#### Engine updates (`engine.json`)
-`engine.json` at the repository root names the newest official release tested with Kokon
-(tag, `min_app`, URL + size + SHA-256 of the CUDA, Vulkan and Metal zips). The service reads its
-cached copy at start and fetches it again when older than 2.5 days (`engine_manifest.rs`). A
-valid release newer than the built-in pin (`catalog::ENGINE_TAG`) replaces the engine
-downloads, so the status reports `engine.update_needed` and What's new offers the download.
-Only `https://github.com/leejet/stable-diffusion.cpp/releases/download/<tag>/` URLs are
-accepted. To ship an engine: test the release on Windows (CUDA + Vulkan) and a Mac, then edit
-`engine.json` on master (digests: `gh api repos/leejet/stable-diffusion.cpp/releases/tags/<tag>`).
+`engine.json` at the repository root names the newest engine release tested with Kokon. Since
+0.10 every engine is Kokon's own build (fork branch `kokon`, workflow `kokon.yml`, release
+`kokon-<n>-<commit>`; see docs/prompt-enhancer.md), listed under the `kokon` key: tag, `min_app`,
+URL + size + SHA-256 of `win_cuda`, `win_vulkan`, `linux_cuda`, `linux_vulkan`, `macos`. The
+file's other keys are an upstream release for apps up to 0.9.4, which ignore `kokon`. The service
+reads its cached copy at start and fetches it again when older than 2.5 days
+(`engine_manifest.rs`). A valid release newer than the built-in pin (`catalog::ENGINE_TAG`)
+replaces the engine downloads, so the status reports `engine.update_needed` and What's new offers
+the download. Only `sd-kokon-<commit>-bin-*.zip` files of that tag in the fork are accepted, and a
+manifest with any bad entry is ignored as a whole. To ship an engine: run the workflow with
+`create_release`, test on Windows (CUDA + Vulkan), Linux and a Mac, then edit `engine.json` on master
+(digests: `gh release view <tag> -R GabrieleLozupone/stable-diffusion.cpp --json assets`).
Since master-964 `--fa` and `--diffusion-conv-direct` are deprecated aliases (still accepted, so
older engines keep working); convolutions default to `auto`, which turns implicit-GEMM direct
convolutions on for CUDA (RTX 20xx+) and Vulkan, VAE included.
diff --git a/docs/linux.md b/docs/linux.md
index e5e0f11..9c5f5b0 100644
--- a/docs/linux.md
+++ b/docs/linux.md
@@ -45,9 +45,10 @@ upstream's own flags and CUDA architectures (`61;70;75;80;86;89;90;100;120`, CUD
`$ORIGIN`) and `SHA256SUMS.txt`.
- The app pins these in `crates/qls-core/src/catalog.rs` (`#[cfg(target_os = "linux")]` versions of
`ENGINE_CUDA`, `CUDA_RUNTIME`, `ENGINE_VULKAN`, plus `LINUX_*_SIZE/SHA256`).
-- `engine.json` (engine updates without an app release) lists upstream's Windows/Mac builds only, so
- **Linux ignores it** (`apply_engine_release` returns early). Linux engines change with app releases
- until the manifest gets Linux entries (to do, below).
+- **Since 0.10** the engines come from the single workflow `kokon.yml` on fork branch `kokon` (release
+ `kokon-<n>-<commit>`, every platform), and `engine.json` has Linux entries (`kokon.linux_cuda`,
+ `kokon.linux_vulkan`), so Linux gets engine updates without an app release. The CUDA runtime stays
+ pinned to `kokon-linux-1d0a58a`. The `kokon-linux` branch and its releases serve apps up to 0.9.4.
- First build: run 38885751650 (2026-10-16): Vulkan 12 min, CUDA 1 h 32 min. Its CUDA smoke test was
wrong (sd-server links libcuda.so.1, which only the NVIDIA driver provides, so it can't start in CI);
the release was published by hand from that run's artifacts after a real check in WSL (RTX 5070 Ti
@@ -56,6 +57,9 @@ upstream's own flags and CUDA architectures (`61;70;75;80;86;89;90;100;120`, CUD
## Engine upkeep: check at every release (and when engine.json moves)
+> Up to 0.9.4. From 0.10 the fork branch `kokon` (one workflow, every platform) replaces the steps
+> below: rebase it on upstream, update `UPSTREAM_BASE` in `kokon.yml`, run it with `create_release`.
+
Upstream moves fast (2026-10-16: master-968-8cd731e, 4 commits after our 1d0a58a, including a Vulkan
direct-convolution fix and FLUX.3 Klein). When Windows/Mac move to a newer engine, Linux must follow:
@@ -118,7 +122,7 @@ To do for 0.9.4 (Linux + fixes for every platform)
the server mode.
Later
-- [ ] engine.json Linux entries (fork URLs) so Linux gets engine updates without an app release.
+- [x] engine.json Linux entries (fork URLs) so Linux gets engine updates without an app release (0.10, `kokon` key).
- [ ] Real-hardware reports: AMD on Linux (swingtempo R9700, alean200), a non-WSL NVIDIA machine.
- [ ] AppImage? Not planned (large, and deb/rpm cover the main distros).
- [ ] Steps 2 and 3 of the plan above.
diff --git a/engine.json b/engine.json
index a3993bb..689dd50 100644
--- a/engine.json
+++ b/engine.json
@@ -20,5 +20,34 @@
"url": "https://github.com/GabrieleLozupone/stable-diffusion.cpp/releases/download/kokon-macos-1d0a58a/sd-master-1d0a58a-bin-Darwin-macOS-15.0-arm64.zip",
"size": 35215022,
"sha256": "d9b2d6885e0b0cdbdb5a1acd629cf0191e748c2806d3e529d4a6ae1a60bd207e"
+ },
+ "kokon": {
+ "tag": "kokon-992-dfaab76",
+ "min_app": "0.10.0",
+ "win_cuda": {
+ "url": "https://github.com/GabrieleLozupone/stable-diffusion.cpp/releases/download/kokon-992-dfaab76/sd-kokon-dfaab76-bin-win-cuda12-x64.zip",
+ "size": 343689852,
+ "sha256": "d4655d52d28cc8c60e01d11b6ef443671befad6731d68ff7bf75e56b5c324a10"
+ },
+ "win_vulkan": {
+ "url": "https://github.com/GabrieleLozupone/stable-diffusion.cpp/releases/download/kokon-992-dfaab76/sd-kokon-dfaab76-bin-win-vulkan-x64.zip",
+ "size": 29407760,
+ "sha256": "856310e71bec67a3323013d07af0cff48a73b915e2a95fe485070e9bfb8303f4"
+ },
+ "linux_cuda": {
+ "url": "https://github.com/GabrieleLozupone/stable-diffusion.cpp/releases/download/kokon-992-dfaab76/sd-kokon-dfaab76-bin-Linux-Ubuntu-22.04-x86_64-cuda12.zip",
+ "size": 352447322,
+ "sha256": "6977f8d57acdc551bdaf3471aeca3076989717f16a8464ea0bfefbccab2adc65"
+ },
+ "linux_vulkan": {
+ "url": "https://github.com/GabrieleLozupone/stable-diffusion.cpp/releases/download/kokon-992-dfaab76/sd-kokon-dfaab76-bin-Linux-Ubuntu-22.04-x86_64-vulkan.zip",
+ "size": 37904697,
+ "sha256": "3a45ef1f2c4ea128d03edbcf162017fb1b6ff8bb2a8997a957a66879ba8b3842"
+ },
+ "macos": {
+ "url": "https://github.com/GabrieleLozupone/stable-diffusion.cpp/releases/download/kokon-992-dfaab76/sd-kokon-dfaab76-bin-Darwin-macOS-15.0-universal.zip",
+ "size": 36587314,
+ "sha256": "af7e6b376cca3cf86fffafc1efb48ddfc480bbf34364f6d648a3388dc7f1b07d"
+ }
}
}