Commit 05adb5b for stable-diffusion.cpp

commit 05adb5b9d601b98a330651b496afd46ae8d7ad68
Author: leejet <leejet714@gmail.com>
Date:   Sat Nov 28 03:23:30 2026 +0800

    feat: add runtime INT8 execution for Q8_0 linear layers (#2445)

diff --git a/docs/dgl-builtins.md b/docs/dgl-builtins.md
index 073fbe7..1cedb5b 100644
--- a/docs/dgl-builtins.md
+++ b/docs/dgl-builtins.md
@@ -7,7 +7,7 @@ Optional parameters are marked with `?`. Default values follow `=`. See [DGL syn
 |---|---|---|
 | `add_noise` | `predict: predictor`, `base: tensor`, `noise: tensor`, `sigma: number` | `tensor` |
 | `animatediff::apply` | `model: denoiser`, `motion: animatediff` | `denoiser` |
-| `animatediff::load` (resource) | `path: string`, `family?: string = "auto"`, `wtype?: string = "auto"`, `conv_scale?: number = 0`, `linear_scale?: number = 0`, `attn_scale?: number = 0`, `backend?: string = ""`, `params_backend?: string = ""`, `split_mode?: string = ""`, `model_args?: string = ""`, `tensor_type_rules?: string = ""`, `flash_attn_mode?: string = "auto"`, `conv_direct_mode?: string = "auto"`, `sage_attn?: bool = false` | `animatediff` |
+| `animatediff::load` (resource) | `path: string`, `family?: string = "auto"`, `wtype?: string = "auto"`, `conv_scale?: number = 0`, `linear_scale?: number = 0`, `attn_scale?: number = 0`, `backend?: string = ""`, `params_backend?: string = ""`, `split_mode?: string = ""`, `model_args?: string = ""`, `tensor_type_rules?: string = ""`, `flash_attn_mode?: string = "auto"`, `conv_direct_mode?: string = "auto"`, `sage_attn?: bool = false`, `linear_type?: string = "auto"` | `animatediff` |
 | `apg` | `positive: predictor`, `negative: predictor`, `scale: number`, `image_only?: predictor`, `image_scale?: number = 1`, `schedule?: list<number>`, `eta?: number = 1`, `momentum?: number = 0`, `norm_threshold?: number = 0`, `norm_threshold_smoothing?: number = 0` | `predictor` |
 | `apply_lora` | `model: model`, `lora: lora`, `weight?: number = 1.0`, `mode?: string` | same type as `model` |
 | `audio::load` | `path: string` | `dict`<br>`sample_rate: int`<br>`samples: tensor` |
@@ -18,7 +18,7 @@ Optional parameters are marked with `?`. Default values follow `=`. See [DGL syn
 | `cache` | `mode?: string = "disabled"`, `reuse_threshold?: number`, `start_percent?: number`, `end_percent?: number`, `error_decay_rate?: number`, `use_relative_threshold?: bool`, `reset_error_on_compute?: bool`, `residual_diff_threshold?: number`, `max_warmup_steps?: int`, `max_cached_steps?: int`, `max_continuous_cached_steps?: int`, `taylorseer_n_derivatives?: int`, `taylorseer_skip_interval?: int`, `scm_mask?: string`, `spectrum_w?: number`, `spectrum_m?: int`, `spectrum_lam?: number`, `spectrum_window_size?: int`, `spectrum_flex_window?: number`, `spectrum_warmup_steps?: int`, `spectrum_stop_percent?: number` | `dict`<br>`end_percent: number`<br>`error_decay_rate: number`<br>`max_cached_steps: int`<br>`max_continuous_cached_steps: int`<br>`max_warmup_steps: int`<br>`mode: string`<br>`reset_error_on_compute: bool`<br>`residual_diff_threshold: number`<br>`reuse_threshold: number`<br>`scm_mask: string`<br>`spectrum_flex_window: number`<br>`spectrum_lam: number`<br>`spectrum_m: int`<br>`spectrum_stop_percent: number`<br>`spectrum_w: number`<br>`spectrum_warmup_steps: int`<br>`spectrum_window_size: int`<br>`start_percent: number`<br>`taylorseer_n_derivatives: int`<br>`taylorseer_skip_interval: int`<br>`use_relative_threshold: bool` |
 | `cfg` | `positive: predictor`, `negative: predictor`, `scale: number`, `image_only?: predictor`, `image_scale?: number = 1`, `schedule?: list<number>` | `predictor` |
 | `controlnet::apply` | `condition: dict`, `model: control_net`, `hint: tensor`, `strength?: number = 1`, `start_sigma?: number`, `end_sigma?: number`, `type?: string = "none"` | same type as `condition`<br>`controls: control_bindings` |
-| `controlnet::load` (resource) | `path: string`, `family?: string = "auto"`, `wtype?: string = "auto"`, `conv_scale?: number = 0`, `linear_scale?: number = 0`, `attn_scale?: number = 0`, `backend?: string = ""`, `params_backend?: string = ""`, `split_mode?: string = ""`, `model_args?: string = ""`, `tensor_type_rules?: string = ""`, `flash_attn_mode?: string = "auto"`, `conv_direct_mode?: string = "auto"`, `sage_attn?: bool = false` | `control_net` |
+| `controlnet::load` (resource) | `path: string`, `family?: string = "auto"`, `wtype?: string = "auto"`, `conv_scale?: number = 0`, `linear_scale?: number = 0`, `attn_scale?: number = 0`, `backend?: string = ""`, `params_backend?: string = ""`, `split_mode?: string = ""`, `model_args?: string = ""`, `tensor_type_rules?: string = ""`, `flash_attn_mode?: string = "auto"`, `conv_direct_mode?: string = "auto"`, `sage_attn?: bool = false`, `linear_type?: string = "auto"` | `control_net` |
 | `denoiser_scalings` | `predict: predictor`, `sigma: number` | `dict`<br>`input_scale: number`<br>`output_scale: number`<br>`skip_scale: number` |
 | `detections::box_masks` | `image: tensor`, `detections: dict` | `list<tensor>` |
 | `detections::detect` | `detector: detector`, `image: tensor`, `input_size?: int = 640`, `confidence?: number = 0.3`, `nms?: number = 0.45`, `max_detections?: int = 100` | `dict`<br>`class_ids: tensor`<br>`scores: tensor`<br>`xyxy: tensor` |
@@ -36,22 +36,22 @@ Optional parameters are marked with `?`. Default values follow `=`. See [DGL syn
 | `image::to_f32` | `image: tensor`, `channels?: int = 0` | `tensor` |
 | `image::to_u8` | `pixels: tensor` | `tensor` |
 | `ip_adapter::apply` | `condition: dict`, `adapter: ip_adapter`, `tokens: tensor`, `strength?: number = 1`, `start_sigma?: number`, `end_sigma?: number` | same type as `condition`<br>`ip_adapters: ip_adapter_bindings` |
-| `ip_adapter::load` (resource) | `path: string`, `family?: string = "auto"`, `wtype?: string = "auto"`, `conv_scale?: number = 0`, `linear_scale?: number = 0`, `attn_scale?: number = 0`, `backend?: string = ""`, `params_backend?: string = ""`, `split_mode?: string = ""`, `model_args?: string = ""`, `tensor_type_rules?: string = ""`, `flash_attn_mode?: string = "auto"`, `conv_direct_mode?: string = "auto"`, `sage_attn?: bool = false` | `ip_adapter` |
+| `ip_adapter::load` (resource) | `path: string`, `family?: string = "auto"`, `wtype?: string = "auto"`, `conv_scale?: number = 0`, `linear_scale?: number = 0`, `attn_scale?: number = 0`, `backend?: string = ""`, `params_backend?: string = ""`, `split_mode?: string = ""`, `model_args?: string = ""`, `tensor_type_rules?: string = ""`, `flash_attn_mode?: string = "auto"`, `conv_direct_mode?: string = "auto"`, `sage_attn?: bool = false`, `linear_type?: string = "auto"` | `ip_adapter` |
 | `ip_adapter::project` | `adapter: ip_adapter`, `embedding: tensor` | `tensor` |
 | `latent_shape` | `vae: vae`, `width: int`, `height: int`, `batch?: int = 1`, `frames?: int` | `tensor` |
 | `list::replace` | `items: list<any>`, `index: int`, `value: any` | `list<any>` |
-| `load_audio_encoder` (resource) | `path: string`, `family?: string = "auto"`, `wtype?: string = "auto"`, `conv_scale?: number = 0`, `linear_scale?: number = 0`, `attn_scale?: number = 0`, `backend?: string = ""`, `params_backend?: string = ""`, `split_mode?: string = ""`, `model_args?: string = ""`, `tensor_type_rules?: string = ""`, `flash_attn_mode?: string = "auto"`, `conv_direct_mode?: string = "auto"`, `sage_attn?: bool = false` | `audio_encoder` |
-| `load_audio_vae` (resource) | `path: string`, `family?: string = "auto"`, `wtype?: string = "auto"`, `conv_scale?: number = 0`, `linear_scale?: number = 0`, `attn_scale?: number = 0`, `backend?: string = ""`, `params_backend?: string = ""`, `split_mode?: string = ""`, `model_args?: string = ""`, `tensor_type_rules?: string = ""`, `flash_attn_mode?: string = "auto"`, `conv_direct_mode?: string = "auto"`, `sage_attn?: bool = false`, `family_from?: string = ""` | `audio_vae` |
-| `load_detector` (resource) | `path: string`, `backend?: string = ""`, `params_backend?: string = ""` | `detector` |
-| `load_dit` (resource) | `path: string`, `family?: string = "auto"`, `wtype?: string = "auto"`, `conv_scale?: number = 0`, `linear_scale?: number = 0`, `attn_scale?: number = 0`, `backend?: string = ""`, `params_backend?: string = ""`, `split_mode?: string = ""`, `model_args?: string = ""`, `tensor_type_rules?: string = ""`, `flash_attn_mode?: string = "auto"`, `conv_direct_mode?: string = "auto"`, `sage_attn?: bool = false` | `denoiser` |
-| `load_latent_upscaler` (resource) | `path: string`, `family?: string = "auto"`, `wtype?: string = "auto"`, `conv_scale?: number = 0`, `linear_scale?: number = 0`, `attn_scale?: number = 0`, `backend?: string = ""`, `params_backend?: string = ""`, `split_mode?: string = ""`, `model_args?: string = ""`, `tensor_type_rules?: string = ""`, `flash_attn_mode?: string = "auto"`, `conv_direct_mode?: string = "auto"`, `sage_attn?: bool = false` | `latent_upscaler` |
+| `load_audio_encoder` (resource) | `path: string`, `family?: string = "auto"`, `wtype?: string = "auto"`, `conv_scale?: number = 0`, `linear_scale?: number = 0`, `attn_scale?: number = 0`, `backend?: string = ""`, `params_backend?: string = ""`, `split_mode?: string = ""`, `model_args?: string = ""`, `tensor_type_rules?: string = ""`, `flash_attn_mode?: string = "auto"`, `conv_direct_mode?: string = "auto"`, `sage_attn?: bool = false`, `linear_type?: string = "auto"` | `audio_encoder` |
+| `load_audio_vae` (resource) | `path: string`, `family?: string = "auto"`, `wtype?: string = "auto"`, `conv_scale?: number = 0`, `linear_scale?: number = 0`, `attn_scale?: number = 0`, `backend?: string = ""`, `params_backend?: string = ""`, `split_mode?: string = ""`, `model_args?: string = ""`, `tensor_type_rules?: string = ""`, `flash_attn_mode?: string = "auto"`, `conv_direct_mode?: string = "auto"`, `sage_attn?: bool = false`, `family_from?: string = ""`, `linear_type?: string = "auto"` | `audio_vae` |
+| `load_detector` (resource) | `path: string`, `backend?: string = ""`, `params_backend?: string = ""`, `linear_type?: string = "auto"` | `detector` |
+| `load_dit` (resource) | `path: string`, `family?: string = "auto"`, `wtype?: string = "auto"`, `conv_scale?: number = 0`, `linear_scale?: number = 0`, `attn_scale?: number = 0`, `backend?: string = ""`, `params_backend?: string = ""`, `split_mode?: string = ""`, `model_args?: string = ""`, `tensor_type_rules?: string = ""`, `flash_attn_mode?: string = "auto"`, `conv_direct_mode?: string = "auto"`, `sage_attn?: bool = false`, `linear_type?: string = "auto"` | `denoiser` |
+| `load_latent_upscaler` (resource) | `path: string`, `family?: string = "auto"`, `wtype?: string = "auto"`, `conv_scale?: number = 0`, `linear_scale?: number = 0`, `attn_scale?: number = 0`, `backend?: string = ""`, `params_backend?: string = ""`, `split_mode?: string = ""`, `model_args?: string = ""`, `tensor_type_rules?: string = ""`, `flash_attn_mode?: string = "auto"`, `conv_direct_mode?: string = "auto"`, `sage_attn?: bool = false`, `linear_type?: string = "auto"` | `latent_upscaler` |
 | `load_lora` (resource) | `path: string` | `lora` |
-| `load_tae` (resource) | `path: string`, `family?: string = "auto"`, `wtype?: string = "auto"`, `conv_scale?: number = 0`, `linear_scale?: number = 0`, `attn_scale?: number = 0`, `backend?: string = ""`, `params_backend?: string = ""`, `split_mode?: string = ""`, `model_args?: string = ""`, `tensor_type_rules?: string = ""`, `flash_attn_mode?: string = "auto"`, `conv_direct_mode?: string = "auto"`, `sage_attn?: bool = false`, `family_from?: string = ""`, `decode_only?: bool = false` | `vae` |
-| `load_text_encoder` (resource) | `path: string`, `family?: string = "auto"`, `wtype?: string = "auto"`, `conv_scale?: number = 0`, `linear_scale?: number = 0`, `attn_scale?: number = 0`, `backend?: string = ""`, `params_backend?: string = ""`, `split_mode?: string = ""`, `model_args?: string = ""`, `tensor_type_rules?: string = ""`, `flash_attn_mode?: string = "auto"`, `conv_direct_mode?: string = "auto"`, `sage_attn?: bool = false`, `family_from?: string = ""`, `tokenizer?: string = ""`, `vision_path?: string = ""`, `projection_path?: string = ""`, `connectors_path?: string = ""`, `t5_path?: string = ""`, `clip_l_path?: string = ""`, `clip_g_path?: string = ""` | `text_encoder` |
-| `load_unet` (resource) (alias of `load_dit`) | `path: string`, `family?: string = "auto"`, `wtype?: string = "auto"`, `conv_scale?: number = 0`, `linear_scale?: number = 0`, `attn_scale?: number = 0`, `backend?: string = ""`, `params_backend?: string = ""`, `split_mode?: string = ""`, `model_args?: string = ""`, `tensor_type_rules?: string = ""`, `flash_attn_mode?: string = "auto"`, `conv_direct_mode?: string = "auto"`, `sage_attn?: bool = false` | `denoiser` |
-| `load_upscaler` (resource) | `path: string`, `tile_size?: int = 128`, `backend?: string = ""`, `params_backend?: string = ""`, `direct?: bool = false` | `upscaler` |
-| `load_vae` (resource) | `path: string`, `family?: string = "auto"`, `wtype?: string = "auto"`, `conv_scale?: number = 0`, `linear_scale?: number = 0`, `attn_scale?: number = 0`, `backend?: string = ""`, `params_backend?: string = ""`, `split_mode?: string = ""`, `model_args?: string = ""`, `tensor_type_rules?: string = ""`, `flash_attn_mode?: string = "auto"`, `conv_direct_mode?: string = "auto"`, `sage_attn?: bool = false`, `family_from?: string = ""`, `vae_format?: string = "auto"` | `vae` |
-| `load_vision_encoder` (resource) | `path: string`, `family?: string = "auto"`, `wtype?: string = "auto"`, `conv_scale?: number = 0`, `linear_scale?: number = 0`, `attn_scale?: number = 0`, `backend?: string = ""`, `params_backend?: string = ""`, `split_mode?: string = ""`, `model_args?: string = ""`, `tensor_type_rules?: string = ""`, `flash_attn_mode?: string = "auto"`, `conv_direct_mode?: string = "auto"`, `sage_attn?: bool = false` | `vision_encoder` |
+| `load_tae` (resource) | `path: string`, `family?: string = "auto"`, `wtype?: string = "auto"`, `conv_scale?: number = 0`, `linear_scale?: number = 0`, `attn_scale?: number = 0`, `backend?: string = ""`, `params_backend?: string = ""`, `split_mode?: string = ""`, `model_args?: string = ""`, `tensor_type_rules?: string = ""`, `flash_attn_mode?: string = "auto"`, `conv_direct_mode?: string = "auto"`, `sage_attn?: bool = false`, `family_from?: string = ""`, `decode_only?: bool = false`, `linear_type?: string = "auto"` | `vae` |
+| `load_text_encoder` (resource) | `path: string`, `family?: string = "auto"`, `wtype?: string = "auto"`, `conv_scale?: number = 0`, `linear_scale?: number = 0`, `attn_scale?: number = 0`, `backend?: string = ""`, `params_backend?: string = ""`, `split_mode?: string = ""`, `model_args?: string = ""`, `tensor_type_rules?: string = ""`, `flash_attn_mode?: string = "auto"`, `conv_direct_mode?: string = "auto"`, `sage_attn?: bool = false`, `family_from?: string = ""`, `tokenizer?: string = ""`, `vision_path?: string = ""`, `projection_path?: string = ""`, `connectors_path?: string = ""`, `t5_path?: string = ""`, `clip_l_path?: string = ""`, `clip_g_path?: string = ""`, `linear_type?: string = "auto"` | `text_encoder` |
+| `load_unet` (resource) (alias of `load_dit`) | `path: string`, `family?: string = "auto"`, `wtype?: string = "auto"`, `conv_scale?: number = 0`, `linear_scale?: number = 0`, `attn_scale?: number = 0`, `backend?: string = ""`, `params_backend?: string = ""`, `split_mode?: string = ""`, `model_args?: string = ""`, `tensor_type_rules?: string = ""`, `flash_attn_mode?: string = "auto"`, `conv_direct_mode?: string = "auto"`, `sage_attn?: bool = false`, `linear_type?: string = "auto"` | `denoiser` |
+| `load_upscaler` (resource) | `path: string`, `tile_size?: int = 128`, `backend?: string = ""`, `params_backend?: string = ""`, `direct?: bool = false`, `linear_type?: string = "auto"` | `upscaler` |
+| `load_vae` (resource) | `path: string`, `family?: string = "auto"`, `wtype?: string = "auto"`, `conv_scale?: number = 0`, `linear_scale?: number = 0`, `attn_scale?: number = 0`, `backend?: string = ""`, `params_backend?: string = ""`, `split_mode?: string = ""`, `model_args?: string = ""`, `tensor_type_rules?: string = ""`, `flash_attn_mode?: string = "auto"`, `conv_direct_mode?: string = "auto"`, `sage_attn?: bool = false`, `family_from?: string = ""`, `vae_format?: string = "auto"`, `linear_type?: string = "auto"` | `vae` |
+| `load_vision_encoder` (resource) | `path: string`, `family?: string = "auto"`, `wtype?: string = "auto"`, `conv_scale?: number = 0`, `linear_scale?: number = 0`, `attn_scale?: number = 0`, `backend?: string = ""`, `params_backend?: string = ""`, `split_mode?: string = ""`, `model_args?: string = ""`, `tensor_type_rules?: string = ""`, `flash_attn_mode?: string = "auto"`, `conv_direct_mode?: string = "auto"`, `sage_attn?: bool = false`, `linear_type?: string = "auto"` | `vision_encoder` |
 | `ltx::video_positions` | `like: tensor`, `keyframe_latent_frames: int`, `keyframe_frame_index: int`, `keyframe_pixel_frames: int`, `fps?: int = 24`, `spatial_scale?: int = 32`, `temporal_scale?: int = 8`, `causal?: bool = true` | `tensor` |
 | `make_rng` | `algorithm?: string = "cuda"`, `seed?: int = 0` | `rng` |
 | `make_sigmas` | `predict: predictor`, `latent: tensor`, `scheduler?: string = "discrete"`, `steps: int`, `flow_shift?: number = 0`, `sequence_length?: int`, `extra_args?: string = ""` | `tensor` |
@@ -69,11 +69,11 @@ Optional parameters are marked with `?`. Default values follow `=`. See [DGL syn
 | `photomaker::apply` | `condition: dict`, `photomaker: photomaker`, `tokens: tensor`, `mask: tensor` | same type as `condition`<br>`crossattn: tensor` |
 | `photomaker::encode_images` | `photomaker: photomaker`, `images: list<tensor>`, `id_embedding?: tensor` | `tensor` |
 | `photomaker::encode_prompt` | `encoder: text_encoder`, `text: string`, `tokens: tensor`, `width?: int = 1024`, `height?: int = 1024`, `clip_skip?: int = -1` | `dict`<br>`condition: dict`<br>`condition.concat: tensor`<br>`condition.crossattn: tensor`<br>`condition.extra_crossattn: list<tensor>`<br>`condition.image_embed_indices: list<tensor>`<br>`condition.image_embeds: list<tensor>`<br>`condition.input_ids: tensor`<br>`condition.position_ids: tensor`<br>`condition.ref_audios: list<tensor>`<br>`condition.ref_images: list<tensor>`<br>`condition.reference_blocks: list<dict>`<br>`condition.reference_blocks.audio: int`<br>`condition.reference_blocks.kind: string`<br>`condition.reference_blocks.video: int`<br>`condition.t5_ids: tensor`<br>`condition.t5_weights: tensor`<br>`condition.token_types: tensor`<br>`condition.vector: tensor`<br>`condition.vinput_mask: tensor`<br>`mask: tensor`<br>`plain: dict`<br>`plain.concat: tensor`<br>`plain.crossattn: tensor`<br>`plain.extra_crossattn: list<tensor>`<br>`plain.image_embed_indices: list<tensor>`<br>`plain.image_embeds: list<tensor>`<br>`plain.input_ids: tensor`<br>`plain.position_ids: tensor`<br>`plain.ref_audios: list<tensor>`<br>`plain.ref_images: list<tensor>`<br>`plain.reference_blocks: list<dict>`<br>`plain.reference_blocks.audio: int`<br>`plain.reference_blocks.kind: string`<br>`plain.reference_blocks.video: int`<br>`plain.t5_ids: tensor`<br>`plain.t5_weights: tensor`<br>`plain.token_types: tensor`<br>`plain.vector: tensor`<br>`plain.vinput_mask: tensor` |
-| `photomaker::load` (resource) | `path: string`, `family?: string = "auto"`, `wtype?: string = "auto"`, `conv_scale?: number = 0`, `linear_scale?: number = 0`, `attn_scale?: number = 0`, `backend?: string = ""`, `params_backend?: string = ""`, `split_mode?: string = ""`, `model_args?: string = ""`, `tensor_type_rules?: string = ""`, `flash_attn_mode?: string = "auto"`, `conv_direct_mode?: string = "auto"`, `sage_attn?: bool = false` | `photomaker` |
+| `photomaker::load` (resource) | `path: string`, `family?: string = "auto"`, `wtype?: string = "auto"`, `conv_scale?: number = 0`, `linear_scale?: number = 0`, `attn_scale?: number = 0`, `backend?: string = ""`, `params_backend?: string = ""`, `split_mode?: string = ""`, `model_args?: string = ""`, `tensor_type_rules?: string = ""`, `flash_attn_mode?: string = "auto"`, `conv_direct_mode?: string = "auto"`, `sage_attn?: bool = false`, `linear_type?: string = "auto"` | `photomaker` |
 | `predictor` | `model: denoiser`, `condition: dict`, `prediction?: string = "auto"`, `concat?: tensor`, `ref_latents?: list<tensor>`, `ref_audios?: list<tensor>`, `reference_blocks?: list<dict>`, `keyframe_indices?: list<int>`, `ref_index_mode?: string = "fixed"`, `force_ref_timestep_zero?: bool = false`, `ref_rope_anchor?: string = "default"`, `guidance?: number = 3.5`, `skip_layers?: list<int>`, `vace_context?: tensor`, `vace_strength?: number = 1`, `audio_embedding?: tensor`, `video_positions?: tensor`, `audio_length?: int = 0`, `fps?: number = 24`, `video_sigma_shift?: number = 12`, `audio_sigma_shift?: number = 3`, `circular_x?: bool = false`, `circular_y?: bool = false`, `transform?: fn`, `transform_args?: dict` | `predictor` |
 | `preview` | `decoder?: vae`, `circular_x?: bool = false`, `circular_y?: bool = false` | `sampling_observer` |
 | `pulid::apply` | `condition: dict`, `pulid: pulid`, `embedding: tensor`, `strength?: number = 1`, `start_sigma?: number`, `end_sigma?: number` | same type as `condition`<br>`pulid: pulid_bindings` |
-| `pulid::load` (resource) | `path: string`, `family?: string = "auto"`, `wtype?: string = "auto"`, `conv_scale?: number = 0`, `linear_scale?: number = 0`, `attn_scale?: number = 0`, `backend?: string = ""`, `params_backend?: string = ""`, `split_mode?: string = ""`, `model_args?: string = ""`, `tensor_type_rules?: string = ""`, `flash_attn_mode?: string = "auto"`, `conv_direct_mode?: string = "auto"`, `sage_attn?: bool = false` | `pulid` |
+| `pulid::load` (resource) | `path: string`, `family?: string = "auto"`, `wtype?: string = "auto"`, `conv_scale?: number = 0`, `linear_scale?: number = 0`, `attn_scale?: number = 0`, `backend?: string = ""`, `params_backend?: string = ""`, `split_mode?: string = ""`, `model_args?: string = ""`, `tensor_type_rules?: string = ""`, `flash_attn_mode?: string = "auto"`, `conv_direct_mode?: string = "auto"`, `sage_attn?: bool = false`, `linear_type?: string = "auto"` | `pulid` |
 | `pulid::load_embedding` | `path: string` | `tensor` |
 | `regions::crop` | `image: tensor`, `regions: dict` | `list<tensor>` |
 | `regions::from_boxes` | `width: int`, `height: int`, `boxes: any` | `dict`<br>`boxes: tensor`<br>`height: int`<br>`width: int` |
diff --git a/docs/dgl.md b/docs/dgl.md
index 99a801a..0fe7af8 100644
--- a/docs/dgl.md
+++ b/docs/dgl.md
@@ -1735,8 +1735,9 @@ sd_dgl_result_free(result);
 ### Context execution settings

 Set these options with `sd_dgl_ctx_set` while the context is idle or use the
-corresponding `sd-cli` and `sd-server` flags. All models in the context use the
-same settings.
+corresponding `sd-cli` and `sd-server` flags. The settings apply throughout the
+context. A `linear_type` context setting overrides the loader's `linear_type`
+argument for each selected module.

 | Context key | CLI and server flag | Default |
 | --- | --- | --- |
@@ -1748,6 +1749,7 @@ same settings.
 | `eager_load` | `--eager-load` | Off |
 | `disable_prefetch` | `--disable-prefetch` | Off |
 | `disable_segmented_compute` | `--disable-segmented-compute` | Off |
+| `linear_type` | `--linear-type` with `auto\|i8\|raw` or module assignments such as `dit=i8` | `auto` (currently equivalent to `raw`) |

 The context accepts a thread count from 1 to 4096 and boolean strings such as
 `"on"` and `"off"`. Changing threading, placement or weight-loading options
diff --git a/docs/guides/c_api.md b/docs/guides/c_api.md
index ad00cc2..e456c00 100644
--- a/docs/guides/c_api.md
+++ b/docs/guides/c_api.md
@@ -427,6 +427,7 @@ For SDXL's bundled VAE (no `vae_path`), generation emits
 | `image` | `tensor` | upscale |
 | `init_image` | `tensor` | image, video |
 | `linear_scale` | `float` | context |
+| `linear_type` | `string` | context, upscaler. `auto` (default), `i8`, `raw`, or module assignments such as `dit=i8,te=raw` |
 | `llm_path` | `string` | context |
 | `llm_vision_path` | `string` | context |
 | `lora_apply_mode` | `string` | context |
diff --git a/docs/guides/int8_convrot.md b/docs/guides/int8_convrot.md
index e31dc95..84d6acc 100644
--- a/docs/guides/int8_convrot.md
+++ b/docs/guides/int8_convrot.md
@@ -100,7 +100,7 @@ The packed runtime activation tensor contains the I8 activation rows and their f
 - Metal supports INT8 tensorwise and convrot on Apple silicon (Apple GPU family 7 or newer). It keeps weights in INT8 and rotates and quantizes activations on the GPU. On macOS/iOS 26 or newer, it probes Metal TensorOps `matmul2d` with INT8 inputs and INT32 cooperative results. It combines 1024-product partial sums using wrapping integer addition to preserve exact accumulation on older GPUs, then applies scales and bias in registers. Older systems or unavailable TensorOps pipelines use SIMD-group matrix multiplication: INT8 tiles are converted to FP16, and FP32 partial sums cover at most 256 products before being combined as integers, preserving the I32 accumulation contract. Convrot groups 1, 4, 16, 64, and 256 are supported. These kernels require the patched GGML Metal extension services and are enabled by `SD_METAL=ON`.
 - CUDA uses CUTLASS for eligible shapes when enabled, and cuBLAS for other eligible shapes on Turing and newer. HIP uses hipBLAS or hipBLASLt on supported targets, including RDNA2, RDNA3, RDNA3.5, RDNA4 (`gfx120x`), and CDNA.
 - CUDA, HIP, and MUSA share a tiled INT8 dot-product fallback. It handles devices without INT8 BLAS and projections whose output width is not divisible by four. It uses packed byte-dot instructions where available.
-- Vulkan supports H64 and H256 activation quantization and packed-activation INT8 matrix multiplication with input widths divisible by 64. It requires integer dot product support and uses cooperative matrices when available. Unsupported configurations use the scheduler's CPU fallback.
+- Vulkan supports unrotated rowwise, H64, and H256 activation quantization and packed-activation INT8 matrix multiplication with input widths divisible by 64. It requires integer dot product support and uses cooperative matrices when available. Unsupported configurations use the scheduler's CPU fallback.

 `--lora-apply-mode auto` selects immediate merging for INT8 tensorwise models
 on the compute backend without row splitting. Use `--lora-apply-mode at_runtime`
@@ -164,6 +164,40 @@ and logical weight dimensions. Packed weights and their codebook/scale tensors
 are excluded from weight type conversion. `SD_USE_UPSTREAM_GGML` builds reject
 these formats because they require the application extension API.

+## Runtime requantization to INT8
+
+Use `--linear-type i8` to run eligible Q8_0 linear layers through INT8 GEMM on
+CUDA, HIP, MUSA, and Vulkan. A bare mode applies to all models in the context,
+including diffusion models and text encoders loaded with `--llm`. The default
+is `auto`, which currently behaves like `raw`. With `--linear-type raw`, each
+layer uses its original execution path. Native INT8 weights use their INT8
+path in all three modes.
+
+Use module assignments to apply a mode selectively. For example,
+`--linear-type dit=i8` selects runtime conversion for the diffusion module.
+The text encoder and other modules use `auto`. Use `--linear-type i8,te=raw` to
+enable conversion globally while keeping the text encoders on their original
+paths. Module names and aliases are shared with [backend selection](backend.md).
+Module assignments override the default regardless of their order. Within
+the same string, the last value for a module or the default wins.
+
+Runtime conversion uses H256 for weights and activations. Eligible linear
+layers have an input width divisible by 256. Vulkan also requires integer
+dot products and compatible storage buffer sizes and alignment. The C API option is
+`linear_type`. In DGL, set the mode on a model loader, for example
+`load_dit(path, linear_type = "i8")`. To override loader settings by module,
+use `sd_dgl_ctx_set(ctx, "linear_type", "dit=i8")` or pass
+`--linear-type dit=i8` when running the script from the CLI.
+
+At runtime, sd.cpp dequantizes the Q8_0 blocks, rotates the weights, and
+requantizes them to INT8 with one scale per output channel. It applies the
+same rotation to the activations before quantizing each input row. The
+converted matrix uses temporary GPU memory and feeds the standard INT8 kernels
+and their fusions. The checkpoint file stays in its original format.
+Requantization changes numerical results, and conversion overhead depends on
+matrix shape. Row-split models and unsupported layers use the standard Q8_0
+path.
+
 ## Example

 ComfyUI INT8 convrot safetensors can be passed to `--diffusion-model` without conversion:
diff --git a/examples/cli/main.cpp b/examples/cli/main.cpp
index 98913f8..e3b7202 100644
--- a/examples/cli/main.cpp
+++ b/examples/cli/main.cpp
@@ -823,7 +823,8 @@ int main(int argc, const char* argv[]) {
                                                        ctx_params.n_threads,
                                                        gen_params.upscale_tile_size,
                                                        ctx_params.effective_backend.c_str(),
-                                                       ctx_params.effective_params_backend.c_str()));
+                                                       ctx_params.effective_params_backend.c_str(),
+                                                       ctx_params.linear_type));

         if (upscaler_ctx == nullptr) {
             LOG_ERROR("sd_upscaler_create failed");
diff --git a/examples/common/common.cpp b/examples/common/common.cpp
index 9beaaa5..17b2fa3 100644
--- a/examples/common/common.cpp
+++ b/examples/common/common.cpp
@@ -686,6 +686,22 @@ ArgOptions SDContextParams::get_options() {
              vae_conv_direct = true;
              return 0;
          }},
+        {"",
+         "--linear-type",
+         "auto|i8|raw or module assignments, e.g. dit=i8 or i8,te=raw. Default: auto (currently equivalent to raw)",
+         [this](int argc, const char** argv, int index) {
+             if (++index >= argc || argv[index][0] == '\0') {
+                 LOG_ERROR("--linear-type requires auto, i8, raw, or module assignments");
+                 return -1;
+             }
+             SDOptPtr validation(sd_ctx_opt_create());
+             if (sd_opt_set_string(validation.get(), "linear_type", argv[index]) != SD_STATUS_OK) {
+                 LOG_ERROR("--linear-type: %s", sd_get_last_error());
+                 return -1;
+             }
+             linear_type = argv[index];
+             return 1;
+         }},
         {"",
          "--conv-direct",
          "on|off|auto or diffusion/vae/controlnet assignments (default: auto), e.g. auto,vae=off. Overrides legacy convolution flags",
@@ -948,6 +964,7 @@ std::string SDContextParams::to_string() const {
         << "  flash_attn_mode: " << flash_attn_mode << ",\n"
         << "  conv_direct_mode: " << conv_direct_mode << ",\n"
         << "  sage_attn: " << sage_attn << ",\n"
+        << "  linear_type: " << linear_type.value_or("auto") << ",\n"
         << "  linear_scale: " << linear_scale << ",\n"
         << "  attn_scale: " << attn_scale << ",\n"
         << "  diffusion_conv_direct: " << diffusion_conv_direct << ",\n"
@@ -965,6 +982,7 @@ bool SDContextParams::configure_dgl(sd_dgl_ctx_t* ctx) const {
         return !option || sd_dgl_ctx_set(ctx, key, std::to_string(*option).c_str());
     };
     return (!max_vram || sd_dgl_ctx_set(ctx, "max_vram", max_vram->c_str())) &&
+           (!linear_type || sd_dgl_ctx_set(ctx, "linear_type", linear_type->c_str())) &&
            set("auto_fit", auto_fit) &&
            set("conditioning_cache_size", conditioning_cache_size) &&
            set("batched_cfg", batched_cfg) &&
@@ -1025,6 +1043,7 @@ SDOptPtr SDContextParams::to_context_opt() {
     opt.set_string("flash_attn_mode", flash_attn_mode);
     opt.set_string("conv_direct_mode", conv_direct_mode);
     opt.set_bool("sage_attn", sage_attn);
+    opt.set_string("linear_type", linear_type);
     opt.set_float("linear_scale", linear_scale);
     opt.set_float("attn_scale", attn_scale);
     opt.set_bool("tae_preview_only", taesd_preview_only);
diff --git a/examples/common/common.h b/examples/common/common.h
index f4418ad..cddfaf0 100644
--- a/examples/common/common.h
+++ b/examples/common/common.h
@@ -180,6 +180,7 @@ struct SDContextParams {
     std::optional<std::string> flash_attn_mode;
     std::optional<std::string> conv_direct_mode;
     std::optional<bool> sage_attn;
+    std::optional<std::string> linear_type;
     std::optional<bool> diffusion_conv_direct;
     std::optional<bool> vae_conv_direct;
     std::optional<bool> taesd_preview_only;
diff --git a/examples/common/resource_owners.hpp b/examples/common/resource_owners.hpp
index d76e7e6..83f2dca 100644
--- a/examples/common/resource_owners.hpp
+++ b/examples/common/resource_owners.hpp
@@ -324,14 +324,15 @@ static inline bool generate_sd_video(sd_ctx_t* ctx, const SDOptPtr& opt, sd_resu
     return opt && sd_generate_video(ctx, opt.get(), result) == SD_STATUS_OK;
 }

-static inline sd_upscaler_t* create_sd_upscaler(const char* path, std::optional<bool> direct, std::optional<int> threads, std::optional<int> tile, const char* backend, const char* params_backend) {
+static inline sd_upscaler_t* create_sd_upscaler(const char* path, std::optional<bool> direct, std::optional<int> threads, std::optional<int> tile, const char* backend, const char* params_backend, const std::optional<std::string>& linear_type) {
     SDOptPtr opt(sd_upscaler_opt_create());
     if (!opt || sd_opt_set_string(opt.get(), "model_path", path) != SD_STATUS_OK ||
         (direct && sd_opt_set_bool(opt.get(), "conv_direct", *direct) != SD_STATUS_OK) ||
         (tile && sd_opt_set_int(opt.get(), "tile_size", *tile) != SD_STATUS_OK) ||
         (threads && sd_opt_set_int(opt.get(), "n_threads", *threads) != SD_STATUS_OK) ||
         (backend && sd_opt_set_string(opt.get(), "backend", backend) != SD_STATUS_OK) ||
-        (params_backend && sd_opt_set_string(opt.get(), "params_backend", params_backend) != SD_STATUS_OK))
+        (params_backend && sd_opt_set_string(opt.get(), "params_backend", params_backend) != SD_STATUS_OK) ||
+        (linear_type && sd_opt_set_string(opt.get(), "linear_type", linear_type->c_str()) != SD_STATUS_OK))
         return nullptr;
     sd_upscaler_t* result = nullptr;
     sd_upscaler_create(opt.get(), &result);
diff --git a/src/api/generation.cpp b/src/api/generation.cpp
index ba267c5..5de121d 100644
--- a/src/api/generation.cpp
+++ b/src/api/generation.cpp
@@ -29,6 +29,8 @@ namespace sd::api {
         : model(copy_options(source), purpose) {
         const auto& settings = model.config.context;
         execution.set("n_threads", std::to_string(settings.n_threads));
+        if (settings.linear_type)
+            execution.set("linear_type", settings.linear_type);
         execution.set("conditioning_cache_size", std::to_string(settings.conditioning_cache_size));
         for (const auto& [key, enabled] : std::map<std::string, bool>{
                  {"auto_fit", settings.auto_fit}, {"batched_cfg", settings.batched_cfg}, {"enable_mmap", settings.enable_mmap}, {"eager_load", settings.eager_load}, {"disable_prefetch", settings.disable_prefetch}, {"disable_segmented_compute", settings.disable_segmented_compute}})
diff --git a/src/api/options.cpp b/src/api/options.cpp
index 5ec536a..4f1970a 100644
--- a/src/api/options.cpp
+++ b/src/api/options.cpp
@@ -1,4 +1,5 @@
 #include "options.h"
+#include "core/ggml_extend_backend.h"
 #include "core/option_types.h"
 #include "core/util.h"
 #include "tensor.h"
@@ -337,6 +338,14 @@ static void add_context_specs(std::vector<ParamSpec>& specs) {
     specs.push_back(parameter<std::string>("conv_direct_mode", ParamType::String, Context, [](const std::string& value, sd::OptConfig& config) { config.context.conv_direct_mode = value.c_str(); }));
     specs.push_back(parameter<std::string>("diffusion_model_path", ParamType::String, Context, [](const std::string& value, sd::OptConfig& config) { config.context.diffusion_model_path = value.c_str(); }));
     specs.push_back(parameter<std::string>("flash_attn_mode", ParamType::String, Context, [](const std::string& value, sd::OptConfig& config) { config.context.flash_attn_mode = value.c_str(); }));
+    auto linear_type = parameter<std::string>(
+        "linear_type", ParamType::String, Context | Upscaler, [](const std::string& value, sd::OptConfig& config) { config.context.linear_type = value.c_str(); });
+    linear_type.valid = [](const ParamValue& value) {
+        SDBackendAssignment assignment;
+        return sd_parse_linear_type_assignment(std::get<std::string>(value), &assignment, nullptr);
+    };
+    linear_type.invalid_reason = "expected auto, i8, raw, or module assignments such as dit=i8";
+    specs.push_back(std::move(linear_type));
     specs.push_back(integer_parameter(
         "n_threads", Context | Upscaler, [](const int64_t& value, sd::OptConfig& config) { config.context.n_threads = static_cast<int>(value); }, 1, INT32_MAX));
     specs.push_back(parameter<std::string>("params_backend", ParamType::String, Context | Upscaler, [](const std::string& value, sd::OptConfig& config) { config.context.params_backend = value.c_str(); }));
diff --git a/src/conditioning/conditioner.hpp b/src/conditioning/conditioner.hpp
index 980e745..a5dd10c 100644
--- a/src/conditioning/conditioner.hpp
+++ b/src/conditioning/conditioner.hpp
@@ -3,6 +3,7 @@

 #include <cinttypes>
 #include <cmath>
+#include <functional>
 #include <iomanip>
 #include <iterator>
 #include <limits>
@@ -170,7 +171,13 @@ public:
     virtual void set_graph_cut_layer_split_enabled(bool enabled) {}
     virtual void set_graph_cut_layer_split_backend_vram_limits(const std::vector<size_t>& limits) {}
     virtual void get_layer_split_param_tensors(std::map<std::string, ggml_tensor*>& tensors) {}
-    virtual void set_flash_attention_enabled(bool enabled) = 0;
+    virtual void for_each_runner(const std::function<void(GGMLRunner&)>& visit) = 0;
+    void set_flash_attention_enabled(bool enabled) {
+        for_each_runner([enabled](GGMLRunner& runner) { runner.set_flash_attention_enabled(enabled); });
+    }
+    void set_linear_i8_enabled(bool enabled) {
+        for_each_runner([enabled](GGMLRunner& runner) { runner.set_linear_i8_enabled(enabled); });
+    }
     virtual void set_scale_overrides(float linear_scale, float attn_scale) {}
     virtual void set_weight_adapter(const std::shared_ptr<WeightAdapter>& adapter) {}
     virtual void runner_end() {}
@@ -257,10 +264,10 @@ struct FrozenCLIPEmbedderWithCustomWords : public Conditioner {
         }
     }

-    void set_flash_attention_enabled(bool enabled) override {
-        text_model->set_flash_attention_enabled(enabled);
+    void for_each_runner(const std::function<void(GGMLRunner&)>& visit) override {
+        visit(*text_model);
         if (sd_version_is_sdxl(version)) {
-            text_model2->set_flash_attention_enabled(enabled);
+            visit(*text_model2);
         }
     }

@@ -785,15 +792,15 @@ struct SD3CLIPEmbedder : public Conditioner {
         }
     }

-    void set_flash_attention_enabled(bool enabled) override {
+    void for_each_runner(const std::function<void(GGMLRunner&)>& visit) override {
         if (clip_l) {
-            clip_l->set_flash_attention_enabled(enabled);
+            visit(*clip_l);
         }
         if (clip_g) {
-            clip_g->set_flash_attention_enabled(enabled);
+            visit(*clip_g);
         }
         if (t5) {
-            t5->set_flash_attention_enabled(enabled);
+            visit(*t5);
         }
     }

@@ -1216,12 +1223,12 @@ struct FluxCLIPEmbedder : public Conditioner {
         }
     }

-    void set_flash_attention_enabled(bool enabled) override {
+    void for_each_runner(const std::function<void(GGMLRunner&)>& visit) override {
         if (clip_l) {
-            clip_l->set_flash_attention_enabled(enabled);
+            visit(*clip_l);
         }
         if (t5) {
-            t5->set_flash_attention_enabled(enabled);
+            visit(*t5);
         }
     }

@@ -1501,9 +1508,9 @@ struct T5CLIPEmbedder : public Conditioner {
         }
     }

-    void set_flash_attention_enabled(bool enabled) override {
+    void for_each_runner(const std::function<void(GGMLRunner&)>& visit) override {
         if (t5) {
-            t5->set_flash_attention_enabled(enabled);
+            visit(*t5);
         }
     }

@@ -1722,9 +1729,9 @@ struct MiniT2IConditioner : public Conditioner {
         }
     }

-    void set_flash_attention_enabled(bool enabled) override {
+    void for_each_runner(const std::function<void(GGMLRunner&)>& visit) override {
         if (t5) {
-            t5->set_flash_attention_enabled(enabled);
+            visit(*t5);
         }
     }

@@ -1789,9 +1796,7 @@ struct SenseNovaU1Conditioner : public Conditioner {
         SD_UNUSED(tensors);
     }

-    void set_flash_attention_enabled(bool enabled) override {
-        SD_UNUSED(enabled);
-    }
+    void for_each_runner(const std::function<void(GGMLRunner&)>&) override {}

     SDCondition tokenize_condition(const std::string& text) {
         std::vector<int> tokens;
@@ -1869,8 +1874,8 @@ struct AnimaConditioner : public Conditioner {
         llm->get_param_tensors(tensors, "text_encoders.llm");
     }

-    void set_flash_attention_enabled(bool enabled) override {
-        llm->set_flash_attention_enabled(enabled);
+    void for_each_runner(const std::function<void(GGMLRunner&)>& visit) override {
+        visit(*llm);
     }

     void set_scale_overrides(float linear_scale, float attn_scale) override {
@@ -2193,16 +2198,16 @@ struct LLMEmbedder : public Conditioner {
         }
     }

-    void set_flash_attention_enabled(bool enabled) override {
-        llm->set_flash_attention_enabled(enabled);
+    void for_each_runner(const std::function<void(GGMLRunner&)>& visit) override {
+        visit(*llm);
         if (ph3_connector) {
-            ph3_connector->set_flash_attention_enabled(enabled);
+            visit(*ph3_connector);
         }
         if (clipproj_connector) {
-            clipproj_connector->set_flash_attention_enabled(enabled);
+            visit(*clipproj_connector);
         }
         if (byt5) {
-            byt5->set_flash_attention_enabled(enabled);
+            visit(*byt5);
         }
     }

@@ -3523,7 +3528,7 @@ struct MingImageEmbedder : public Conditioner {
     void get_layer_split_param_tensors(std::map<std::string, ggml_tensor*>& tensors) override {
         text_model->get_param_tensors(tensors, prefix);
     }
-    void set_flash_attention_enabled(bool enabled) override { text_model->set_flash_attention_enabled(enabled); }
+    void for_each_runner(const std::function<void(GGMLRunner&)>& visit) override { visit(*text_model); }
     void set_max_graph_vram_bytes(size_t bytes) override { text_model->set_max_graph_vram_bytes(bytes); }
     void set_runtime_backends(const std::vector<ggml_backend_t>& backends) override { text_model->set_runtime_backends(backends); }
     void set_graph_cut_layer_split_enabled(bool enabled) override { text_model->set_graph_cut_layer_split_enabled(enabled); }
@@ -3703,12 +3708,12 @@ struct LLaDAImageEmbedder : public Conditioner {
         llm->get_param_tensor_ops(tensor_ops);
     }

-    void set_flash_attention_enabled(bool enabled) override {
-        llm->set_flash_attention_enabled(enabled);
-        query_former->set_flash_attention_enabled(enabled);
-        text_projection->set_flash_attention_enabled(enabled);
+    void for_each_runner(const std::function<void(GGMLRunner&)>& visit) override {
+        visit(*llm);
+        visit(*query_former);
+        visit(*text_projection);
         if (sigvq != nullptr) {
-            sigvq->set_flash_attention_enabled(enabled);
+            visit(*sigvq);
         }
     }

@@ -3897,10 +3902,10 @@ struct LTXAVEmbedder : public Conditioner {
         connectors->model.get_param_tensor_ops(tensor_ops);
     }

-    void set_flash_attention_enabled(bool enabled) override {
-        llm->set_flash_attention_enabled(enabled);
-        projector->set_flash_attention_enabled(enabled);
-        connectors->set_flash_attention_enabled(enabled);
+    void for_each_runner(const std::function<void(GGMLRunner&)>& visit) override {
+        visit(*llm);
+        visit(*projector);
+        visit(*connectors);
     }

     void set_scale_overrides(float linear_scale, float attn_scale) override {
diff --git a/src/config.h b/src/config.h
index 5319863..c93e84a 100644
--- a/src/config.h
+++ b/src/config.h
@@ -119,6 +119,7 @@ namespace sd {
         float attn_scale{};                // Override flash-attention K/V scaling; 0 keeps the model default
         const char* tokenizer{};           // tokenizer.json path or main=FILE,clip-l=FILE,clip-g=FILE assignments; required for PiD and Lens
         bool sage_attn{};
+        const char* linear_type{};
         int conditioning_cache_size{};   // Maximum cached conditioning entries per context; 0 disables caching (default: 4)
         const char* flash_attn_mode{};   // on/off/auto or module assignments (e.g. "auto,te=off"); NULL/empty honors legacy flags.
         const char* conv_direct_mode{};  // on/off/auto or diffusion/vae/controlnet assignments; NULL/empty honors legacy flags.
diff --git a/src/core/cuda/CMakeLists.txt b/src/core/cuda/CMakeLists.txt
index 2f2a129..c6dab2c 100644
--- a/src/core/cuda/CMakeLists.txt
+++ b/src/core/cuda/CMakeLists.txt
@@ -2,7 +2,7 @@ cmake_policy(SET CMP0079 NEW)

 function(sd_cuda_sources VENDOR LANGUAGE)
     set(SOURCES)
-    foreach(OP rope int8 i8_lora_merge w4 convrot affine modulate bf16 rms_affine registration)
+    foreach(OP rope int8 requantize i8_lora_merge w4 convrot affine modulate bf16 rms_affine registration)
         set(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/${OP}_${VENDOR}.cu")
         string(TOUPPER "${VENDOR}" UPPER_VENDOR)
         file(GENERATE OUTPUT "${SOURCE}" CONTENT "#define SD_CUDA_VENDOR_${UPPER_VENDOR} 1\n#include \"core/cuda/${OP}.cu\"\n")
diff --git a/src/core/cuda/convrot.cu b/src/core/cuda/convrot.cu
index 9120804..e3a1724 100644
--- a/src/core/cuda/convrot.cu
+++ b/src/core/cuda/convrot.cu
@@ -44,7 +44,12 @@ namespace SD_CUDA_NAMESPACE {
             const ggml_tensor* shift      = nullptr;
             int64_t k, rows, stride, up_stride, gate_offset = 0, up_offset = 0;
             float eps = 0.f, scale = 1.f, bias = 0.f;
+            int group;
         };
+        static bool fused_group(int group) {
+            return group == 256 || group == 1;
+        }
+
         static bool vector_rms_input(const ggml_tensor* input, int64_t width) {
             if (width != 1024 && width != 2048 && width != 4096) {
                 return false;
@@ -56,17 +61,17 @@ namespace SD_CUDA_NAMESPACE {
             }
             return (reinterpret_cast<uintptr_t>(input->data) + offset) % 16 == 0;
         }
+
         static bool describe(ggml_tensor* const* nodes, int count, Operation& op) {
-            int group;
             const auto* first = nodes[0];
             const auto* quant = nodes[count - 1];
-            if (!sd_ggml_convrot_describe(quant, &group) || group != 256)
+            if (!sd_ggml_convrot_describe(quant, &op.group) || !fused_group(op.group))
                 return false;
             const auto* value = quant->src[0];
             op.k              = value->ne[0];
             op.rows           = ggml_nrows(value);
             op.input          = first->src[0];
-            if (!f32(op.input) || !f32(first) || op.k > INT_MAX || op.rows > INT_MAX)
+            if (!f32(op.input) || !f32(first) || op.k > INT_MAX || op.k % 256 || op.rows > INT_MAX)
                 return false;
             op.stride    = op.input->ne[0];
             op.up_stride = op.k;
@@ -129,6 +134,8 @@ namespace SD_CUDA_NAMESPACE {
                     return false;
             } else
                 return false;
+            if (op.group == 1 && (op.kind == SCALE || op.kind == NORM))
+                return false;
             for (int i = 0; i < count - 1; ++i) {
                 if (!f32(nodes[i]) || !ggml_are_same_shape(nodes[i], value))
                     return false;
@@ -168,7 +175,7 @@ namespace SD_CUDA_NAMESPACE {
             for (int i = 1; i < ggml_graph_n_nodes(graph); ++i) {
                 auto* quant = ggml_graph_node(graph, i);
                 int group;
-                if (!sd_ggml_convrot_describe(quant, &group) || group != 256)
+                if (!sd_ggml_convrot_describe(quant, &group) || !fused_group(group))
                     continue;
                 ggml_tensor* chain[6] = {};
                 int count             = 0;
@@ -250,13 +257,13 @@ namespace SD_CUDA_NAMESPACE {
             const auto x = reinterpret_cast<uintptr_t>(a->data), y = reinterpret_cast<uintptr_t>(b->data);
             return x <= y ? y - x < ggml_nbytes(a) : x - y < ggml_nbytes(b);
         }
-        template <bool Swiglu = false, bool Normalize = false, bool Scaled = false, bool Sigmoid = false, bool RMS = false, bool Modulate = false, bool Situ = false, bool Gelu = false, bool RMSVec = false>
-        static CUDAError launch(Plan& p, const Operation& op, int8_t* output, CUDAStream stream) {
+        template <bool Rotate, bool Swiglu, bool Normalize, bool Scaled, bool Sigmoid, bool RMS, bool Modulate, bool Situ, bool Gelu, bool RMSVec>
+        static CUDAError launch_quantize(Plan& p, const Operation& op, int8_t* output, CUDAStream stream) {
             constexpr bool warp = Scaled || RMS || Modulate || Gelu;
             constexpr int extra = Normalize ? 384 : RMS ? 256
                                                         : 128;
             if (!p.configured) {
-                auto status = cuda_set_shared_memory(quantize<Swiglu, false, Normalize, Scaled, warp, float, Sigmoid, RMS, Modulate, Situ, Gelu, RMSVec>,
+                auto status = cuda_set_shared_memory(quantize<Swiglu, false, Normalize, Scaled, warp, float, Sigmoid, RMS, Modulate, Situ, Gelu, RMSVec, Rotate>,
                                                      int(p.device.shared_memory - extra));
                 if (status != cuda_success)
                     return status;
@@ -269,11 +276,19 @@ namespace SD_CUDA_NAMESPACE {
                                                                                                                             : 256;
             const int64_t padded = (op.rows + 3) / 4 * 4;
             auto data            = [](const ggml_tensor* t) { return t ? static_cast<const float*>(t->data) : nullptr; };
-            quantize<Swiglu, false, Normalize, Scaled, warp, float, Sigmoid, RMS, Modulate, Situ, Gelu, RMSVec><<<unsigned(op.rows), threads, size_t(op.k) * sizeof(float), stream>>>(
+            quantize<Swiglu, false, Normalize, Scaled, warp, float, Sigmoid, RMS, Modulate, Situ, Gelu, RMSVec, Rotate><<<unsigned(op.rows), threads, size_t(op.k) * sizeof(float), stream>>>(
                 data(op.input) + op.gate_offset, output, reinterpret_cast<float*>(output + op.k * padded), op.k, op.rows, op.k,
                 op.up ? data(op.up) + op.up_offset : nullptr, op.stride, op.up_stride, nullptr, nullptr, data(op.modulation), op.eps, op.scale, op.bias, data(op.weight), data(op.shift));
             return cuda_last_error();
         }
+        template <bool Swiglu = false, bool Normalize = false, bool Scaled = false, bool Sigmoid = false, bool RMS = false, bool Modulate = false, bool Situ = false, bool Gelu = false, bool RMSVec = false>
+        static CUDAError launch(Plan& p, const Operation& op, int8_t* output, CUDAStream stream) {
+            if constexpr (Swiglu || RMS || Modulate || Gelu) {
+                if (op.group == 1)
+                    return launch_quantize<false, Swiglu, Normalize, Scaled, Sigmoid, RMS, Modulate, Situ, Gelu, RMSVec>(p, op, output, stream);
+            }
+            return launch_quantize<true, Swiglu, Normalize, Scaled, Sigmoid, RMS, Modulate, Situ, Gelu, RMSVec>(p, op, output, stream);
+        }
         static ggml_status execute(const ggml_ext_execution_context* execution, ggml_tensor* const* nodes, int count, void* state, void*) {
             auto& plan     = *static_cast<Plan*>(state);
             const auto& op = plan.op;
diff --git a/src/core/cuda/convrot_kernel.h b/src/core/cuda/convrot_kernel.h
index 6611e9b..c34330b 100644
--- a/src/core/cuda/convrot_kernel.h
+++ b/src/core/cuda/convrot_kernel.h
@@ -46,7 +46,40 @@ namespace SD_CUDA_NAMESPACE {
             return __fmul_rn(__fmul_rn(a, 1.0f / (1.0f + expf(-gate))), b);
         }

-        template <bool swiglu, bool dequantize = false, bool normalize = false, bool scaled = false, bool warp_rotation = false, typename T = float, bool sigmoid_gate = false, bool rms_modulation = false, bool modulate = false, bool situ_gate = false, bool gelu = false, bool rms_vec = false>
+        static __device__ __forceinline__ void rotate_h256(float (&v)[8], int lane) {
+            // One logical warp owns H256, keeping every butterfly in registers.
+#pragma unroll
+            for (int stride = 1; stride <= 4; stride *= 4) {
+                const int base = lane & ~(3 * stride);
+#pragma unroll
+                for (int j = 0; j < 8; ++j) {
+                    const float a = cuda_shuffle(v[j], base, 32);
+                    const float b = cuda_shuffle(v[j], base + stride, 32);
+                    const float c = cuda_shuffle(v[j], base + 2 * stride, 32);
+                    const float d = cuda_shuffle(v[j], base + 3 * stride, 32);
+                    v[j]          = convrot_h4_cuda(a, b, c, d, (lane / stride) % 4);
+                }
+            }
+#pragma unroll
+            for (int j = 0; j < 8; j += 2) {
+                const float a = cuda_shuffle(v[j], lane % 16, 32);
+                const float b = cuda_shuffle(v[j], lane % 16 + 16, 32);
+                const float c = cuda_shuffle(v[j + 1], lane % 16, 32);
+                const float d = cuda_shuffle(v[j + 1], lane % 16 + 16, 32);
+                v[j]          = convrot_h4_cuda(a, b, c, d, lane / 16);
+                v[j + 1]      = convrot_h4_cuda(a, b, c, d, 2 + lane / 16);
+            }
+#pragma unroll
+            for (int j = 0; j < 2; ++j) {
+                const float a = v[j], b = v[j + 2], c = v[j + 4], d = v[j + 6];
+#pragma unroll
+                for (int t = 0; t < 4; ++t) {
+                    v[j + 2 * t] = convrot_h4_cuda(a, b, c, d, t);
+                }
+            }
+        }
+
+        template <bool swiglu, bool dequantize = false, bool normalize = false, bool scaled = false, bool warp_rotation = false, typename T = float, bool sigmoid_gate = false, bool rms_modulation = false, bool modulate = false, bool situ_gate = false, bool gelu = false, bool rms_vec = false, bool rotate = true>
         __global__ void quantize(
             const T* src,
             int8_t* dst,
@@ -65,7 +98,9 @@ namespace SD_CUDA_NAMESPACE {
             float input_bias               = 0.0f,
             const float* rms_weight        = nullptr,
             const float* rms_shift         = nullptr) {
-            constexpr int group_size = 256;
+            constexpr int group_size       = 256;
+            constexpr float rotation_scale = rotate ? (1.0f / 16.0f) : 1.0f;
+            static_assert(rotate || swiglu || warp_rotation);

             const int64_t row = blockIdx.x;
             const int tid     = threadIdx.x;
@@ -132,7 +167,7 @@ namespace SD_CUDA_NAMESPACE {
                             if constexpr (gelu) {
                                 value = 0.5f * value * (1.0f + tanhf(0.7978845608028654f * value * (1.0f + 0.044715f * value * value)));
                             }
-                            v[j] = value * (1.0f / 16.0f);
+                            v[j] = value * rotation_scale;
                         } else {
                             float gate_value, up_value;
                             if constexpr (dequantize) {
@@ -145,42 +180,24 @@ namespace SD_CUDA_NAMESPACE {
                                 up_value   = up[row * up_stride + i];
                             }
                             if constexpr (situ_gate) {
-                                v[j] = situ(gate_value, up_value) * (1.0f / 16.0f);
+                                v[j] = situ(gate_value, up_value) * rotation_scale;
                             } else {
                                 const float activated = sigmoid_gate ? 1.0f / (1.0f + expf(-gate_value)) : (gate_value / (1.0f + expf(-gate_value)));
-                                v[j]                  = (activated * up_value) * (1.0f / 16.0f);
+                                v[j]                  = (activated * up_value) * rotation_scale;
                             }
                         }
                     }
-                    // One logical warp owns H256, keeping every butterfly in registers.
-#pragma unroll
-                    for (int stride = 1; stride <= 4; stride *= 4) {
-                        const int base = lane & ~(3 * stride);
+                    if constexpr (!rotate) {
 #pragma unroll
                         for (int j = 0; j < 8; ++j) {
-                            const float a = cuda_shuffle(v[j], base, 32);
-                            const float b = cuda_shuffle(v[j], base + stride, 32);
-                            const float c = cuda_shuffle(v[j], base + 2 * stride, 32);
-                            const float d = cuda_shuffle(v[j], base + 3 * stride, 32);
-                            v[j]          = convrot_h4_cuda(a, b, c, d, (lane / stride) % 4);
+                            values[group * group_size + j * 32 + lane] = v[j];
                         }
+                        continue;
                     }
+                    rotate_h256(v, lane);
 #pragma unroll
-                    for (int j = 0; j < 8; j += 2) {
-                        const float a = cuda_shuffle(v[j], lane % 16, 32);
-                        const float b = cuda_shuffle(v[j], lane % 16 + 16, 32);
-                        const float c = cuda_shuffle(v[j + 1], lane % 16, 32);
-                        const float d = cuda_shuffle(v[j + 1], lane % 16 + 16, 32);
-                        v[j]          = convrot_h4_cuda(a, b, c, d, lane / 16);
-                        v[j + 1]      = convrot_h4_cuda(a, b, c, d, 2 + lane / 16);
-                    }
-#pragma unroll
-                    for (int j = 0; j < 2; ++j) {
-                        const float a = v[j], b = v[j + 2], c = v[j + 4], d = v[j + 6];
-#pragma unroll
-                        for (int t = 0; t < 4; ++t) {
-                            values[group * group_size + (j + 2 * t) * 32 + lane] = convrot_h4_cuda(a, b, c, d, t);
-                        }
+                    for (int j = 0; j < 8; ++j) {
+                        values[group * group_size + j * 32 + lane] = v[j];
                     }
                 }
                 __syncthreads();
diff --git a/src/core/cuda/int8.cu b/src/core/cuda/int8.cu
index 7c57483..ebfa339 100644
--- a/src/core/cuda/int8.cu
+++ b/src/core/cuda/int8.cu
@@ -7,7 +7,7 @@
 struct SDI8CudaGemmPlan;
 #endif

-#include "runtime.h"
+#include "int8_common.h"
 #if defined(SD_CUDA_VENDOR_HIP)
 #include "hip_i8_gemm.h"
 #elif !defined(SD_CUDA_VENDOR_MUSA)
@@ -20,13 +20,10 @@ struct SDI8CudaGemmPlan;

 namespace SD_CUDA_NAMESPACE {
     namespace sd_i8_cuda {
-        template <int Width = 32>
-        static __device__ __forceinline__ float warp_reduce_max(float value) {
-#pragma unroll
-            for (int offset = Width / 2; offset > 0; offset >>= 1)
-                value = fmaxf(value, cuda_shuffle_xor(value, offset, Width));
-            return value;
-        }
+        using i8::aligned;
+        using i8::blas_supported;
+        using i8::warp_reduce_max;
+
         static __global__ void quantize_rowwise_i8_cuda(const float* src, int8_t* dst, float* scales, int64_t k, int64_t rows) {
             const int64_t row = blockIdx.x;
             const int tid     = threadIdx.x;
@@ -439,16 +436,6 @@ namespace SD_CUDA_NAMESPACE {
         }
 #endif

-        static bool aligned(const ggml_tensor* tensor, size_t alignment = 4) {
-            if (!tensor)
-                return true;
-            size_t offset = 0;
-            while (tensor->view_src) {
-                offset += tensor->view_offs;
-                tensor = tensor->view_src;
-            }
-            return (reinterpret_cast<uintptr_t>(tensor->data) + offset) % alignment == 0;
-        }
         static __global__ void mul_mat_i8_dot(const int* weights, const int* activations, int* output, int64_t words, int64_t n, int64_t rows) {
             constexpr int tile  = 32;
             constexpr int slice = 8;
@@ -518,11 +505,6 @@ namespace SD_CUDA_NAMESPACE {
             return cuda_last_error();
         }

-        static bool blas_supported(ggml_backend_dev_t device, const ggml_ext_gpu_device_info& info, int64_t n) {
-            return info.int8_blas && n % 4 == 0 &&
-                   ggml_backend_reg_get_proc_address(ggml_backend_dev_backend_reg(device), "ggml_ext_gpu_blas_v1");
-        }
-
         static bool supports(ggml_backend_dev_t device, const ggml_tensor* node, void*) {
             SDI8Operation op;
             if (!sd_ggml_i8_describe(node, &op) || !aligned(node))
@@ -596,7 +578,7 @@ namespace SD_CUDA_NAMESPACE {
             return disabled;
         }
 #ifdef SD_CUDA_I8_CUTLASS
-        static int64_t w4a8_chunk_cols(int64_t k) {
+        static int64_t decoded_chunk_cols(int64_t k) {
             constexpr int64_t decoded_bytes = 16 * 1024 * 1024;
             constexpr int64_t alignment     = 256;
             return std::max(alignment, decoded_bytes / k / alignment * alignment);
@@ -663,7 +645,7 @@ namespace SD_CUDA_NAMESPACE {
             if (!supports(device, mat, nullptr) || !sd_ggml_i8_describe(mat, &op) || !op.weight_scale || op.bias)
                 return 0;
 #ifdef SD_CUDA_I8_CUTLASS
-            if (op.codebook && mat->ne[0] > w4a8_chunk_cols(op.k()))
+            if (op.codebook && mat->ne[0] > decoded_chunk_cols(op.k()))
                 return 0;
 #endif
             const auto* next = ggml_graph_node(g, first + 1);
@@ -735,8 +717,8 @@ namespace SD_CUDA_NAMESPACE {
             bool situ             = false;
         };
 #ifdef SD_CUDA_I8_CUTLASS
-        static void prepare_w4a8_chunks(ggml_backend_dev_t device, Plan& p, size_t& workspace) {
-            const int64_t cols = w4a8_chunk_cols(p.k);
+        static void prepare_decoded_chunks(ggml_backend_dev_t device, Plan& p, size_t& workspace) {
+            const int64_t cols = decoded_chunk_cols(p.k);
             if (p.n <= cols || p.n % 128)
                 return;
             size_t chunk_bytes = 0, tail_bytes = 0;
@@ -792,7 +774,7 @@ namespace SD_CUDA_NAMESPACE {
                 if (p->use_blas && cutlass_compatible(op, dst) && (!op.bias || p->kind == MAT) &&
                     (p->kind != CONCAT || ggml_nbytes(dst->src[0]) % 16 == 0)) {
                     if (op.codebook && p->kind == MAT)
-                        prepare_w4a8_chunks(device, *p, gemm_bytes);
+                        prepare_decoded_chunks(device, *p, gemm_bytes);
                     if (p->kind == GATED || p->kind == SWIGLU_QUANTIZE) {
                         const auto activation = p->situ ? SDI8GemmActivation::Situ : SDI8GemmActivation::Swiglu;
                         p->gemm               = sd_cuda_i8_gemm_prepare(device, p->rows, p->n, p->k, activation, &gemm_bytes);
@@ -857,6 +839,33 @@ namespace SD_CUDA_NAMESPACE {
         }
 #endif
 #ifdef SD_CUDA_I8_CUTLASS
+        static void split_optimize(ggml_backend_dev_t device, ggml_cgraph* graph, void*) {
+            if (fusion_disabled())
+                return;
+            for (int i = 3; i < ggml_graph_n_nodes(graph); ++i) {
+                auto* glu = ggml_graph_node(graph, i);
+                if (glu->op != GGML_OP_GLU || !glu->src[1])
+                    continue;
+                auto* second = ggml_graph_node(graph, i - 1);
+                if (second != glu->src[0] && second != glu->src[1])
+                    continue;
+                auto* first = second == glu->src[0] ? glu->src[1] : glu->src[0];
+                if (ggml_graph_node(graph, i - 2) == first)
+                    continue;
+                ggml_tensor* nodes[] = {first, second, glu};
+                SDI8Operation gate, up;
+                if (!split_describe(device, nodes, gate, up))
+                    continue;
+                // Preparing the second weight can separate the two projections in the graph.
+                for (int j = i - 3; j >= std::max(0, i - 32); --j) {
+                    if (ggml_graph_node(graph, j) == first) {
+                        ggml_ext_graph_delay(graph, j, 1, i - 1);
+                        break;
+                    }
+                }
+            }
+        }
+
         static int split_match(ggml_backend_dev_t device, const ggml_cgraph* graph, int first, void*) {
             auto* g = const_cast<ggml_cgraph*>(graph);
             if (fusion_disabled() || first + 2 >= ggml_graph_n_nodes(g))
@@ -1331,6 +1340,7 @@ namespace SD_CUDA_NAMESPACE {
         desc.priority  = 260;
         desc.supports  = nullptr;
         desc.match     = sd_i8_cuda::split_match;
+        desc.optimize  = sd_i8_cuda::split_optimize;
         desc.prepare   = sd_i8_cuda::split_prepare;
         desc.execute   = sd_i8_cuda::split_execute;
         desc.destroy   = sd_i8_cuda::split_destroy;
diff --git a/src/core/cuda/int8_common.h b/src/core/cuda/int8_common.h
new file mode 100644
index 0000000..322241e
--- /dev/null
+++ b/src/core/cuda/int8_common.h
@@ -0,0 +1,32 @@
+#ifndef __SD_CORE_CUDA_INT8_COMMON_H__
+#define __SD_CORE_CUDA_INT8_COMMON_H__
+
+#include "runtime.h"
+
+namespace SD_CUDA_NAMESPACE::i8 {
+    template <int Width = 32>
+    static __device__ __forceinline__ float warp_reduce_max(float value) {
+#pragma unroll
+        for (int offset = Width / 2; offset > 0; offset >>= 1)
+            value = fmaxf(value, cuda_shuffle_xor(value, offset, Width));
+        return value;
+    }
+
+    static bool aligned(const ggml_tensor* tensor, size_t alignment = 4) {
+        if (!tensor)
+            return true;
+        size_t offset = 0;
+        while (tensor->view_src) {
+            offset += tensor->view_offs;
+            tensor = tensor->view_src;
+        }
+        return (reinterpret_cast<uintptr_t>(tensor->data) + offset) % alignment == 0;
+    }
+
+    static bool blas_supported(ggml_backend_dev_t device, const ggml_ext_gpu_device_info& info, int64_t n) {
+        return info.int8_blas && n % 4 == 0 &&
+               ggml_backend_reg_get_proc_address(ggml_backend_dev_backend_reg(device), "ggml_ext_gpu_blas_v1");
+    }
+}
+
+#endif  // __SD_CORE_CUDA_INT8_COMMON_H__
diff --git a/src/core/cuda/registration.cu b/src/core/cuda/registration.cu
index 134424f..339474e 100644
--- a/src/core/cuda/registration.cu
+++ b/src/core/cuda/registration.cu
@@ -10,6 +10,7 @@ void sd_ggml_register_cuda_window_attention(ggml_backend_dev_t device);
 namespace SD_CUDA_NAMESPACE {
     void register_rope(ggml_backend_dev_t device);
     void register_i8(ggml_backend_dev_t device);
+    void register_requantize(ggml_backend_dev_t device);
     void register_i8_lora_merge(ggml_backend_dev_t device);
     void register_w4(ggml_backend_dev_t device);
     void register_convrot(ggml_backend_dev_t device);
@@ -31,6 +32,7 @@ namespace SD_CUDA_NAMESPACE {
         register_affine(device);
         register_modulate(device);
         register_i8(device);
+        register_requantize(device);
         register_i8_lora_merge(device);
         register_w4(device);
         register_convrot(device);
diff --git a/src/core/cuda/requantize.cu b/src/core/cuda/requantize.cu
new file mode 100644
index 0000000..2da8131
--- /dev/null
+++ b/src/core/cuda/requantize.cu
@@ -0,0 +1,156 @@
+#include <climits>
+
+#include "convrot_kernel.h"
+#include "core/ggml_extensions.h"
+#include "int8_common.h"
+
+namespace SD_CUDA_NAMESPACE {
+    namespace {
+        using i8::aligned;
+        using i8::blas_supported;
+        using i8::warp_reduce_max;
+
+        // Match the GGML Q8_0 block layout checked by requantize_q8_supports().
+        struct Q8Block {
+            static constexpr int size  = 32;
+            static constexpr int pairs = size / 2;
+            half scale;
+            uint16_t values[pairs];
+        };
+        static_assert(sizeof(Q8Block) == 34);
+
+        static __device__ __forceinline__ int8_t requantize_q8_value(float value) {
+            return int8_t(__float2int_rn(fminf(127.f, fmaxf(-127.f, value))));
+        }
+
+        static __device__ __forceinline__ void load_rotated_group(const Q8Block* blocks, int lane, float (&values)[8]) {
+#pragma unroll
+            for (int j = 0; j < 8; ++j) {
+                const auto& block  = blocks[j];
+                const int8_t value = int8_t(block.values[lane / 2] >> (8 * (lane % 2)));
+                values[j]          = (float(value) * __half2float(block.scale)) * (1.0f / 16.0f);
+            }
+            sd_convrot::rotate_h256(values, lane);
+        }
+
+        constexpr int requantize_warps  = 8;
+        constexpr int blocks_per_group  = 256 / Q8Block::size;
+        constexpr int blocks_per_round  = requantize_warps * blocks_per_group;
+        constexpr int weights_per_round = blocks_per_round * Q8Block::size;
+
+        template <int cached_groups>
+        static __global__ void requantize_q8_weights(const Q8Block* weights, int8_t* decoded, float* scales, int64_t blocks_per_channel) {
+            const int lane     = threadIdx.x;
+            const int warp     = threadIdx.y;
+            const auto* blocks = weights + int64_t(blockIdx.x) * blocks_per_channel;
+            auto* output       = decoded + int64_t(blockIdx.x) * blocks_per_channel * Q8Block::size;
+
+            __shared__ float maxima[requantize_warps];
+            // Keep a bounded number of rotated groups in registers across the scale reduction.
+            float retained[cached_groups > 0 ? cached_groups : 1][8];
+            float maximum = 0.f;
+#pragma unroll
+            for (int64_t block = warp * blocks_per_group, slot = 0;
+                 cached_groups > 0 ? slot < cached_groups : block < blocks_per_channel;
+                 block += blocks_per_round, ++slot) {
+                if constexpr (cached_groups > 0) {
+                    if (block >= blocks_per_channel)
+                        break;
+                }
+                float values[8];
+                load_rotated_group(blocks + block, lane, values);
+#pragma unroll
+                for (int j = 0; j < 8; ++j) {
+                    if constexpr (cached_groups > 0)
+                        retained[slot][j] = values[j];
+                    maximum = fmaxf(maximum, fabsf(values[j]));
+                }
+            }
+            maximum = warp_reduce_max(maximum);
+            if (lane == 0)
+                maxima[warp] = maximum;
+            __syncthreads();
+            if (warp == 0) {
+                const float channel_max = warp_reduce_max(lane < requantize_warps ? maxima[lane] : 0.f);
+                if (lane == 0) {
+#if defined(SD_CUDA_VENDOR_MUSA)
+                    scales[blockIdx.x] = channel_max / 127.f;
+                    maxima[0]          = channel_max > 0.f ? 127.f / channel_max : 0.f;
+#else
+                    scales[blockIdx.x] = __fdiv_rn(channel_max, 127.f);
+                    maxima[0]          = channel_max > 0.f ? __fdiv_rn(127.f, channel_max) : 0.f;
+#endif
+                }
+            }
+            __syncthreads();
+
+            const float inverse = maxima[0];
+#pragma unroll
+            for (int64_t block = warp * blocks_per_group, slot = 0;
+                 cached_groups > 0 ? slot < cached_groups : block < blocks_per_channel;
+                 block += blocks_per_round, ++slot) {
+                if constexpr (cached_groups > 0) {
+                    if (block >= blocks_per_channel)
+                        break;
+                }
+                float values[8];
+                if constexpr (cached_groups == 0)
+                    load_rotated_group(blocks + block, lane, values);
+#pragma unroll
+                for (int j = 0; j < 8; ++j) {
+                    const float value                          = cached_groups > 0 ? retained[slot][j] : values[j];
+                    output[(block + j) * Q8Block::size + lane] = requantize_q8_value(value * inverse);
+                }
+            }
+        }
+
+        template <int cached_groups>
+        static void launch_requantize(const Q8Block* weights, int8_t* values, float* scales, int64_t k, int64_t n, CUDAStream stream) {
+            requantize_q8_weights<cached_groups><<<unsigned(n), dim3(Q8Block::size, requantize_warps), 0, stream>>>(
+                weights, values, scales, k / Q8Block::size);
+        }
+
+        static bool requantize_q8_supports(ggml_backend_dev_t device, const ggml_tensor* node, void*) {
+            const auto* weight = node->src[0];
+            const int64_t k = weight->ne[0], n = weight->ne[1];
+            const auto info = cuda_device_info(device);
+            return info.device >= 0 && k <= INT_MAX / 16384 && n <= INT_MAX && aligned(weight, alignof(Q8Block)) &&
+                   ggml_blck_size(GGML_TYPE_Q8_0) == Q8Block::size && ggml_type_size(GGML_TYPE_Q8_0) == sizeof(Q8Block) &&
+                   (cuda_kind != GGML_EXT_GPU_CUDA || blas_supported(device, info, n));
+        }
+
+        static ggml_status requantize_q8_execute(const ggml_ext_execution_context* execution, ggml_tensor* const* nodes, int, void*, void*) {
+            ggml_ext_gpu_context context;
+            if (!cuda_context(execution->backend, &context))
+                return GGML_STATUS_FAILED;
+            auto* dst          = nodes[0];
+            const auto* weight = dst->src[0];
+            const int64_t k = weight->ne[0], n = weight->ne[1];
+            auto* values        = static_cast<int8_t*>(dst->data);
+            auto* scales        = reinterpret_cast<float*>(values + k * n);
+            const auto* weights = static_cast<const Q8Block*>(weight->data);
+            const auto stream   = static_cast<CUDAStream>(context.stream);
+            if (cuda_kind == GGML_EXT_GPU_CUDA && k <= 2 * weights_per_round) {
+                launch_requantize<2>(weights, values, scales, k, n, stream);
+            } else if (cuda_kind == GGML_EXT_GPU_CUDA && k <= 4 * weights_per_round) {
+                launch_requantize<4>(weights, values, scales, k, n, stream);
+            } else if (cuda_kind == GGML_EXT_GPU_CUDA && k <= 8 * weights_per_round) {
+                launch_requantize<8>(weights, values, scales, k, n, stream);
+            } else {
+                launch_requantize<0>(weights, values, scales, k, n, stream);
+            }
+            return cuda_last_error() == cuda_success ? GGML_STATUS_SUCCESS : GGML_STATUS_FAILED;
+        }
+    }
+
+    void register_requantize(ggml_backend_dev_t device) {
+        ggml_ext_kernel_desc desc = {};
+        desc.abi_version          = GGML_EXT_ABI_VERSION;
+        desc.op                   = GGML_OP_CUSTOM;
+        desc.name                 = "sd.requantize_q8." SD_CUDA_NAME ".v1";
+        desc.custom_op            = sd_ggml_requantize_q8_op();
+        desc.supports             = requantize_q8_supports;
+        desc.execute              = requantize_q8_execute;
+        GGML_ASSERT(ggml_ext_register_kernel_ex(device, &desc, GGML_EXT_KERNEL_CAPTURE_SAFE | GGML_EXT_KERNEL_REPLAY_REUSABLE));
+    }
+}
diff --git a/src/core/ggml_extend.cpp b/src/core/ggml_extend.cpp
index 514db69..27e11bf 100644
--- a/src/core/ggml_extend.cpp
+++ b/src/core/ggml_extend.cpp
@@ -214,21 +214,49 @@ ggml_tensor* ggml_ext_linear(GGMLRunnerContext* runner_ctx,
     if (scale != 1.f) {
         x = ggml_ext_scale(runner_ctx, x, scale);
     }
+    const auto mul_mat = [&](ggml_tensor* input) {
+#ifndef SD_USE_UPSTREAM_GGML
+        // The INT8 path accumulates in INT32 and rescales in FP32.
+        if (runner_ctx->requantize_to_i8 && w->type == GGML_TYPE_Q8_0 && input->type == GGML_TYPE_F32 &&
+            (sd_backend_is(runner_ctx->backend, "CUDA") ||
+             sd_backend_is(runner_ctx->backend, "ROCm") ||
+             sd_backend_is(runner_ctx->backend, "MUSA") ||
+             sd_backend_is(runner_ctx->backend, "Vulkan"))) {
+            constexpr int group = 256;
+            auto* quantized     = ggml_ext_quantize_i8_convrot(runner_ctx, input, group);
+            if (quantized && ggml_backend_supports_op(runner_ctx->backend, quantized)) {
+                // Make the conversion depend on the activation so decoded weights only live near their GEMM.
+                ggml_tensor* inputs[] = {w, quantized};
+                auto* converted       = ggml_ext_op_create(ctx, sd_ggml_requantize_q8_op(), inputs, 2, nullptr);
+                if (converted && ggml_backend_supports_op(runner_ctx->backend, converted)) {
+                    const int64_t k = w->ne[0], n = w->ne[1];
+                    auto* weight = ggml_view_2d(ctx, converted, k, n, k, 0);
+                    auto* scales = ggml_view_1d(ctx, converted, n * sizeof(float), k * n);
+                    // The output stores float scales after the dense INT8 matrix.
+                    scales->type  = GGML_TYPE_F32;
+                    scales->ne[0] = n;
+                    scales->nb[0] = sizeof(float);
+                    auto* result  = ggml_ext_mul_mat_i8_tensorwise(runner_ctx, weight, quantized, scales, nullptr, group);
+                    if (result && ggml_backend_supports_op(runner_ctx->backend, result))
+                        return result;
+                }
+            }
+        }
+#endif
+        auto* result = ggml_mul_mat(ctx, w, input);
+        if (force_prec_f32)
+            ggml_prec_set_acc(result, GGML_PREC_F32);
+        return result;
+    };
     if (x->ne[2] * x->ne[3] > 1024) {
         // workaround: avoid ggml cuda error
         int64_t ne2 = x->ne[2];
         int64_t ne3 = x->ne[3];
         x           = ggml_reshape_2d(ctx, x, x->ne[0], x->ne[1] * x->ne[2] * x->ne[3]);
-        x           = ggml_mul_mat(ctx, w, x);
-        if (force_prec_f32) {
-            ggml_prec_set_acc(x, GGML_PREC_F32);
-        }
-        x = ggml_reshape_4d(ctx, x, x->ne[0], x->ne[1] / ne2 / ne3, ne2, ne3);
+        x           = mul_mat(x);
+        x           = ggml_reshape_4d(ctx, x, x->ne[0], x->ne[1] / ne2 / ne3, ne2, ne3);
     } else {
-        x = ggml_mul_mat(ctx, w, x);
-        if (force_prec_f32) {
-            ggml_prec_set_acc(x, GGML_PREC_F32);
-        }
+        x = mul_mat(x);
     }
     if (scale != 1.f) {
         x = ggml_ext_scale(runner_ctx, x, 1.f / scale);
diff --git a/src/core/ggml_extend_backend.cpp b/src/core/ggml_extend_backend.cpp
index dbf9044..4439af1 100644
--- a/src/core/ggml_extend_backend.cpp
+++ b/src/core/ggml_extend_backend.cpp
@@ -850,6 +850,25 @@ bool sd_parse_conv_direct_assignment(const std::string& spec, SDBackendAssignmen
     return parse_operation_assignment(spec, assignment, error, true);
 }

+bool sd_parse_linear_type_assignment(const std::string& spec, SDBackendAssignment* assignment, std::string* error) {
+    if (!sd_parse_backend_assignment(spec, assignment, error)) {
+        return false;
+    }
+    const auto valid_mode = [](const std::string& mode) {
+        return mode == "auto" || mode == "i8" || mode == "raw";
+    };
+    if (assignment->empty() ||
+        (!assignment->default_name.empty() && !valid_mode(assignment->default_name)) ||
+        !std::all_of(assignment->module_names.begin(), assignment->module_names.end(),
+                     [&](const auto& entry) { return valid_mode(entry.second); })) {
+        if (error) {
+            *error = "linear_type expects auto, i8, raw, or module assignments such as dit=i8";
+        }
+        return false;
+    }
+    return true;
+}
+
 bool SDBackendAssignment::empty() const {
     return default_name.empty() && module_names.empty();
 }
diff --git a/src/core/ggml_extend_backend.h b/src/core/ggml_extend_backend.h
index d16ef51..893aed1 100644
--- a/src/core/ggml_extend_backend.h
+++ b/src/core/ggml_extend_backend.h
@@ -109,6 +109,7 @@ std::string sd_backend_resolve_name(const std::string& name);
 bool sd_parse_backend_assignment(const std::string& spec, SDBackendAssignment* assignment, std::string* error);
 bool sd_parse_flash_attention_assignment(const std::string& spec, SDBackendAssignment* assignment, std::string* error);
 bool sd_parse_conv_direct_assignment(const std::string& spec, SDBackendAssignment* assignment, std::string* error);
+bool sd_parse_linear_type_assignment(const std::string& spec, SDBackendAssignment* assignment, std::string* error);
 const char* sd_backend_module_name(SDBackendModule module);
 void ggml_ext_im_set_f32_1d(const struct ggml_tensor* tensor, int i, float value);
 bool add_rpc_devices(const std::string& servers);
diff --git a/src/core/ggml_extensions.cpp b/src/core/ggml_extensions.cpp
index 435f5d7..2225245 100644
--- a/src/core/ggml_extensions.cpp
+++ b/src/core/ggml_extensions.cpp
@@ -252,6 +252,23 @@ static bool i8_infer(ggml_tensor* const* inputs, int count, const void* attribut
     return true;
 }

+static bool requantize_q8_infer(ggml_tensor* const* inputs, int count, const void*, ggml_ext_tensor_desc* output) {
+    if (count != 2 || !inputs[0] || !inputs[1] || inputs[0]->type != GGML_TYPE_Q8_0 || inputs[1]->type != GGML_TYPE_I8)
+        return false;
+    const auto* weight = inputs[0];
+    const int64_t k = weight->ne[0], n = weight->ne[1];
+    constexpr int64_t scale_bytes = sizeof(float);
+    int group;
+    if (!sd_ggml_convrot_describe(inputs[1], &group) || group != 256 || k % group ||
+        weight->ne[2] != 1 || weight->ne[3] != 1 || !ggml_is_contiguous(weight) ||
+        k <= 0 || k > i8_size_limit - scale_bytes || n <= 0 || inputs[1]->ne[0] != k || n > i8_size_limit / (k + scale_bytes))
+        return false;
+    output->type  = GGML_TYPE_I8;
+    output->ne[0] = (k + scale_bytes) * n;
+    output->ne[1] = output->ne[2] = output->ne[3] = 1;
+    return true;
+}
+
 static bool convrot_infer(ggml_tensor* const* inputs, int count, const void* attributes, ggml_ext_tensor_desc* output) {
     int32_t group;
     std::memcpy(&group, attributes, sizeof(group));
@@ -273,6 +290,16 @@ ggml_ext_op_t sd_ggml_i8_op() {
     return op;
 }

+ggml_ext_op_t sd_ggml_requantize_q8_op() {
+    static const auto op = [] {
+        const ggml_ext_op_desc desc = {GGML_EXT_ABI_VERSION, "sd.requantize_q8.v1", 0, requantize_q8_infer};
+        const auto result           = ggml_ext_register_op(&desc);
+        GGML_ASSERT(result);
+        return result;
+    }();
+    return op;
+}
+
 ggml_ext_op_t sd_ggml_convrot_op() {
     static const auto op = [] { ggml_ext_op_desc d = {GGML_EXT_ABI_VERSION, "sd.quantize_i8_convrot.v1", sizeof(int32_t), convrot_infer}; auto result = ggml_ext_register_op(&d); GGML_ASSERT(result); return result; }();
     return op;
diff --git a/src/core/ggml_extensions.h b/src/core/ggml_extensions.h
index d96223f..5a5f4cb 100644
--- a/src/core/ggml_extensions.h
+++ b/src/core/ggml_extensions.h
@@ -48,6 +48,7 @@ struct SDI8Operation {
 bool sd_ggml_valid_convrot_group(int group);

 ggml_ext_op_t sd_ggml_i8_op();
+ggml_ext_op_t sd_ggml_requantize_q8_op();

 ggml_ext_op_t sd_ggml_convrot_op();

diff --git a/src/core/ggml_runner.cpp b/src/core/ggml_runner.cpp
index b65c5ab..6ffea31 100644
--- a/src/core/ggml_runner.cpp
+++ b/src/core/ggml_runner.cpp
@@ -193,6 +193,7 @@ GGMLRunnerContext GGMLRunner::get_context(ggml_cgraph* graph) {
     runner_ctx.backend               = runtime_backend;
     runner_ctx.flash_attn_enabled    = flash_attn_enabled;
     runner_ctx.sage_attn_enabled     = sage_attn_enabled;
+    runner_ctx.requantize_to_i8      = requantize_to_i8;
     runner_ctx.conv_scale            = conv_scale;
     runner_ctx.linear_scale          = linear_scale;
     runner_ctx.attn_scale            = attn_scale;
diff --git a/src/core/ggml_runner.h b/src/core/ggml_runner.h
index c18b92f..6cd8032 100644
--- a/src/core/ggml_runner.h
+++ b/src/core/ggml_runner.h
@@ -79,6 +79,7 @@ struct GGMLRunnerContext {
     ggml_cgraph* graph                                               = nullptr;
     bool flash_attn_enabled                                          = false;
     bool sage_attn_enabled                                           = false;
+    bool requantize_to_i8                                            = false;
     float linear_scale                                               = 0.f;
     float conv_scale                                                 = 0.f;
     float attn_scale                                                 = 0.f;
@@ -169,6 +170,7 @@ protected:

     bool flash_attn_enabled    = false;
     bool sage_attn_enabled     = false;
+    bool requantize_to_i8      = false;
     float linear_scale         = 0.f;
     float conv_scale           = 0.f;
     float attn_scale           = 0.f;
@@ -317,6 +319,10 @@ public:
         }
     }

+    void set_linear_i8_enabled(bool enabled) {
+        requantize_to_i8 = enabled;
+    }
+
     void set_scale_overrides(float linear_scale, float attn_scale, float conv_scale = 0.f) {
         this->linear_scale = linear_scale;
         this->attn_scale   = attn_scale;
diff --git a/src/core/vulkan/CMakeLists.txt b/src/core/vulkan/CMakeLists.txt
index bfc4c71..a1a095f 100644
--- a/src/core/vulkan/CMakeLists.txt
+++ b/src/core/vulkan/CMakeLists.txt
@@ -54,6 +54,11 @@ sd_vulkan_shader(rms_rope_apply rms_rope_apply ON)
 sd_vulkan_shader(rms_rope_cast rms_rope_apply ON -DCAST_F16)
 sd_vulkan_shader(quantize_i8_convrot quantize_i8_convrot ${SD_VK_DOT} -O)
 sd_vulkan_shader(quantize_i8_convrot_h64 quantize_i8_convrot_h64 ${SD_VK_DOT} -O -DGROUP_SIZE=64)
+sd_vulkan_shader(quantize_i8_rowwise pack_i8_rows ${SD_VK_DOT} -O)
+sd_vulkan_shader(requantize_q8 pack_i8_rows ${SD_VK_DOT} -O -DQ8_0=1)
+sd_vulkan_shader(quantize_i8_rowwise_subgroup pack_i8_rows ${SD_VK_DOT} -O -DSUBGROUP_MAX=1)
+sd_vulkan_shader(requantize_q8_subgroup pack_i8_rows ${SD_VK_DOT} -O -DQ8_0=1 -DQ8_HALFWORDS=1 -DSUBGROUP_MAX=1)
+sd_vulkan_shader(requantize_q8_register pack_i8_rows ${SD_VK_DOT} -O -DQ8_0=1 -DQ8_HALFWORDS=1 -DSUBGROUP_MAX=1 -DQ8_RETAIN=1)
 sd_vulkan_shader(i8_lora_merge i8_lora_merge ON -O)
 sd_vulkan_shader(mul_mat_w4a4_convrot mul_mat_w4a4_convrot ${SD_VK_DOT} -O)
 sd_vulkan_shader(decode_w4a8 decode_w4a8 ON -O)
@@ -64,6 +69,9 @@ sd_vulkan_shader(quantize_i8_convrot_register quantize_i8_convrot_subgroup ${SD_
 sd_vulkan_shader(swiglu_quantize_i8_convrot quantize_i8_convrot_subgroup ${SD_VK_DOT} -O -DSWIGLU=1)
 sd_vulkan_shader(swiglu_quantize_i8_convrot_16384 quantize_i8_convrot_subgroup ${SD_VK_DOT} -O -DSWIGLU=1 -DSINGLE_PASS=1 -DSTATIC_K=16384)
 sd_vulkan_shader(sigmoid_quantize_i8_convrot_6144 quantize_i8_convrot_subgroup ${SD_VK_DOT} -O -DSIGMOID_MUL=1 -DSINGLE_PASS=1 -DSTATIC_K=6144)
+sd_vulkan_shader(swiglu_quantize_i8_rowwise quantize_i8_convrot_subgroup ${SD_VK_DOT} -O -DSWIGLU=1 -DUNROTATED=1)
+sd_vulkan_shader(swiglu_quantize_i8_rowwise_16384 quantize_i8_convrot_subgroup ${SD_VK_DOT} -O -DSWIGLU=1 -DUNROTATED=1 -DSINGLE_PASS=1 -DSTATIC_K=16384)
+sd_vulkan_shader(sigmoid_quantize_i8_rowwise_6144 quantize_i8_convrot_subgroup ${SD_VK_DOT} -O -DSIGMOID_MUL=1 -DUNROTATED=1 -DSINGLE_PASS=1 -DSTATIC_K=6144)
 sd_vulkan_shader(modulate_convrot modulate_convrot ${SD_VK_DOT} -O)
 sd_vulkan_shader(rms_modulate_convrot modulate_convrot ${SD_VK_DOT} -O -DRMS_AFFINE=1)
 sd_vulkan_shader(mul_mat_i8_tensorwise mul_mat_i8_tensorwise ${SD_VK_DOT} -O)
diff --git a/src/core/vulkan/int8.cpp b/src/core/vulkan/int8.cpp
index 2b60df8..3688f87 100644
--- a/src/core/vulkan/int8.cpp
+++ b/src/core/vulkan/int8.cpp
@@ -21,10 +21,18 @@
 #include "quantize_i8_convrot_h64.h"
 #include "quantize_i8_convrot_register.h"
 #include "quantize_i8_convrot_subgroup.h"
+#include "quantize_i8_rowwise.h"
+#include "quantize_i8_rowwise_subgroup.h"
+#include "requantize_q8.h"
+#include "requantize_q8_register.h"
+#include "requantize_q8_subgroup.h"
 #include "rms_modulate_convrot.h"
 #include "sigmoid_quantize_i8_convrot_6144.h"
+#include "sigmoid_quantize_i8_rowwise_6144.h"
 #include "swiglu_quantize_i8_convrot.h"
 #include "swiglu_quantize_i8_convrot_16384.h"
+#include "swiglu_quantize_i8_rowwise.h"
+#include "swiglu_quantize_i8_rowwise_16384.h"

 namespace sd_vulkan_i8 {
     // Keep these budgets in sync with the cooperative matrix shader tile layouts.
@@ -106,11 +114,14 @@ namespace sd_vulkan_i8 {
     static bool can_modulate(const Device& d, int64_t k, bool affine) {
         return (k == 4096 || k == 6144 || (affine && k == 5376)) && d.info.max_group_invocations >= 512 && d.info.max_group_size[0] >= 512 && d.compute.shared_memory >= (k + 1024) * 4;
     }
-    static bool can_quantize(const Device& d, const ggml_tensor* dst) {
+    static bool can_quantize(const Device& d, const ggml_tensor* dst, bool allow_unrotated = false) {
         int group;
-        if (!sd_ggml_convrot_describe(dst, &group) || group != 256 || !bounded(d, dst) || !bounded(d, dst->src[0]))
+        if (!sd_ggml_convrot_describe(dst, &group) || (group != 256 && !(allow_unrotated && group == 1)) ||
+            !bounded(d, dst) || !bounded(d, dst->src[0]))
             return false;
         const auto* x = dst->src[0];
+        if (group == 1 && (x->ne[0] % 256 || (uint64_t(x->ne[0]) * GGML_PAD(ggml_nrows(x), 4)) % d.info.buffer_alignment))
+            return false;
         return x->ne[0] <= UINT32_MAX && ggml_nrows(x) <= UINT32_MAX && d.info.max_group_invocations >= 256 && d.info.max_group_size[0] >= 256;
     }
     static uint64_t w4a8_chunk_cols(const Device& d, const SDI8Operation& op) {
@@ -170,7 +181,7 @@ namespace sd_vulkan_i8 {
             mul->op != GGML_OP_MUL || mul->src[1] != sigmoid ||
             !is_convrot(quant) || quant->src[0] != mul ||
             sigmoid->ne[0] != 6144 || !ggml_are_same_shape(sigmoid, mul->src[0]) ||
-            !can_quantize(device, quant)) {
+            !can_quantize(device, quant, true)) {
             return false;
         }
         for (const ggml_tensor* tensor : {sigmoid->src[0], mul->src[0]}) {
@@ -191,7 +202,7 @@ namespace sd_vulkan_i8 {
         if (glu->op != GGML_OP_GLU || ggml_get_glu_op(glu) != GGML_GLU_OP_SWIGLU ||
             glu->src[1] == nullptr || param_i32(glu, 1) != 0 ||
             !is_convrot(quant) || quant->src[0] != glu ||
-            !can_quantize(device, quant) || !ggml_is_contiguous(glu->src[0]) || !ggml_is_contiguous(glu->src[1])) {
+            !can_quantize(device, quant, true) || !ggml_is_contiguous(glu->src[0]) || !ggml_is_contiguous(glu->src[1])) {
             return false;
         }
         for (const ggml_tensor* tensor : {glu->src[0], glu->src[1]}) {
@@ -207,7 +218,7 @@ namespace sd_vulkan_i8 {
             return 0;
         }
         const ggml_tensor* quant = node(graph, quant_idx);
-        if (!is_convrot(quant) || !can_quantize(device, quant)) {
+        if (!is_convrot(quant) || !can_quantize(device, quant, true)) {
             return 0;
         }
         const ggml_tensor* nodes[4]{};
@@ -482,6 +493,9 @@ namespace sd_vulkan_i8 {
     struct QuantParameters {
         uint32_t k, rows;
     };
+    struct PackParameters {
+        uint32_t words_per_row, rows, scale_offset;
+    };
     struct ModulateParameters {
         uint32_t rows, x_offset, m_offset, h_offset;
         float eps;
@@ -492,7 +506,9 @@ namespace sd_vulkan_i8 {
         float output_scale;
         uint32_t group_cols, output_stride, output_col;
     };
-    static_assert(sizeof(QuantParameters) == 8 && sizeof(ModulateParameters) == 28 && sizeof(MatParameters) == 36, "INT8 push constant layout mismatch");
+    static_assert(sizeof(QuantParameters) == 8 && sizeof(PackParameters) == 12 &&
+                      sizeof(ModulateParameters) == 28 && sizeof(MatParameters) == 36,
+                  "INT8 push constant layout mismatch");
     template <size_t N>
     static ggml_ext_vulkan_pipeline shader(const char* name, const uint32_t (&spirv)[N], uint32_t bindings, uint32_t constants) {
         return {name, spirv, sizeof(spirv), bindings, constants, nullptr, 0, 0, false};
@@ -531,7 +547,36 @@ namespace sd_vulkan_i8 {
         }
         return status;
     }
-    static ggml_status quantize(const ggml_ext_execution_context* e, const Device& d, ggml_tensor* const* nodes, int count) {
+    static ggml_status pack_rows(const ggml_ext_execution_context* e, const Device& d, const ggml_tensor* output) {
+        const auto* input       = output->src[0];
+        const bool q8           = input->type == GGML_TYPE_Q8_0;
+        const uint32_t words    = uint32_t(input->ne[0] / 4);
+        const uint32_t rows     = uint32_t(ggml_nrows(input));
+        const PackParameters pc = {words, rows, words * (q8 ? rows : GGML_PAD(rows, 4))};
+        ggml_ext_vulkan_binding dst;
+        bool alias;
+        if (!output_binding(e, d, output, {{input}}, dst, alias))
+            return GGML_STATUS_FAILED;
+        const ggml_ext_vulkan_binding bindings[] = {{input}, dst};
+        const uint32_t groups[]                  = {std::min(rows, d.info.max_group_count[0]), 1, 1};
+        auto pipeline                            = q8 ? SD_VK_PIPELINE(requantize_q8, 2, PackParameters) : SD_VK_PIPELINE(quantize_i8_rowwise, 2, PackParameters);
+        constexpr uint32_t words_per_round       = 8 * 64;
+        const uint32_t cached_groups             = words <= 2 * words_per_round ? 2 : words <= 4 * words_per_round ? 4
+                                                                                                                   : 8;
+        if (d.subgroup && (!q8 || d.info.float16)) {
+            if (q8 && words <= cached_groups * words_per_round && d.info.max_group_size[0] >= 256) {
+                pipeline                = SD_VK_PIPELINE(requantize_q8_register, 2, PackParameters);
+                pipeline.constants      = &cached_groups;
+                pipeline.constant_count = 1;
+            } else {
+                pipeline = q8 ? SD_VK_PIPELINE(requantize_q8_subgroup, 2, PackParameters) : SD_VK_PIPELINE(quantize_i8_rowwise_subgroup, 2, PackParameters);
+            }
+            pipeline.full_subgroups         = d.info.full_subgroups;
+            pipeline.required_subgroup_size = d.info.subgroup_size_control ? 32 : 0;
+        }
+        return finish(e, d, output, dst, alias, d.api->dispatch(e->backend, &pipeline, bindings, &pc, groups));
+    }
+    static ggml_status quantize(const ggml_ext_execution_context* e, const Device& d, ggml_tensor* const* nodes, int count, int group) {
         const auto* output                          = nodes[count - 1];
         const auto* first                           = nodes[0];
         const bool modulate                         = count > 1 && (first->op == GGML_OP_NORM || sd_ggml_modulate_describe(first) || first->op == GGML_OP_RMS_NORM);
@@ -578,18 +623,15 @@ namespace sd_vulkan_i8 {
                     *offsets[i] = info.shader_offset / 4;
                 }
             auto pipeline              = rms ? SD_VK_PIPELINE(rms_modulate_convrot, 6, ModulateParameters) : SD_VK_PIPELINE(modulate_convrot, 5, ModulateParameters);
-            const uint32_t constants[] = {k, uint32_t(affine), uint32_t(shift != nullptr)};
+            const uint32_t constants[] = {k, uint32_t(affine), uint32_t(shift != nullptr), uint32_t(group == 256)};
             pipeline.constants         = constants;
-            pipeline.constant_count    = 3;
+            pipeline.constant_count    = 4;
             status                     = d.api->dispatch(e->backend, &pipeline, bindings.data(), &pc, groups);
         } else {
             ggml_ext_vulkan_binding bindings[] = {{x}, packed, scales, {up}};
-            int group;
-            if (!sd_ggml_convrot_describe(output, &group))
-                return GGML_STATUS_FAILED;
-            auto pipeline  = group == 64 ? SD_VK_PIPELINE(quantize_i8_convrot_h64, 3, QuantParameters) : SD_VK_PIPELINE(quantize_i8_convrot, 3, QuantParameters);
-            bool subgroup  = group == 256 && d.subgroup && k >= 1024;
-            uint32_t width = k;
+            auto pipeline                      = group == 64 ? SD_VK_PIPELINE(quantize_i8_convrot_h64, 3, QuantParameters) : SD_VK_PIPELINE(quantize_i8_convrot, 3, QuantParameters);
+            bool subgroup                      = group == 256 && d.subgroup && k >= 1024;
+            uint32_t width                     = k;
             if (subgroup) {
                 pipeline = SD_VK_PIPELINE(quantize_i8_convrot_subgroup, 3, QuantParameters);
                 if (!up && ((uint64_t(k) + 2047) / 2048) * 8 <= 64) {
@@ -600,9 +642,15 @@ namespace sd_vulkan_i8 {
             }
             if (up) {
                 subgroup = true;
-                pipeline = k == 16384 ? SD_VK_PIPELINE(swiglu_quantize_i8_convrot_16384, 4, QuantParameters) : SD_VK_PIPELINE(swiglu_quantize_i8_convrot, 4, QuantParameters);
-                if (sigmoid)
-                    pipeline = SD_VK_PIPELINE(sigmoid_quantize_i8_convrot_6144, 4, QuantParameters);
+                if (group == 1) {
+                    pipeline = k == 16384 ? SD_VK_PIPELINE(swiglu_quantize_i8_rowwise_16384, 4, QuantParameters) : SD_VK_PIPELINE(swiglu_quantize_i8_rowwise, 4, QuantParameters);
+                    if (sigmoid)
+                        pipeline = SD_VK_PIPELINE(sigmoid_quantize_i8_rowwise_6144, 4, QuantParameters);
+                } else {
+                    pipeline = k == 16384 ? SD_VK_PIPELINE(swiglu_quantize_i8_convrot_16384, 4, QuantParameters) : SD_VK_PIPELINE(swiglu_quantize_i8_convrot, 4, QuantParameters);
+                    if (sigmoid)
+                        pipeline = SD_VK_PIPELINE(sigmoid_quantize_i8_convrot_6144, 4, QuantParameters);
+                }
             }
             if (subgroup) {
                 pipeline.full_subgroups         = d.info.full_subgroups;
@@ -811,6 +859,31 @@ namespace sd_vulkan_i8 {
         auto status             = d.api->dispatch(e->backend, &pipeline, bindings.data(), &pc, groups);
         return finish(e, d, output, dst, alias, status);
     }
+    static bool can_pack_rows(const Device& d, const ggml_tensor* n) {
+        constexpr uint32_t threads = 128;
+        const auto* input          = n->src[0];
+        const size_t alignment     = input->type == GGML_TYPE_Q8_0 ? sizeof(uint32_t) : 4 * sizeof(float);
+        return bounded(d, n) && bounded(d, input) &&
+               aligned(n, sizeof(uint32_t)) && aligned(input, alignment) &&
+               ggml_nbytes(n) <= UINT32_MAX && ggml_nbytes(input) <= UINT32_MAX &&
+               d.info.max_group_invocations >= threads && d.info.max_group_size[0] >= threads &&
+               d.info.max_push_constants >= sizeof(PackParameters) && d.compute.shared_memory >= threads * sizeof(float);
+    }
+    static bool requantize_supports(ggml_backend_dev_t dev, const ggml_tensor* n, void*) {
+        Device d;
+        const auto k                       = n->src[0]->ne[0];
+        constexpr uint32_t rotation_bytes  = 2 * 128 * 4 * sizeof(float);
+        constexpr uint32_t reduction_bytes = 128 * sizeof(float);
+        return k % 256 == 0 && k <= INT_MAX / 16384 &&
+               ggml_blck_size(GGML_TYPE_Q8_0) == 32 && ggml_type_size(GGML_TYPE_Q8_0) == 34 &&
+               device_info(dev, d) && d.compute.shared_memory >= rotation_bytes + reduction_bytes && can_pack_rows(d, n);
+    }
+    static bool quant1_supports(ggml_backend_dev_t dev, const ggml_tensor* n, void*) {
+        Device d;
+        int group;
+        return sd_ggml_convrot_describe(n, &group) && group == 1 && n->ne[0] % 4 == 0 &&
+               device_info(dev, d) && can_pack_rows(d, n);
+    }
     static bool quant64_supports(ggml_backend_dev_t dev, const ggml_tensor* n, void*) {
         Device d;
         int group;
@@ -922,7 +995,12 @@ namespace sd_vulkan_i8 {
             return GGML_STATUS_FAILED;
         if (ggml_ext_op_get(nodes[0]) == sd_ggml_w4_op())
             return multiply_w4(e, d, nodes[0]);
-        return is_convrot(nodes[count - 1]) ? quantize(e, d, nodes, count) : multiply(e, d, nodes, count);
+        if (ggml_ext_op_get(nodes[0]) == sd_ggml_requantize_q8_op())
+            return pack_rows(e, d, nodes[0]);
+        int group;
+        if (sd_ggml_convrot_describe(nodes[count - 1], &group))
+            return group == 1 && count == 1 ? pack_rows(e, d, nodes[0]) : quantize(e, d, nodes, count, group);
+        return multiply(e, d, nodes, count);
     }

     struct LoRAMergeParams {
@@ -985,6 +1063,10 @@ void sd_ggml_register_vulkan_i8(ggml_backend_dev_t device) {
     d.prepare   = prepare;
     d.destroy   = destroy;
     d.execute   = execute;
+    d.name      = "sd.requantize_q8.vulkan.v1";
+    d.custom_op = sd_ggml_requantize_q8_op();
+    d.supports  = requantize_supports;
+    GGML_ASSERT(ggml_ext_register_kernel(device, &d));
     d.name      = "sd.quantize_i8_convrot.vulkan.v1";
     d.op        = GGML_OP_CUSTOM;
     d.custom_op = sd_ggml_convrot_op();
@@ -993,6 +1075,9 @@ void sd_ggml_register_vulkan_i8(ggml_backend_dev_t device) {
     d.name     = "sd.quantize_i8_convrot.h64.vulkan.v1";
     d.supports = quant64_supports;
     GGML_ASSERT(ggml_ext_register_kernel(device, &d));
+    d.name     = "sd.quantize_i8_rowwise.vulkan.v1";
+    d.supports = quant1_supports;
+    GGML_ASSERT(ggml_ext_register_kernel(device, &d));
     d.name      = "sd.linear_w4_convrot.vulkan.v1";
     d.custom_op = sd_ggml_w4_op();
     d.supports  = w4_supports;
diff --git a/src/core/vulkan/shaders/modulate_convrot.comp b/src/core/vulkan/shaders/modulate_convrot.comp
index 4e85b1d..10dd9d2 100644
--- a/src/core/vulkan/shaders/modulate_convrot.comp
+++ b/src/core/vulkan/shaders/modulate_convrot.comp
@@ -5,6 +5,7 @@
 layout(constant_id = 0) const uint K         = 4096;
 layout(constant_id = 1) const bool AFFINE    = false;
 layout(constant_id = 2) const bool HAS_SHIFT = true;
+layout(constant_id = 3) const bool ROTATE    = true;
 layout(local_size_x = 512, local_size_y = 1, local_size_z = 1) in;
 layout(binding = 0) readonly buffer X {
     float data_x[];
@@ -119,24 +120,26 @@ void main() {
                 value = (values[col] - mean) * inv_std;
                 value *= data_m[p.m_offset + col];
             }
-            values[col] = value * (1.0 / 16.0);
+            values[col] = ROTATE ? value * (1.0 / 16.0) : value;
         }
         barrier();
-        [[unroll]] for (uint stride = 1; stride < 256; stride *= 4) {
-            for (uint i = tid; i < K / 4; i += 512) {
-                const uint group          = i / 64;
-                const uint lane           = i % 64;
-                const uint base           = group * 256 + (lane / stride) * 4 * stride + lane % stride;
-                const float a             = values[base];
-                const float b             = values[base + stride];
-                const float c             = values[base + 2 * stride];
-                const float d             = values[base + 3 * stride];
-                values[base]              = a + b + c - d;
-                values[base + stride]     = a + b - c + d;
-                values[base + 2 * stride] = a - b + c + d;
-                values[base + 3 * stride] = -a + b + c + d;
+        if (ROTATE) {
+            [[unroll]] for (uint stride = 1; stride < 256; stride *= 4) {
+                for (uint i = tid; i < K / 4; i += 512) {
+                    const uint group          = i / 64;
+                    const uint lane           = i % 64;
+                    const uint base           = group * 256 + (lane / stride) * 4 * stride + lane % stride;
+                    const float a             = values[base];
+                    const float b             = values[base + stride];
+                    const float c             = values[base + 2 * stride];
+                    const float d             = values[base + 3 * stride];
+                    values[base]              = a + b + c - d;
+                    values[base + stride]     = a + b - c + d;
+                    values[base + 2 * stride] = a - b + c + d;
+                    values[base + 3 * stride] = -a + b + c + d;
+                }
+                barrier();
             }
-            barrier();
         }
         float maximum = 0.0;
         [[unroll]] for (uint col = tid; col < K; col += 512) {
diff --git a/src/core/vulkan/shaders/pack_i8_rows.comp b/src/core/vulkan/shaders/pack_i8_rows.comp
new file mode 100644
index 0000000..e4edd0a
--- /dev/null
+++ b/src/core/vulkan/shaders/pack_i8_rows.comp
@@ -0,0 +1,246 @@
+#version 450
+
+#ifdef SUBGROUP_MAX
+#extension GL_KHR_shader_subgroup_basic : require
+#extension GL_KHR_shader_subgroup_arithmetic : require
+#endif
+#ifdef Q8_HALFWORDS
+#extension GL_EXT_shader_16bit_storage : require
+#endif
+
+#ifdef Q8_RETAIN
+#extension GL_KHR_shader_subgroup_shuffle : require
+#extension GL_EXT_control_flow_attributes : require
+layout(local_size_x = 256) in;
+layout(constant_id = 0) const uint cached_groups = 4;
+#else
+layout(local_size_x = 128) in;
+#endif
+
+layout(push_constant) uniform Parameters {
+    uint words_per_row;
+    uint rows;
+    uint scale_offset;
+}
+p;
+
+#ifdef Q8_0
+layout(binding = 0, std430) readonly buffer Source {
+#ifdef Q8_HALFWORDS
+    uint16_t source_halfwords[];
+#else
+    uint source_words[];
+#endif
+};
+#else
+layout(binding = 0, std430) readonly buffer Source {
+    vec4 source_values[];
+};
+#endif
+
+layout(binding = 1, std430) writeonly buffer Output {
+    uint packed[];
+};
+
+#ifdef SUBGROUP_MAX
+shared float maxima[gl_WorkGroupSize.x / 32];
+#else
+shared float maxima[gl_WorkGroupSize.x];
+#endif
+
+#ifdef Q8_0
+ivec4 load_q8(const uint row, const uint word, out float scale) {
+    // Each GGML block stores a half scale followed by 32 signed bytes.
+    const uint block = row * (p.words_per_row / 8) + word / 8;
+#ifdef Q8_HALFWORDS
+    const uint halfword       = block * 17;
+    const uint value_halfword = halfword + 1 + (word % 8) * 2;
+    const uint scale_bits     = uint(source_halfwords[halfword]);
+    const uint values         = uint(source_halfwords[value_halfword]) | (uint(source_halfwords[value_halfword + 1]) << 16);
+#else
+    const uint block_byte = block * 34;
+    const uint scale_bits = source_words[block_byte / 4] >> ((block_byte & 2) * 8);
+    const uint value_byte = block_byte + 2 + (word % 8) * 4;
+    uint values           = source_words[value_byte / 4];
+    if ((value_byte & 2) != 0) {
+        values = (values >> 16) | (source_words[value_byte / 4 + 1] << 16);
+    }
+#endif
+    scale           = unpackHalf2x16(scale_bits).x;
+    const int bytes = int(values);
+    return ivec4(bitfieldExtract(bytes, 0, 8), bitfieldExtract(bytes, 8, 8),
+                 bitfieldExtract(bytes, 16, 8), bitfieldExtract(bytes, 24, 8));
+}
+#endif
+
+vec4 load_values(const uint row, const uint word) {
+#ifdef Q8_0
+    float scale;
+    const ivec4 values = load_q8(row, word, scale);
+    return scale * vec4(values);
+#else
+    return source_values[row * p.words_per_row + word];
+#endif
+}
+
+#ifdef Q8_0
+vec4 rotate_word(vec4 x) {
+    return vec4(x.x + x.y + x.z - x.w, x.x + x.y - x.z + x.w,
+                x.x - x.y + x.z + x.w, -x.x + x.y + x.z + x.w);
+}
+
+vec4 rotate_four(vec4 a, vec4 b, vec4 c, vec4 d, uint i) {
+    if (i == 3)
+        a = -a;
+    if (i == 2)
+        b = -b;
+    if (i == 1)
+        c = -c;
+    if (i == 0)
+        d = -d;
+    return ((a + b) + c) + d;
+}
+#endif
+
+#ifdef Q8_RETAIN
+vec4 rotate_lanes(vec4 value, uint lane, uint stride) {
+    const uint first = lane & ~(3u * stride);
+    return rotate_four(subgroupShuffle(value, first), subgroupShuffle(value, first + stride),
+                       subgroupShuffle(value, first + 2 * stride), subgroupShuffle(value, first + 3 * stride),
+                       (lane / stride) % 4);
+}
+
+void rotate_subgroup(uint row, uint word, out vec4 lower, out vec4 upper) {
+    const uint lane  = gl_SubgroupInvocationID;
+    lower            = rotate_word(load_values(row, word) * (1.0 / 16.0));
+    upper            = rotate_word(load_values(row, word + 32) * (1.0 / 16.0));
+    lower            = rotate_lanes(rotate_lanes(lower, lane, 1), lane, 4);
+    upper            = rotate_lanes(rotate_lanes(upper, lane, 1), lane, 4);
+    const uint first = lane % 16;
+    const vec4 a     = subgroupShuffle(lower, first);
+    const vec4 b     = subgroupShuffle(lower, first + 16);
+    const vec4 c     = subgroupShuffle(upper, first);
+    const vec4 d     = subgroupShuffle(upper, first + 16);
+    lower            = rotate_four(a, b, c, d, lane / 16);
+    upper            = rotate_four(a, b, c, d, 2 + lane / 16);
+}
+#elif defined(Q8_0)
+shared vec4 rotation[2][gl_WorkGroupSize.x];
+
+vec4 rotate_group(const uint row, const uint word) {
+    const uint tid = gl_LocalInvocationID.x;
+    vec4 x         = vec4(0.0);
+    if (word < p.words_per_row)
+        x = load_values(row, word) * (1.0 / 16.0);
+    rotation[0][tid] = rotate_word(x);
+    barrier();
+    // One H256 group occupies 64 consecutive vec4 values.
+    for (uint stride = 1, stage = 0; stride < 64; stride *= 4, ++stage) {
+        const uint base                = tid & ~(3u * stride);
+        const uint i                   = (tid / stride) % 4;
+        rotation[(stage + 1) % 2][tid] = rotate_four(rotation[stage % 2][base], rotation[stage % 2][base + stride],
+                                                     rotation[stage % 2][base + 2 * stride], rotation[stage % 2][base + 3 * stride], i);
+        barrier();
+    }
+    return rotation[1][tid];
+}
+#endif
+
+void pack_word(uint row, uint word, vec4 values, float inverse) {
+    const ivec4 quantized                = ivec4(roundEven(clamp(values * inverse, -127.0, 127.0)));
+    const uvec4 bytes                    = uvec4(quantized) & 255u;
+    packed[row * p.words_per_row + word] = bytes.x | (bytes.y << 8) | (bytes.z << 16) | (bytes.w << 24);
+}
+
+void pack_row(const uint row) {
+    const uint tid = gl_LocalInvocationID.x;
+    float maximum  = 0.0;
+#ifdef Q8_RETAIN
+    // One 32-lane subgroup owns an H256 group, with two vec4 values per lane.
+    const uint subgroups = gl_WorkGroupSize.x / 32;
+    const uint groups    = p.words_per_row / 64;
+    vec4 lower[cached_groups], upper[cached_groups];
+    [[unroll]] for (uint slot = 0; slot < cached_groups; ++slot) {
+        const uint group = gl_SubgroupID + slot * subgroups;
+        if (group >= groups)
+            continue;
+        rotate_subgroup(row, group * 64 + gl_SubgroupInvocationID, lower[slot], upper[slot]);
+        const vec4 peak = max(abs(lower[slot]), abs(upper[slot]));
+        maximum         = max(maximum, max(max(peak.x, peak.y), max(peak.z, peak.w)));
+    }
+#elif defined(Q8_0)
+    for (uint first = 0; first < p.words_per_row; first += gl_WorkGroupSize.x) {
+        const vec4 values = abs(rotate_group(row, first + tid));
+        maximum           = max(maximum, max(max(values.x, values.y), max(values.z, values.w)));
+    }
+#else
+    for (uint word = tid; word < p.words_per_row; word += gl_WorkGroupSize.x) {
+        const vec4 values = abs(load_values(row, word));
+        maximum           = max(maximum, max(max(values.x, values.y), max(values.z, values.w)));
+    }
+#endif
+#ifdef SUBGROUP_MAX
+    maximum = subgroupMax(maximum);
+    if (subgroupElect()) {
+        maxima[gl_SubgroupID] = maximum;
+    }
+    barrier();
+    if (tid == 0) {
+        for (uint i = 1; i < gl_WorkGroupSize.x / 32; ++i) {
+            maximum = max(maximum, maxima[i]);
+        }
+        maxima[0] = maximum;
+    }
+    barrier();
+#else
+    maxima[tid] = maximum;
+    barrier();
+    for (uint stride = gl_WorkGroupSize.x / 2; stride > 0; stride >>= 1) {
+        if (tid < stride) {
+            maxima[tid] = max(maxima[tid], maxima[tid + stride]);
+        }
+        barrier();
+    }
+#endif
+
+    const float scale = maxima[0] / 127.0;
+    if (tid == 0) {
+        packed[p.scale_offset + row] = floatBitsToUint(scale);
+    }
+#ifdef Q8_0
+    const float inverse = maxima[0] == 0.0 ? 0.0 : 127.0 / maxima[0];
+#else
+    const float inverse = scale == 0.0 ? 0.0 : 1.0 / scale;
+#endif
+
+#ifdef Q8_RETAIN
+    [[unroll]] for (uint slot = 0; slot < cached_groups; ++slot) {
+        const uint group = gl_SubgroupID + slot * subgroups;
+        if (group >= groups)
+            continue;
+        const uint word = group * 64 + gl_SubgroupInvocationID;
+        pack_word(row, word, lower[slot], inverse);
+        pack_word(row, word + 32, upper[slot], inverse);
+    }
+#else
+#ifdef Q8_0
+    for (uint first = 0; first < p.words_per_row; first += gl_WorkGroupSize.x) {
+        const uint word   = first + tid;
+        const vec4 values = rotate_group(row, word);
+        if (word >= p.words_per_row)
+            continue;
+#else
+    for (uint word = tid; word < p.words_per_row; word += gl_WorkGroupSize.x) {
+        const vec4 values = load_values(row, word);
+#endif
+        pack_word(row, word, values, inverse);
+    }
+#endif
+    barrier();
+}
+
+void main() {
+    for (uint row = gl_WorkGroupID.x; row < p.rows; row += gl_NumWorkGroups.x) {
+        pack_row(row);
+    }
+}
diff --git a/src/core/vulkan/shaders/quantize_i8_convrot_subgroup.comp b/src/core/vulkan/shaders/quantize_i8_convrot_subgroup.comp
index eb451f6..670fd6a 100644
--- a/src/core/vulkan/shaders/quantize_i8_convrot_subgroup.comp
+++ b/src/core/vulkan/shaders/quantize_i8_convrot_subgroup.comp
@@ -56,8 +56,13 @@ void transform_group(uint row, uint group, out float v[8]) {
         precise float activated = data_b[base + lane + j * 32] * gate;
         value                   = activated;
 #endif
+#ifdef UNROTATED
+        v[j] = value;
+#else
         v[j] = value * (1.0 / 16.0);
+#endif
     }
+#ifndef UNROTATED
     [[unroll]] for (uint stride = 1; stride <= 4; stride *= 4) {
         const uint first = lane & ~(3u * stride);
         [[unroll]] for (uint j = 0; j < 8; ++j) {
@@ -79,6 +84,7 @@ void transform_group(uint row, uint group, out float v[8]) {
         v[j + 4] = r.z;
         v[j + 6] = r.w;
     }
+#endif
 }

 void main() {
diff --git a/src/dgl/bindings/component_loader.cpp b/src/dgl/bindings/component_loader.cpp
index 6561b93..4796854 100644
--- a/src/dgl/bindings/component_loader.cpp
+++ b/src/dgl/bindings/component_loader.cpp
@@ -45,6 +45,7 @@ namespace sd::dgl {
         params.flash_attn_mode  = modes.at(trim(get_string(args, "flash_attn_mode")));
         params.conv_direct_mode = modes.at(trim(get_string(args, "conv_direct_mode")));
         params.sage_attn        = get_bool(args, "sage_attn");
+        params.linear_i8        = get_string(args, "linear_type") == "i8";
         params.conv_scale       = float(get_number(args, "conv_scale"));
         params.linear_scale     = float(get_number(args, "linear_scale"));
         params.attn_scale       = float(get_number(args, "attn_scale"));
@@ -79,6 +80,7 @@ namespace sd::dgl {
             {"flash_attn_mode", int(params.flash_attn_mode)},
             {"conv_direct_mode", int(params.conv_direct_mode)},
             {"sage_attn", params.sage_attn},
+            {"linear_i8", params.linear_i8},
             {"conv_scale", params.conv_scale},
             {"linear_scale", params.linear_scale},
             {"attn_scale", params.attn_scale},
diff --git a/src/dgl/bindings/model.cpp b/src/dgl/bindings/model.cpp
index e02b468..8e4af3a 100644
--- a/src/dgl/bindings/model.cpp
+++ b/src/dgl/bindings/model.cpp
@@ -20,8 +20,9 @@ namespace sd::dgl {
             trim(get_string(args, "params_backend")),
             get_bool(args, "direct"),
             int(get_int(args, "tile_size")),
+            get_string(args, "linear_type") == "i8",
         };
-        prepared.key  = {{"path", params.path}, {"backend", params.backend}, {"params_backend", params.params_backend}, {"direct", params.direct}, {"tile_size", params.tile_size}};
+        prepared.key  = {{"path", params.path}, {"backend", params.backend}, {"params_backend", params.params_backend}, {"direct", params.direct}, {"tile_size", params.tile_size}, {"linear_i8", params.linear_i8}};
         prepared.load = [params = std::move(params)](ResourceLoadRequest& request) mutable {
             auto model = request.context.make_model<models::ImageUpscaler>(request.weights_key);
             if (!model->init(std::move(params)))
@@ -54,8 +55,9 @@ namespace sd::dgl {
             file_key(get_string(args, "path"), prepared.revision),
             trim(get_string(args, "backend")),
             trim(get_string(args, "params_backend")),
+            get_string(args, "linear_type") == "i8",
         };
-        prepared.key  = {{"path", params.path}, {"backend", params.backend}, {"params_backend", params.params_backend}};
+        prepared.key  = {{"path", params.path}, {"backend", params.backend}, {"params_backend", params.params_backend}, {"linear_i8", params.linear_i8}};
         prepared.load = [params = std::move(params)](ResourceLoadRequest& request) mutable {
             auto model = request.context.make_model<models::DetailDetector>(request.weights_key);
             if (!model->init(std::move(params)))
diff --git a/src/dgl/bindings/registration.cpp b/src/dgl/bindings/registration.cpp
index 6a066ef..6624e99 100644
--- a/src/dgl/bindings/registration.cpp
+++ b/src/dgl/bindings/registration.cpp
@@ -3,6 +3,7 @@
 #include <climits>
 #include <limits>

+#include "core/ggml_extend_backend.h"
 #include "core/util.h"
 #include "dgl/bindings/audio.h"
 #include "dgl/bindings/component_loader.h"
@@ -342,8 +343,16 @@ namespace sd::dgl {
             execute_save_audio);
     }

+    static Operation model_loader(SDBackendModule module, std::vector<Argument> args, OutputSignature output, std::function<PreparedResource(Values&)> prepare) {
+        args.push_back(choice("linear_type", {"auto", "i8", "raw"}, "auto"));
+        auto operation           = make_resource_operation(std::move(args), std::move(output), std::move(prepare));
+        operation.backend_module = module;
+        return operation;
+    }
+
     static void register_model_operations(Registry& registry) {
-        registry["load_upscaler"] = make_resource_operation(
+        registry["load_upscaler"] = model_loader(
+            SDBackendModule::UPSCALER,
             {
                 model_path("path"),
                 integer("tile_size", 0, 16384, 128),
@@ -363,7 +372,8 @@ namespace sd::dgl {
             },
             {Kind::Tensor},
             execute_upscale);
-        registry["load_detector"] = make_resource_operation(
+        registry["load_detector"] = model_loader(
+            SDBackendModule::DETECTOR,
             {
                 model_path("path"),
                 backend_option("backend"),
@@ -374,7 +384,7 @@ namespace sd::dgl {
     }

     template <class T, class Load>
-    static Operation component_loader(const Argument& family, Load load, std::vector<Argument> options = {}, bool require_path = true) {
+    static Operation component_loader(SDBackendModule module, const Argument& family, Load load, std::vector<Argument> options = {}, bool require_path = true) {
         std::vector<Argument> args{
             model_path("path", require_path),
             family,
@@ -392,7 +402,7 @@ namespace sd::dgl {
         args.push_back(optional("sage_attn", Kind::Boolean, false));
         for (auto& option : options)
             args.push_back(std::move(option));
-        return make_resource_operation(std::move(args), {ObjectKind<T>::value}, load);
+        return model_loader(module, std::move(args), {ObjectKind<T>::value}, load);
     }

     static void register_lora_operations(Registry& registry) {
@@ -414,11 +424,12 @@ namespace sd::dgl {
         const auto family_from = model_path("family_from", false);
         register_lora_operations(registry);

-        registry["load_dit"] = component_loader<models::DiffusionModel>(family, load_dit);
+        registry["load_dit"] = component_loader<models::DiffusionModel>(SDBackendModule::DIFFUSION, family, load_dit);
         registry.alias("load_unet", "load_dit");

         auto tokenizer                = optional("tokenizer", Kind::String, "");
         registry["load_text_encoder"] = component_loader<models::TextEncoder>(
+            SDBackendModule::TE,
             family,
             load_text_encoder,
             {
@@ -432,6 +443,7 @@ namespace sd::dgl {
                 model_path("clip_g_path", false),
             });
         registry["load_vae"] = component_loader<models::VAE>(
+            SDBackendModule::VAE,
             family,
             load_vae,
             {
@@ -439,17 +451,17 @@ namespace sd::dgl {
                 choice("vae_format", {"auto", "flux", "sd3", "flux2", "wan"}, "auto"),
             });
         registry["load_tae"] = component_loader<models::VAE>(
-            family, load_tae, {family_from, optional("decode_only", Kind::Boolean, false)});
-        registry["controlnet::load"]     = component_loader<models::ControlNet>(family, load_controlnet);
-        registry["load_vision_encoder"]  = component_loader<models::VisionEncoder>(family, load_vision_encoder);
-        registry["load_audio_encoder"]   = component_loader<models::AudioEncoder>(family, load_audio_encoder);
-        registry["load_audio_vae"]       = component_loader<models::AudioVAE>(family, load_audio_vae, {family_from});
-        registry["ip_adapter::load"]     = component_loader<models::IPAdapter>(family, load_ip_adapter);
-        registry["photomaker::load"]     = component_loader<models::PhotoMaker>(family, load_photomaker);
-        registry["pulid::load"]          = component_loader<models::PuLID>(family, load_pulid);
-        registry["animatediff::load"]    = component_loader<models::AnimateDiff>(family, load_animatediff);
+            SDBackendModule::VAE, family, load_tae, {family_from, optional("decode_only", Kind::Boolean, false)});
+        registry["controlnet::load"]     = component_loader<models::ControlNet>(SDBackendModule::CONTROL_NET, family, load_controlnet);
+        registry["load_vision_encoder"]  = component_loader<models::VisionEncoder>(SDBackendModule::CLIP_VISION, family, load_vision_encoder);
+        registry["load_audio_encoder"]   = component_loader<models::AudioEncoder>(SDBackendModule::AUDIO_ENCODER, family, load_audio_encoder);
+        registry["load_audio_vae"]       = component_loader<models::AudioVAE>(SDBackendModule::VAE, family, load_audio_vae, {family_from});
+        registry["ip_adapter::load"]     = component_loader<models::IPAdapter>(SDBackendModule::DIFFUSION, family, load_ip_adapter);
+        registry["photomaker::load"]     = component_loader<models::PhotoMaker>(SDBackendModule::PHOTOMAKER, family, load_photomaker);
+        registry["pulid::load"]          = component_loader<models::PuLID>(SDBackendModule::DIFFUSION, family, load_pulid);
+        registry["animatediff::load"]    = component_loader<models::AnimateDiff>(SDBackendModule::DIFFUSION, family, load_animatediff);
         registry["load_latent_upscaler"] = component_loader<models::LatentUpscaler>(
-            choice("family", {"auto", "ltxav", "minimax_h3"}, "auto"), load_latent_upscaler);
+            SDBackendModule::DIFFUSION, choice("family", {"auto", "ltxav", "minimax_h3"}, "auto"), load_latent_upscaler);
         registry["pulid::load_embedding"] = make_operation(
             {required("path", Kind::String)}, {Kind::Tensor}, execute_load_pulid_embedding);
         registry["photomaker::encode_images"] = make_operation(
diff --git a/src/dgl/context.cpp b/src/dgl/context.cpp
index 3ba0c5b..80e43e6 100644
--- a/src/dgl/context.cpp
+++ b/src/dgl/context.cpp
@@ -124,6 +124,12 @@ namespace sd::dgl {
             if (!parse_strict_bool(value, enabled))
                 throw std::runtime_error("embed_metadata expects a boolean");
             embed_metadata = enabled;
+        } else if (key == "linear_type") {
+            SDBackendAssignment assignment;
+            std::string error;
+            if (!sd_parse_linear_type_assignment(value, &assignment, &error))
+                throw Error(SD_STATUS_INVALID_ARGUMENT, error);
+            linear_type_ = std::move(assignment);
         } else if (key == "auto_fit") {
             if (!parse_strict_bool(value, auto_fit_))
                 throw std::runtime_error("auto_fit expects a boolean");
@@ -202,9 +208,14 @@ namespace sd::dgl {
         const auto& [name, operation] = registration;
         const auto kind               = operation.output.type.kind;
         nlohmann::json key            = {{"operation", name}};
-        auto prepared                 = operation.prepare(args);
-        key["params"]                 = std::move(prepared.key);
-        auto revision                 = std::move(prepared.revision);
+        if (operation.backend_module) {
+            const auto mode = linear_type_.get(*operation.backend_module);
+            if (!mode.empty())
+                args.insert_or_assign("linear_type", Value::literal(mode));
+        }
+        auto prepared = operation.prepare(args);
+        key["params"] = std::move(prepared.key);
+        auto revision = std::move(prepared.revision);
         ResourceKey identity{key.dump(), {}};
         auto argument_revision = revision.dump();
         const auto last_use    = ++resource_epoch;
diff --git a/src/dgl/context.h b/src/dgl/context.h
index db57d30..90318f7 100644
--- a/src/dgl/context.h
+++ b/src/dgl/context.h
@@ -69,6 +69,7 @@ namespace sd::dgl {
         Value cache_resource(ResourceKey identity, std::string revision, std::string lora_revision, ModelLoader::Dependencies dependencies, Value value, uint64_t last_use);
         bool auto_fit_ = true;
         models::ModelExecutionOptions model_execution_;
+        SDBackendAssignment linear_type_;
         size_t conditioning_cache_size_;
         void set_model_execution_option(const std::string& key, const std::string& value);
     };
diff --git a/src/dgl/models/detail_detector.cpp b/src/dgl/models/detail_detector.cpp
index e6b7753..6bee331 100644
--- a/src/dgl/models/detail_detector.cpp
+++ b/src/dgl/models/detail_detector.cpp
@@ -302,6 +302,7 @@ namespace sd::dgl::models {
             return false;
         }

+        detector->set_linear_i8_enabled(params_.linear_i8);
         class_names.assign(static_cast<size_t>(detector->config.num_classes), "");
         auto names_item = catalog.get_metadata().find("yolov8.names");
         if (names_item != catalog.get_metadata().end()) {
diff --git a/src/dgl/models/detail_detector.h b/src/dgl/models/detail_detector.h
index 5aa573d..481f077 100644
--- a/src/dgl/models/detail_detector.h
+++ b/src/dgl/models/detail_detector.h
@@ -34,6 +34,7 @@ namespace sd::dgl::models {
         std::string path;
         std::string backend;
         std::string params_backend;
+        bool linear_i8 = false;
     };

     struct DetailDetector final : public Model {
diff --git a/src/dgl/models/model_load_params.h b/src/dgl/models/model_load_params.h
index b4007f9..1ad7ca0 100644
--- a/src/dgl/models/model_load_params.h
+++ b/src/dgl/models/model_load_params.h
@@ -25,6 +25,7 @@ namespace sd::dgl::models {
         OperatorMode flash_attn_mode  = OperatorMode::Auto;
         OperatorMode conv_direct_mode = OperatorMode::Auto;
         bool sage_attn                = false;
+        bool linear_i8                = false;
         float conv_scale              = 0.f;
         float linear_scale            = 0.f;
         float attn_scale              = 0.f;
diff --git a/src/dgl/models/model_runtime.cpp b/src/dgl/models/model_runtime.cpp
index 0dc6d3a..22ff2e8 100644
--- a/src/dgl/models/model_runtime.cpp
+++ b/src/dgl/models/model_runtime.cpp
@@ -104,6 +104,7 @@ namespace sd::dgl::models {
         if (model == nullptr) {
             return true;
         }
+        model->set_linear_i8_enabled(params.linear_i8);
         // Keep tensor metadata alive until ModelManager unregisters the resource.
         Model::RunnerRegistration registration{[model] { model->runner_end(); }, {}};
         if constexpr (std::is_base_of_v<GGMLRunner, T> || std::is_same_v<T, Conditioner> ||
@@ -217,6 +218,7 @@ namespace sd::dgl::models {
             split_device_limits.emplace_back(backend, 0);
         }
         model_.model_weights->set_split_buffer_type(main_backend, split_buft, split_device_limits);
+        model->set_linear_i8_enabled(false);

         std::map<std::string, ggml_tensor*> split_tensors;
         if constexpr (std::is_base_of_v<Conditioner, T>) {
diff --git a/src/dgl/models/upscaler.cpp b/src/dgl/models/upscaler.cpp
index e8b11a6..169c30d 100644
--- a/src/dgl/models/upscaler.cpp
+++ b/src/dgl/models/upscaler.cpp
@@ -64,7 +64,10 @@ namespace sd::dgl::models {
         }
         model = build_image_upscale_model(model_weights, backend_manager, std::move(loader), params_.path,
                                           params_.direct, model_data_type);
-        return model != nullptr && load_weights_eagerly();
+        if (!model)
+            return false;
+        model->runner()->set_linear_i8_enabled(params_.linear_i8);
+        return load_weights_eagerly();
     }

     sd::Tensor<float> ImageUpscaler::upscale_tensor(const sd::Tensor<float>& input_tensor) {
diff --git a/src/dgl/models/upscaler.h b/src/dgl/models/upscaler.h
index 5e7e7d0..71a28f6 100644
--- a/src/dgl/models/upscaler.h
+++ b/src/dgl/models/upscaler.h
@@ -19,6 +19,7 @@ namespace sd::dgl::models {
         std::string params_backend;
         bool direct;
         int tile_size;
+        bool linear_i8 = false;
     };

     struct ImageUpscaler final : public Model {
diff --git a/src/dgl/registry.h b/src/dgl/registry.h
index ffac38c..53da434 100644
--- a/src/dgl/registry.h
+++ b/src/dgl/registry.h
@@ -8,6 +8,8 @@

 #include "value.h"

+enum class SDBackendModule;
+
 namespace sd::dgl {

     struct CallbackSignature {
@@ -56,6 +58,7 @@ namespace sd::dgl {
         bool sampling = false;
         std::function<PreparedResource(Values&)> prepare;
         ModelUse model_use = ModelUse::Automatic;
+        std::optional<SDBackendModule> backend_module;

         bool resource() const { return bool(prepare); }
     };
diff --git a/src/model/diffusion/hidream_o1.hpp b/src/model/diffusion/hidream_o1.hpp
index 400c10b..b6939d8 100644
--- a/src/model/diffusion/hidream_o1.hpp
+++ b/src/model/diffusion/hidream_o1.hpp
@@ -499,8 +499,8 @@ namespace HiDreamO1 {
             vision_runner->set_max_graph_vram_bytes(max_graph_vram_bytes);
         }

-        void set_flash_attention_enabled(bool enabled) override {
-            vision_runner->set_flash_attention_enabled(enabled);
+        void for_each_runner(const std::function<void(GGMLRunner&)>& visit) override {
+            visit(*vision_runner);
         }

         void set_scale_overrides(float linear_scale, float attn_scale) override {