Skip to main content

logit_loom_diffusion_sdcpp/
lib.rs

1// SPDX-License-Identifier: MIT OR Apache-2.0
2
3#![doc = include_str!("../README.md")]
4#![allow(unsafe_code)]
5
6mod application;
7mod contract;
8mod error;
9mod execution;
10mod ffi;
11mod image;
12mod krea_activation;
13mod native_program;
14mod program;
15mod resident;
16mod runtime;
17
18pub use application::{ModelBlockApplicationReceiptV1, ModelBlockApplicationV1};
19pub use contract::{
20    BoundaryControl, BoundaryReceipt, CompanionReceipt, ContinueControl,
21    ControlledGenerationOutput, ControlledGenerationReceipt, DiffusionCheckpoint,
22    GenerationMeasurements, GenerationOutput, GenerationReceipt, ImageExecutionBindings,
23    ImageOutputSink, ImageRequest, ImageRequestReceipt, MAX_BACKEND_LABEL_BYTES,
24    MAX_CHECKPOINT_ENVELOPE_BYTES, MAX_CHECKPOINT_RECEIPT_BYTES, MAX_CHECKPOINT_STATE_BYTES,
25    MAX_IMAGE_DIMENSION, MAX_PROMPT_BYTES, NativeRuntimeReceipt, NoopProgram, Profile,
26    ProfileArtifacts, ProfileReceipt, SdcppOptions, StepProgram, StepReceipt,
27};
28pub use error::{Error, Result};
29pub use execution::{
30    ArtifactPathResolver, ChannelBiasControlV1, CheckpointSuspensionProbe,
31    CheckpointedImageExecution, ImagePlanContinuation, ImagePlanExecutor,
32    ModelBlockResidualScaleControlV1, RejectArtifactPaths, channel_bias_schema_v1, lora_target_v1,
33    model_block_residual_scale_schema_v1,
34};
35pub use image::{
36    AdvancedGenerationOutput, AdvancedGenerationReceipt, AdvancedImageRequest,
37    AdvancedImageRequestReceipt, AdvancedProgramGenerationOutput, AdvancedProgramGenerationReceipt,
38    ImagePixels, LoraBinding, LoraBindingReceipt, MAX_REFERENCE_IMAGES, MAX_REQUEST_LORAS,
39    MAX_VAE_TENSOR_RANK, PixelReceipt, VaeImageOutput, VaeOperationReceipt, VaeTensor,
40    VaeTensorOutput,
41};
42pub use krea_activation::{KreaActivationExecutionV1, KreaActivationInputBuffer};
43pub use native_program::{
44    RejectResidentArtifactPaths, ResidentArtifactPathResolver, SdcppResidentProgram,
45    SdcppResidentStageCheckpoint, SdcppResidentValueCheckpoint,
46    resident_checkpoint_compatibility_v1, resident_checkpoint_conversion_v1,
47    resident_lora_target_v1, resident_png_encoding_v1, resident_png_maximum_bytes_v1,
48};
49pub use program::{ForkProgram, PipelineProgram};
50pub use resident::{
51    CheckpointedResidentImageProgramExecution, ResidentImageProgramBackend,
52    ResidentImageProgramContinuation, ResidentImageProgramDriver, ResidentImageProgramExecution,
53    ResidentProgramCompletedStage, ResidentProgramFinish, ResidentProgramStageTerminal,
54    ResidentProgramValueCheckpoint,
55};
56pub use runtime::{Sdcpp, probe_companion};
57
58/// Companion ABI version implemented by this adapter.
59pub const COMPANION_ABI_VERSION: u32 = 2;
60/// Version of the whole-image extension layered over companion ABI v2.
61pub const IMAGE_ABI_VERSION: u32 = 3;
62/// Version of the resident native value-arena extension.
63pub const PROGRAM_ABI_VERSION: u32 = 3;
64/// Version of the native model-block operator and application-attestation
65/// extension.
66pub const MODEL_BLOCK_ABI_VERSION: u32 = 5;
67/// Version of the native Krea activation topology, capture, resident-input,
68/// operator, and cleanup extension.
69pub const KREA_ACTIVATION_ABI_VERSION: u32 = 6;
70/// Version of the safe Rust execution contract layered over the companion.
71pub const ADAPTER_CONTRACT_VERSION: u32 = 9;
72/// Exact stable-diffusion.cpp revision required by this adapter.
73pub const UPSTREAM_COMMIT: &str = "ea4e566ccffa10f853ecc3f29e74b1820bc91beb";