radiance 1.6.0

- Qwen-Image 2.1 and 2.1 Turbo: text to image and image edits over OpenAI's images API,
  /v1/images/generations and /v1/images/edits. An edit takes up to ten pictures and an optional
  mask, outside which the picture comes back exactly as it was; `background: transparent`, png,
  jpeg and webp output, `n` pictures from one prompt, streamed previews (`partial_images`), and
  vLLM-Omni's seed, negative_prompt with true_cfg_scale, num_inference_steps, width and height.
  arch/qwenimage21 serves the diffusers pipeline directory, converted with
  data/recipes/qwen-image-2.1-fp8.recipe (block fp8) or qwen-image-2.1-bf16.recipe.
  deploy/compose/qwen-image-2.1.yaml and qwen-image-2.1-turbo.yaml serve the fp8 containers on
  two cards. Two R9700s make a 2048x2048 picture in 61 s at the base model's 40 steps and in
  13 s with Turbo (56 and 12 s with --tp-wire wht6), a 1024x1024 one in 6.0 and 2.6 s. The
  models are under Qwen's research license, which is non-commercial
- an image generator is a program kind of its own (core/gen): an architecture declares its
  conditioning, denoising and decoding passes, and the driver runs the schedule, the pictures of
  a batch and the conditioning cache. An image model's /v1/models entry is its generator's name
  (qwen-image-2.1, qwen-image-2.1-turbo), and its capabilities and startup banner list only the
  images endpoints
- the tiled prefill GEMMs run their tiles in groups of activation bands, 16 for fp8 and 8 for
  bf16, so an operand larger than the 64 MB cache is read once a group instead of once a band. A
  bf16 GEMM with more than 64 MB of weight runs up to twice as fast
- fixed: a second lane opened in the middle of a step started beside work lane 0 had not
  finished. Gemma 4 26B-A4B opens its lane that way, so its first step after startup could read
  rows not yet written
- startup no longer warns about --checkpoint-slots when it was not passed, nor about an expert
  floor on a model with no experts
- the image's FFmpeg writes png, jpeg and webp (libwebp)
- for out-of-tree plugins: RAD_ABI_VERSION is 16. The op vocabulary gains the image generator's
  ops (conv2d_nhwc, ln_mod, ln_mod_quant_fp8, flow_euler, attn_prefix_self and others; docs/OPS.md,
  "Image generation"), and all_reduce takes an optional `overlap`. Plugins built against 1.5.0
  must be rebuilt
This commit is contained in:
Deadcode committed 2026-10-14 14:03:59 +02:00
1 parent b93b531f63
commit b068190326
66 files changed
+9035 -87

No files matched your search

