pub struct ZPrepareArgs<'a> {Show 20 fields
pub model: &'a Arc<CmfModel>,
pub geom: ZGeom,
pub key: u64,
pub n_img: usize,
pub n_img_p: usize,
pub n_cap_p: usize,
pub grid: (usize, usize),
pub cap: &'a [f32],
pub rope_img: (&'a [f32], &'a [f32]),
pub rope_joint: (&'a [f32], &'a [f32]),
pub x_emb_w: &'a [f32],
pub x_emb_b: &'a [f32],
pub x_pad: &'a [f32],
pub final_w: &'a [f32],
pub final_b: &'a [f32],
pub noise_refiner: &'a [ZBlockRef<'a>],
pub layers: &'a [ZBlockRef<'a>],
pub mods_all: Option<&'a [f32]>,
pub final_scale_all: Option<&'a [f32]>,
pub neg: Option<ZNegArgs<'a>>,
}Expand description
Once per (prompt, resolution). The backend uploads/caches what it needs
keyed by key; weight planes are keyed by the MODEL (not by key) and
survive across prompts until zimage_release.
Fields§
§model: &'a Arc<CmfModel>§geom: ZGeom§key: u64Caller-chosen identity of this (prompt, resolution) state; every
ZStepArgs of the same image carries the same key.
n_img: usizeImage tokens (H/16 · W/16), padded count ceil32(n_img), caption padded count ceil32(L). S = n_img_p + n_cap_p.
n_img_p: usize§n_cap_p: usize§grid: (usize, usize)The patch grid (H/16, W/16); n_img = grid.0 · grid.1. Row-major
token order hp·grid.1 + wp.
cap: &'a [f32][n_cap_p, hidden], ALREADY context-refined (host or device).
rope_img: (&'a [f32], &'a [f32])Noise-refiner RoPE: [n_img_p · hd/2] cos, sin (complex-interleaved pairs, hd/2 angles per token).
rope_joint: (&'a [f32], &'a [f32])Main-layer RoPE: [(n_img_p + n_cap_p) · hd/2], rows ordered [img, cap].
x_emb_w: &'a [f32]all_x_embedder.2-1.weight [hidden, 64], .bias [hidden],
x_pad_token [hidden] (replaces rows ≥ n_img after the embed).
x_emb_b: &'a [f32]§x_pad: &'a [f32]§final_w: &'a [f32]all_final_layer.2-1.linear.weight [64, hidden], .bias [64].
final_b: &'a [f32]§noise_refiner: &'a [ZBlockRef<'a>]2 noise-refiner blocks (image rows only) and 30 main layers.
layers: &'a [ZBlockRef<'a>]§mods_all: Option<&'a [f32]>OPTIONAL (backends may ignore): the modulation of EVERY step of this
image, [steps][(2+30)·4·hidden] in the ZStepArgs::mods layout, and
[steps][hidden] final scales, so a backend can upload them once per
image and index them by ZStepArgs::step. ZStepArgs::mods is still
always supplied and is authoritative.
final_scale_all: Option<&'a [f32]>§neg: Option<ZNegArgs<'a>>OPTIONAL (B2): the CFG negative item. When Some, the backend
prepares ONE batch-2 program under key — item 0 is this prompt,
item 1 the negative — and every ZStepArgs of that key must carry
out_neg. A backend without batch 2 returns false (the caller
then prepares the two items separately or runs the CPU path).