Skip to main content

ZPrepareArgs

Struct ZPrepareArgs 

Source
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: u64

Caller-chosen identity of this (prompt, resolution) state; every ZStepArgs of the same image carries the same key.

§n_img: usize

Image 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).

Auto Trait Implementations§

§

impl<'a> Freeze for ZPrepareArgs<'a>

§

impl<'a> RefUnwindSafe for ZPrepareArgs<'a>

§

impl<'a> Send for ZPrepareArgs<'a>

§

impl<'a> Sync for ZPrepareArgs<'a>

§

impl<'a> Unpin for ZPrepareArgs<'a>

§

impl<'a> UnsafeUnpin for ZPrepareArgs<'a>

§

impl<'a> UnwindSafe for ZPrepareArgs<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more