+87
View File
@@ -229,8 +229,95 @@ typedef struct RadBatch {
int64_t enc_n_seg;
const int32_t* enc_cu; /* [enc_n_seg + 1] device: segment boundaries in patches */
int32_t enc_max_seg; /* host: the longest segment, which bands the attention */
/* ================================================ image generation */
/* A GENERATOR PASS (rad_declare_generator): RAD_GEN_PASS_*, and `gen_b` what it carries. 0 on
* every step of a program that declared no generator. */
int32_t gen;
const struct RadGenBatch* gen_b;
} RadBatch;
/* WHAT A GENERATOR PASS CARRIES beside the step batch's own fields, which keep their meanings:
*
* COND ONE sequence. `token_ids`, `positions` and `rope_pos` are its conditioning prompt, the
* encoder's input (`enc_*`) is the prompt's reference pictures and `mm_rows` the prompt
* rows the encoder's output rows replace, as on any media step. What is here lays out
* the generator's sequence over those rows and writes it into the KV group.
* DENOISE one entry per (image, conditioning): `cu_seqlens` bounds each entry's latent rows,
* and the KV group's `block_table` and `seqused` name its conditioning's sequence.
* DECODE one image.
*
* Every pointer is device memory unless the name ends in _h. */
typedef struct RadGenBatch {
/* ---- COND */
int64_t rows; /* the generator's rows for this sequence */
/* Where each row comes from: >= 0 the prompt row of that index (the conditioning network's
* output there), < 0 the reference latent row -(1 + src). [rows] */
const int32_t* src;
/* Rotary positions, three components a row. On a COND pass they are laid out SEGMENT BY
* SEGMENT: segment s's [3, length] component-major block starts at element 3 * seg_h[s], so a
* segment's positions are one dense operand. On a DENOISE pass, [3, n_tok] component-major,
* the latent rows'. */
const int32_t* rope;
/* The sequence in SEGMENTS: rows [seg_h[s], seg_h[s+1]), each a picture (`seg_bidi_h` 1, its
* rows attend to each other both ways) or a run of text (0, causal). A segment is never split
* and attends to every segment before it. `seg` is the same offsets on the device; `seg_cu`
* is [n_seg, 2], segment s's own cu_seqlens {0, length}, and `seg_start` [n_seg] its first
* row -- the keys before it, which is its `seqused` when it is run on its own. */
int64_t n_seg;
const int32_t* seg;
const int32_t* seg_h;
const int32_t* seg_bidi_h;
const int32_t* seg_cu;
const int32_t* seg_start;
/* [rows] the KV slot each row is stored at. */
const int32_t* slot_mapping;
/* PIXELS the decoder's encoder takes: `n_px` blocks of `px` [*, pixel_channels] bf16 in
* [-1, 1], block b at pixel px_h[3b], px_h[3b+1] high and px_h[3b+2] wide. The reference
* pictures, in prompt order, and -- with `inpaint` -- a last block that is no reference but
* the picture being repainted, at the size being made: its latents go to the lanes below. */
int64_t n_px;
const void* px;
const int32_t* px_h;
/* [n_px, 2] each block's own cu_seqlens over its latent tokens: {0, (h / scale) (w / scale)}. */
const int32_t* px_cu;
int32_t inpaint;
/* [image tokens] f32: 1 where the image is repainted, 0 where the picture is kept. */
const float* inp_mask;
/* The lanes this conditioning's images run in, which take the repainted picture's latents. */
int64_t n_lane;
const int32_t* lane_h;
/* ---- DENOISE, one value per entry ([n_seq]); on a COND pass `sigma` is one 0, the time
* the conditioning is modulated at */
const float* sigma; /* where the entry's latent is */
const float* sigma_next; /* where this step takes it */
const float* cfg; /* guidance: v = neg + cfg * (pos - neg); 1 without a pair */
/* The entry holding this image's NEGATIVE conditioning, or -1 for none; -2 marks an entry
* that IS one, whose rows serve another entry's step and whose lane it does not move. */
const int32_t* pair;
const int32_t* lane; /* the plugin's lane the image's latent lives in */
const int32_t* lane_dh; /* ... the same, host */
/* RAD_GEN_F_*. */
const int32_t* flags;
/* [n_seq, 2] the image's noise seed, low word first. */
const uint32_t* seed;
/* ---- DECODE */
int32_t dec_lane;
int32_t dec_height, dec_width; /* pixels */
int32_t dec_preview; /* the lane's preview latent, not its state */
} RadGenBatch;
/* An entry's flags on a DENOISE pass. */
enum {
RAD_GEN_F_FIRST = 1, /* the image's first step: its latent is the noise its seed draws */
RAD_GEN_F_INPAINT = 2, /* repaint: after the step, the kept region goes back to the picture,
* noised to sigma_next with the image's own noise */
RAD_GEN_F_PREVIEW = 4 /* write the step's estimate of the clean latent to the lane's preview */
};
/* ================================================================== operands */
/* RAD_OPK_KV names a KV group's pool rather than a buffer: attention and kv_store take the cache
* as an operand, and RadKVGroupBatch carries the slot mapping and the block table but not the