AI media harness for planning, generating, and editing locally
TypeScript
Log VAE decode phase timings
Bitti25991b3a90b7
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.mdindex 7ee3f9c..1df772e 100644--- a/RELEASE_NOTES.md+++ b/RELEASE_NOTES.md@@ -4,6 +4,7 @@ This alpha update adds LAN generation workers, Linux support, expanded color gra## What's new+- Generation diagnostics now separate VAE model opening, weight loading, decoding and cleanup times to help identify intermittent image-generation slowdowns.- Added Long Shot scenes: generate alternating fresh clips and latent bridges in 1 → 3 → 2 → 5 → 4 order. Bridge controls set how much of the neighboring ending and beginning may change, with joined video and audio used in preview and export. Includes updated Windows/Linux runtimes and LAN worker support; update workers alongside the app.- Video and image generation headers now show the effective step count from the selected generator's active LoRAs, including fixed sampling schedules.- Added Backdrop scenes to generate subjects and action against a selected green, blue, black or white background. Chroma Key now offers matching backdrop modes and automatic border detection, with matte levels, background color removal, despill, shadow removal, edge softness, choke/grow and small-speck/hole cleanup in GPU preview and export.diff --git a/docs/slopfab-compatibility.md b/docs/slopfab-compatibility.mdindex 18fdbce..dcf45e4 100644--- a/docs/slopfab-compatibility.md+++ b/docs/slopfab-compatibility.md@@ -1,5 +1,27 @@# Slopfab compatibility+## API 1.27: decode diagnostics++Successful native generations write an INFO-level `generation.video_decode`+entry to `slopus.log`, with the job ID, runtime version, backend, still-image+flag, output dimensions/frame count and total decode seconds. The `timings`+object contains `secondsPrepare`, `secondsUpscale`, `secondsModelOpen`,+`secondsWeightLoad`, `secondsCompute` and `secondsCleanup`.++Model open covers the file mapping and normalization statistics; weight load+covers decoder/device creation and loading the VAE. Compute includes workspace+allocations, transfers, kernels and tile assembly. Cleanup is the remainder,+including decoder destruction, temporary buffers, mapping teardown and minor+instrumentation overhead. These wall times sum to the total; the measurement+adds no GPU synchronization. Timings are per decode, so multi-edit images log+one entry for each edit under the same job ID. LAN generations log on the worker.++Slopus optionally loads `slopfab_generation_video_decode_timings`, leaving the+existing output ABI unchanged. Older runtimes retain aggregate timing, and a+diagnostic getter failure logs a warning without discarding generated media.+Both bundled runtimes include the new getter. Restart/rebuild the running app+to load the new library and logging code.+## API 1.26: Long Shot latent bridgesConsecutive **Long Shot** scenes alternate fresh anchors and bridges. Generatediff --git a/lib/slopfab/libslopfab.so b/lib/slopfab/libslopfab.soindex 252c8ac..219b0d3 100644--- a/lib/slopfab/libslopfab.so+++ b/lib/slopfab/libslopfab.so@@ -1,3 +1,3 @@version https://git-lfs.github.com/spec/v1-oid sha256:6b0b04b1f5275477e984cc8bad939423bbacc296beb8134f9c0612404356a431-size 20354384+oid sha256:5743ac829bf88917d84a1610f92bec856eb3d34987c1e4beb43c389e9a1a2e19+size 20346328diff --git a/lib/slopfab/slopfab.dll b/lib/slopfab/slopfab.dllindex fa4be4a..d1267fb 100644--- a/lib/slopfab/slopfab.dll+++ b/lib/slopfab/slopfab.dll@@ -1,3 +1,3 @@version https://git-lfs.github.com/spec/v1-oid sha256:3837d329a919532988526ab8fa5fab93eb609ad91b4c05bcc4059375b5de37c3-size 17639936+oid sha256:85d069dfa6f3676b99111b17c1ae0aa51f66f0247f53fbda2f2aebecb0023222+size 17640960diff --git a/src-tauri/core/src/slopfab/ffi/handles.rs b/src-tauri/core/src/slopfab/ffi/handles.rsindex 5b56e85..9369bfb 100644--- a/src-tauri/core/src/slopfab/ffi/handles.rs+++ b/src-tauri/core/src/slopfab/ffi/handles.rs@@ -125,6 +125,9 @@ pub struct Output {}impl FinishedGeneration {+ pub fn video_decode_timings(&self) -> Result<Option<super::VideoDecodeTimings>, String> {+ self.0.api.inner.video_decode_timings(self.0.pointer.as_ptr())+ }pub fn output(&self) -> Result<Output, String> {let value = self.0.api.inner.output(self.0.pointer.as_ptr())?;if value.audio_float_count > isize::MAX as usize / std::mem::size_of::<f32>()diff --git a/src-tauri/core/src/slopfab/ffi/mod.rs b/src-tauri/core/src/slopfab/ffi/mod.rsindex 8508627..34cdd01 100644--- a/src-tauri/core/src/slopfab/ffi/mod.rs+++ b/src-tauri/core/src/slopfab/ffi/mod.rs@@ -4,6 +4,7 @@ mod raw;mod tests;pub use handles::{FinishedGeneration, GenerationHandle, ProgressSink, Output};pub use raw::{cuda_device_names, gpu_devices, has_cuda_device, Plan, Progress};+pub use raw::VideoDecodeTimings;use std::{path::{Path, PathBuf},ptr::NonNull,diff --git a/src-tauri/core/src/slopfab/ffi/raw/lifecycle_tests.rs b/src-tauri/core/src/slopfab/ffi/raw/lifecycle_tests.rsindex d2925a7..531c7bd 100644--- a/src-tauri/core/src/slopfab/ffi/raw/lifecycle_tests.rs+++ b/src-tauri/core/src/slopfab/ffi/raw/lifecycle_tests.rs@@ -83,6 +83,7 @@ fn fixture(release_supported: bool) -> (OwnedApi, SharedTrace) {raw.generation_wait = wait;raw.generation_cancel = cancel;raw.generation_output = output;+ raw.generation_video_decode_timings = None;raw.generation_frame_rgba8 = frame;raw.generation_error = error;raw.generation_release_samples = release_supported.then_some(release);@@ -150,9 +151,34 @@ fn destruction_is_unconditional_when_release_is_missing_or_fails() {}}+#[test]+fn decode_timing_accessor_preserves_fields_and_supports_older_runtimes() {+ unsafe extern "C" fn timing(_: *const Generation, out: *mut VideoDecodeTimings) -> i32 {+ unsafe { *out = VideoDecodeTimings { seconds_prepare: 1.0, seconds_upscale: 2.0, seconds_model_open: 3.0,+ seconds_weight_load: 4.0, seconds_compute: 5.0, seconds_cleanup: 6.0 }; }+ 0+ }+ for supported in [false, true] {+ let (mut api, _) = fixture(true);+ Arc::get_mut(&mut api.inner).unwrap().generation_video_decode_timings = supported.then_some(timing);+ let mut generation = RequestHandle::new(&api).unwrap().start(None).unwrap();+ generation.wait(-1).unwrap();+ let generation = generation.finish().unwrap();+ let timings = generation.video_decode_timings().unwrap();+ assert_eq!(timings.is_some(), supported);+ if let Some(timings) = timings {+ assert_eq!(serde_json::to_value(timings).unwrap(), serde_json::json!({+ "secondsPrepare": 1.0, "secondsUpscale": 2.0, "secondsModelOpen": 3.0,+ "secondsWeightLoad": 4.0, "secondsCompute": 5.0, "secondsCleanup": 6.0,+ }));+ }+ }+}+#[test]fn bundled_runtime_exports_sample_release() {let path = Path::new(env!("CARGO_MANIFEST_DIR")).join("../../lib/slopfab").join(crate::slopfab::DLL_FILE_NAME);let api = Api::load(&path).unwrap();assert!(api.generation_release_samples.is_some());+ assert!(api.generation_video_decode_timings.is_some());}diff --git a/src-tauri/core/src/slopfab/ffi/raw/mod.rs b/src-tauri/core/src/slopfab/ffi/raw/mod.rsindex 1d96a28..ca3f5f4 100644--- a/src-tauri/core/src/slopfab/ffi/raw/mod.rs+++ b/src-tauri/core/src/slopfab/ffi/raw/mod.rs@@ -12,6 +12,17 @@ pub use device::{cuda_device_names, gpu_devices, has_cuda_device};pub use reference_video::ReferenceVideoHandle;pub enum Generation {}#[repr(C)]+#[derive(Debug, Clone, Copy, Default, serde::Serialize)]+#[serde(rename_all = "camelCase")]+pub struct VideoDecodeTimings {+ pub seconds_prepare: f64,+ pub seconds_upscale: f64,+ pub seconds_model_open: f64,+ pub seconds_weight_load: f64,+ pub seconds_compute: f64,+ pub seconds_cleanup: f64,+}+#[repr(C)]#[derive(Clone, Copy)]pub struct Plan {pub canvas_width: i32,@@ -115,6 +126,7 @@ pub struct Api {generation_wait: unsafe extern "C" fn(*mut Generation, i32) -> i32,generation_error: unsafe extern "C" fn(*const Generation) -> *const c_char,generation_output: unsafe extern "C" fn(*const Generation, *mut Output) -> i32,+ generation_video_decode_timings: Option<unsafe extern "C" fn(*const Generation, *mut VideoDecodeTimings) -> i32>,generation_frame_rgba8: unsafe extern "C" fn(*const Generation, i32, *mut u8, usize) -> i32,generation_release_samples: Option<unsafe extern "C" fn(*mut Generation) -> i32>,generation_destroy: unsafe extern "C" fn(*mut Generation),@@ -317,6 +329,7 @@ impl Api {"slopfab_generation_error",unsafe extern "C" fn(*const Generation) -> *const c_char),+ generation_video_decode_timings: library.get::<unsafe extern "C" fn(*const Generation, *mut VideoDecodeTimings) -> i32>(b"slopfab_generation_video_decode_timings\0").ok().map(|symbol| *symbol),generation_output: symbol!("slopfab_generation_output",unsafe extern "C" fn(*const Generation, *mut Output) -> i32@@ -644,6 +657,12 @@ impl Api {pub fn generation_error(&self, generation: *mut Generation) -> String {unsafe { c_string((self.generation_error)(generation)) }}+ pub fn video_decode_timings(&self, generation: *mut Generation) -> Result<Option<VideoDecodeTimings>, String> {+ let Some(get) = self.generation_video_decode_timings else { return Ok(None); };+ let mut value = VideoDecodeTimings::default();+ self.error(unsafe { get(generation, &mut value) })?;+ Ok(Some(value))+ }pub fn output(&self, generation: *mut Generation) -> Result<Output, String> {let mut value = Output {video: ptr::null(),diff --git a/src-tauri/core/src/slopfab/generation.rs b/src-tauri/core/src/slopfab/generation.rsindex 0c2aa88..bad863d 100644--- a/src-tauri/core/src/slopfab/generation.rs+++ b/src-tauri/core/src/slopfab/generation.rs@@ -152,6 +152,16 @@ fn run_single_generation(}let generation = generation.finish()?;let output = generation.output()?;+ // Diagnostics must never turn a successfully generated image into a failure.+ match generation.video_decode_timings() {+ Ok(Some(timings)) => diagnostics::info("slopfab", "generation.video_decode", "VAE decode timing breakdown.", serde_json::json!({+ "jobId": item.request.job_id, "backend": platform.label(), "runtimeVersion": version,+ "stillImage": item.request.still_image, "width": output.width, "height": output.height, "frames": output.frames,+ "secondsTotal": output.seconds_video_decode, "timings": timings,+ })),+ Ok(None) => {}, // Older runtimes keep their aggregate decode timing.+ Err(error) => diagnostics::warn("slopfab", "generation.decode_timing_unavailable", &error, serde_json::json!({ "jobId": item.request.job_id })),+ }let source = Box::new(FrameSource { generation });collect_output(item, output, source, timing_profile)}