Commit Graph

14073 Commits

Author SHA1 Message Date
Vladimir Mandic 7e8309f2d4 cleanup
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-07-15 18:09:33 +02:00
Disty0 75926e6fc4 Remove sdnq_use_quantized_matmul and use sdnq_quantize_matmul_mode instead 2026-07-15 18:45:30 +03:00
Disty0 875d2b060b cleanup 2026-07-15 17:18:19 +03:00
Disty0 923cd01944 update sdnq kernel configs 2026-07-15 17:15:16 +03:00
Vladimir Mandic f4cd3b17d6 cleanup
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-07-15 15:40:56 +02:00
Vladimir Mandic 7214ee9d42 triton/dynamo/inductor cache location and timer stats
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-07-15 15:06:40 +02:00
Vladimir Mandic 42c2c6382a update torch==2.13.0+cu132
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-07-15 09:00:36 +02:00
Disty0 d8a29a68ef Update IPEX and ROCm to Torch 2.13 2026-07-15 04:05:26 +03:00
CalamitousFelicitousness 028e892104 feat(caption): warn when qwen3.5 linear attention kernels are missing
Qwen3.5 runs most of its layers as gated delta linear attention. Without
flash-linear-attention, transformers falls back to a per-token torch loop that
runs sequentially over prefill and decode, so a caption takes minutes with no
indication of why.
2026-07-15 01:36:12 +01:00
CalamitousFelicitousness ccb339bf0f feat(caption): add toriigate 0.5
ToriiGate 0.5 is a Qwen3.5 vision fine-tune trained on a single system prompt
and a single query structure, and it degrades on anything else. The shared qwen
handler strips angle brackets and underscores from the question, which mangles
the model's format templates, and the generic caption instructions are not what
it was trained on.

- hold the model's caption formats, system prompt and query builder in modules/caption/toriigate.py
- build the system prompt and user query from those templates in the qwen handler
- offer the native formats in the task dropdown and in the caption api prompt groups
- drop Normal Caption for this model, which has no format between short and long
2026-07-15 01:36:12 +01:00
Disty0 1cf2c9012d add min block size check to sdnq atten 2026-07-15 03:20:43 +03:00
Disty0 3a0094ef62 remove tl.constexpr use 2026-07-15 00:24:13 +03:00
Disty0 d03d0d7dd1 reduce num_stages options in triton atten 2026-07-14 23:48:55 +03:00
Disty0 39d74cca18 Enable Triton MM on all GPUs 2026-07-14 22:21:53 +03:00
Vladimir Mandic 1ec48189ea Merge pull request #4997 from liutyi/dev
Missing covers: Lumina-DiMOO, Anima-1.0-Turbo-sdnq
2026-07-14 19:57:36 +02:00
Disty0 47cb113b75 cleanup sdnq 2026-07-14 20:55:47 +03:00
CalamitousFelicitousness b1c3578b27 feat(sdnq): name the sage kernel the benchmark actually ran
"sage" is a different kernel per gpu: sageattention dispatches the pv dtype and
accumulator by arch and cuda version, and modules/attention.py forces the fp16-pv
cuda kernel on sm86, so one label across shared reports compares unlike kernels.

- resolve the row label from the dispatch: sm89 with cuda 12.8+ reads
  "sage int8 qk + fp8 pv, fp32+fp16 accum", sm86 reads "fp16 pv, fp32 accum"
- name the sm86-only fp16-accum baseline for what it is
2026-07-14 17:40:01 +01:00
CalamitousFelicitousness ce373df6e5 style(sdnq): tighten the benchmark notes
Notes ran to paragraph length and wrapped in the terminal, burying the numbers.

- lead with the topic, keep the numbers and the fix, drop the restatement
- one line per note at 140 columns, except the sd15 compile warning
2026-07-14 17:39:39 +01:00
CalamitousFelicitousness 101ead9536 fix(sdnq): follow the e4m3 upcast in the benchmark dequant path
sdnq no longer skips compile for fp8 storage, it upcasts e4m3 to the scale dtype
before the compiled dequant, so the tool's mirror of the deleted skip_fp8_compile
gate went dead and fed the raw e4m3 weight to its compiled dequant: on pre-ada gpus
that reports a compile failure for rows the webui runs fine.

- mirror the upcast in dequant_args, keep the hardware probe on the raw weight
- drop dequant_gated_to_eager and the gated-to-eager row, fp8 rows are measured now
- say upcast, not eager fallback, in the environment panel and dequant notes
2026-07-14 17:37:41 +01:00
CalamitousFelicitousness 24276d4157 fix(sdnq): keep the attention benchmark alive on a windows console
Hiding the sdnext startup log by pointing fds 1 and 2 at a file kills the process
when stdout is a real console: sys.stdout writes through the win32 console api on
the handle behind fd 1, so the first bootstrap log line raises OSError 'the handle
is invalid', and with stderr broken the same way the interpreter aborts with no
message, no traceback and no results.

- swap sys.stdout/sys.stderr to a buffer along with the fd redirect
- capture the startup log instead of discarding it to devnull, replay it on failure
- catch SystemExit: loader.py and installer.py exit on fatal startup errors
2026-07-14 16:59:55 +01:00
Oleksandr Liutyi 63aa0adfa8 Missing covers: Lumina-DiMOO, Anima-1.0-Turbo-sdnq 2026-07-14 15:33:43 +00:00
Disty0 6dcdbdc86e upcast fp8 weights instead of disable compile 2026-07-14 17:22:37 +03:00
Disty0 0d15fd1f62 upcast fp8 mm to fp16 on unsupported gpus and disable triton mm on alchemist and igpus 2026-07-14 17:16:25 +03:00
Disty0 e2d3ac5159 ipex check last_level_cache_size for l2 cache 2026-07-14 16:00:03 +03:00
Vladimir Mandic 7d9130aef0 update modules
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-07-14 10:21:34 +02:00
Vladimir Mandic 3dc7167dfd Merge branch 'master' into dev 2026-07-14 10:20:53 +02:00
Vladimir Mandic 20ccf1d358 update changelog/todo/skill
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-07-14 09:33:03 +02:00
CalamitousFelicitousness 18bbe288b0 fix(lora): apply full-diff norm targets and map z-image's renamed modules
A full-weight extraction on Z-Image bound 308 modules and applied 172 of
them, silently dropping the rest, and left 71 more unmapped.

assign_network_names_to_compvis_modules puts every transformer module in
network_layer_mapping but skips stamping network_layer_name on norms,
which is the attribute the apply pass keys off. try_load_full bound those
modules through the mapping and they then never applied; stamp them
loader-locally, as try_load_norm already does.

Z-Image also names three module groups differently from the diffusers
tree: the qk-norms (q_norm/k_norm vs norm_q/norm_k), and the patch
embedder and final layer, which live in ModuleDicts keyed by
"{patch_size}-{f_patch_size}" and so carry a key the checkpoint has no
notion of. Read that key from the live model rather than hardcoding it.
The counts close exactly: 68 qk-norms plus 3 non-block targets are the 71
that went unmapped.
2026-07-14 08:06:45 +01:00
CalamitousFelicitousness 2cf5a2f207 feat(sdnq): compare quantized matmul backends in a single run
The linear layers bind their scaled-mm function at import, so
SDNQ_USE_TRITON_MM freezes the backend per process and comparing triton
against the torch fallback meant two runs, carrying clock drift into the
delta. --mm-backends rebinds the function on the consuming modules
between benches, so both rows measure the same quantized layer under the
same clock state.

- swap targets are the four linear modules that from-import a scaled-mm
  function; every swap resets dynamo, since the layer forwards are
  compiled and the traced graph pins the previous function
- the torch row is captured from kernel_wrappers rather than
  reimplemented, so it is unavailable where triton is the device default
  (rerun with SDNQ_USE_TRITON_MM=0) and says so
- rounds alternate order and keep the fastest per row, so drift cancels
  instead of favouring whichever backend runs second
- flag output error when backends disagree past 1e-4: they are meant to
  be numerically equivalent
2026-07-14 08:06:45 +01:00
CalamitousFelicitousness 566c58e58c fix(sdnq): probe fp8 attention support without a dynamo disable window
probe_fp8 and the broken-compile bench path forced eager input prep by
toggling torch._dynamo.config.disable. torch 2.13+ raises 'found no
compiled frames' when a fullgraph-compiled function is called inside a
disable window, so the probe failed before reaching the attention kernel
and reported an environment error instead of the kernel's real verdict,
on fp8-capable gpus too. Swap the module-global prep function for its
eager inner instead, matching the correctness section.
2026-07-14 08:06:45 +01:00
CalamitousFelicitousness 37f1eb09f1 feat(sdnq): report the runtime stack in the benchmark and quiet the startup log
The environment panel and json now carry python, platform, backend and
the backend runtime versions (cuda/cudnn/driver, hip, ipex, openvino,
directml via devices.get_gpu_info), so shared reports identify the stack
without inferring it from the torch version string.

The webui bootstrap log is gated behind an fd-level suppression for the
import window: the bootstrap reconfigures its loggers during import and
onnxruntime warns from c++, so logger levels alone cannot silence it.
Import failures still print after the gate lifts.
2026-07-14 08:06:45 +01:00
CalamitousFelicitousness b8cf912e4e feat(lora): run the full adapter family chain on every native arch
zimage, chroma, ernie and krea2 chained only lora/lokr/loha/oft while
flux2 and anima ran all eight families, so ia3/glora/norm/full files
(e.g. full-diff extractions with diff/diff_b keys) reported not loaded
on the short-chain arches. The generic family loaders are arch-agnostic;
wire the missing four into each chain.

- add ia3/glora/norm/full wrappers and chain entries to the four arch
  modules, with matching suffix/marker re-exports
- add a chain-level full-diff test per suite: zimage covers the legacy
  attention.out alias and the fused-qkv skip, chroma the proj rename,
  ernie the passthrough
2026-07-14 08:06:45 +01:00
CalamitousFelicitousness 72511f1bd7 feat(lora): reconstruct the lycoris sparse bias residual triplet
LyCORIS extraction with use_sparse_bias saves bias_indices/bias_values/
bias_size per module: the sparse weight-shaped remainder of the SVD
extraction, named bias for historical reasons. The keys were dropped by
both loader paths, so extracted adapters applied without the residual
correction; the dense-bias branch in finalize_updown that consumes it
was unreachable.

- rebuild the COO tensor in NetworkModule.__init__ (int16 indices cast
  to long), shared by the native and generic loaders; kept sparse so
  the dense += sparse in finalize_updown materializes per module at
  apply instead of near-model-size densification at load
- accept the triplet suffixes in LORA_SUFFIXES; fused targets skip
  with the weight-shaped-bias warning
- cover an extraction-faithful numeric round-trip and the fused skip
  in the offline suite
2026-07-14 08:06:45 +01:00
CalamitousFelicitousness 9c85902ee7 feat(lora): load dora magnitude vectors saved as magnitude keys
ai-toolkit DoRA saves lora_A/B plus a 1-D per-output magnitude key in
place of alpha; PEFT and diffusers name the same quantity
lora_magnitude_vector. Neither key was in the suffix table, so such
adapters loaded as plain LoRA with the magnitude renormalization
silently missing. The semantics match LyCORIS wd_on_out=True row norms,
so both keys convert onto the existing dora_scale path.

- accept .magnitude and .lora_magnitude_vector in LORA_SUFFIXES and
  convert at group level in try_load_lora
- reshape 1-D vectors to (out, 1): on square layers the apply-time
  orientation detection would otherwise renormalize the wrong axis
- cover square-layer numeric equality, fused-qkv slicing and the PEFT
  key form in the offline suite
2026-07-14 08:06:45 +01:00
CalamitousFelicitousness 387a349dfd fix(lora): scale the dora diff before the decompose norm
finalize_updown ran apply_weight_decompose on the unscaled delta and
multiplied the result by alpha/rank afterward. LyCORIS and ComfyUI both
bake alpha/rank into the diff before computing the row norms, so any
DoRA with alpha != rank renormalized against the wrong merged weight
(64% relative delta error for kohya-style alpha=1 rank=8; exact only
when alpha == rank, which full-matrix LoKR forces).

- scale updown by calc_scale() before apply_weight_decompose; apply
  only the multiplier afterward
- multiplier lerps the full merged delta (0 disables, 1 equals the
  trainer output); LyCORIS weight-mode ratio interpolation leaves the
  diff applied at multiplier 0 and is not used
- add a numeric regression test mirroring the LyCORIS forward reference
2026-07-14 08:06:45 +01:00
CalamitousFelicitousness ca729a01ca feat(lora): handle bias companion keys on fused-qkv targets
A diff_b bias delta on a fused BFL target passed through whole and
failed at apply with a shape mismatch. diff_b stores one value per
output feature, so it partitions with the fused rows exactly like the
up-weight; slice it with the chunk in the LoRA loader. The legacy
weight-shaped bias key (LyCORIS sparse-residual heritage) has no
defined partition on a fused target and no known emitter pairs it with
chunk-capable families, so the group is skipped with a warning in the
LoRA, LoKR and LoHA loaders.

- add slice_bias_delta beside slice_dora_scale; warn and skip
  non-per-output diff_b shapes
- cover sliced diff_b flowing out as ex_bias and the legacy-bias skip
  in the offline suite
2026-07-14 08:06:45 +01:00
CalamitousFelicitousness 3e4888d05f feat(lora): map chroma non-block and guidance approximator modules
BFL-format chroma adapters targeting the embedders, final projection or
the distilled guidance layer MLPs resolved verbatim and unmapped: the
embedder/final-layer names differ from diffusers outright, and the
approximator MLP leaves are in_layer/out_layer in BFL but linear_1/
linear_2 in the diffusers PixArt projection. Only in_proj, out_proj and
norms.N shared names and bound.

- add CHROMA_EXTRA_MAP (kohya form derived) and GUIDANCE_LEAF_MAP to
  both target resolvers
- route bare distilled_guidance_layer keys through the resolver instead
  of the diffusers passthrough so both leaf namings resolve; add
  img_in/txt_in/final_layer bare prefixes
- cover all key forms and end-to-end binding in the offline suite
2026-07-14 08:06:45 +01:00
CalamitousFelicitousness 1b3fd835c6 feat(lora): validate kron dims against the module at lokr load time
A LoKR group whose Kronecker product does not fit the resolved module
previously bound anyway and failed at apply time as a caught per-module
error, leaving the adapter partially applied with only an error log.
Reject the group at load with a warning instead, matching the LoRA
path's shapes_match gate.

- lokr_kron_shape derives (out, in_flat) from full, rank-decomposed or
  Tucker-rebuilt factors, folding conv kernel dims into in_flat
- lokr_shapes_match honors SDNQ original shapes and chunk partitions:
  equal chunks need total * out rows, row-range slices an exact range;
  the input dim is never chunked
- cover non-fused and fused rejection in the offline suite
2026-07-14 08:06:45 +01:00
CalamitousFelicitousness 4cac283561 feat(lora): slice per-output dora_scale on fused-qkv targets
LyCORIS wd=True saves a dora_scale companion for LoRA/LoHA/LoKR; on
fused BFL targets the chunk paths passed it through whole, so apply
failed with a shape mismatch and the module was dropped. Per-output
magnitudes (wd_on_out=True, the default) partition exactly with the
fused rows; per-input magnitudes couple the chunks through shared
column norms and have no exact split.

- slice per-output dora_scale rows with the chunk in the LoRA, LoKR
  and LoHA loaders
- skip per-input DoRA on fused targets with a specific warning
- cover sliced and skipped orientations in the offline suite
2026-07-14 08:06:45 +01:00
CalamitousFelicitousness 1587b9682d feat(lora): support the lycoris_ prefix in every native adapter arch
The lycoris_ save format is arch-independent: LyCORIS standalone wraps
the loaded diffusers model and emits the wrapped module path with dots
as underscores, so verbatim passthrough is correct for any arch. Only
flux2 handled it; zimage, chroma, ernie and krea2 reported such files
as not loaded.

- add lycoris_ to KNOWN_PREFIXES_DEFAULT and PASSTHROUGH_PREFIXES_DEFAULT
- drop flux2's per-arch prefix append and resolve_targets branch
- add lycoris_ to ANIMA_PREFIXES (anima replaces the default tuple);
  network_prefix_for already routes it to the transformer namespace
- cover the passthrough with a zimage loader test
2026-07-14 08:06:45 +01:00
CalamitousFelicitousness 0c5961f605 feat(lora): map flux2 non-block modules in the native adapter loader
BFL-format adapters targeting the embedders, timestep/guidance MLPs,
modulation layers and the final layer resolved to nothing and were
dropped as unmapped, for every adapter family on the f2 native path.

- add F2_EXTRA_MAP exact-match lookups in both target resolvers, with
  the kohya underscore form derived from the BFL path
- add guidance_in. to BARE_FLUX_PREFIXES; groups targeting the guidance
  embedder stay unmapped on models built without guidance_embeds
- extend the offline test mock with the non-block targets and cover all
  three key forms plus full-matrix LoKR with placeholder alpha
2026-07-14 08:06:45 +01:00
CalamitousFelicitousness 8b4d7b9519 fix(sdnq): end the benchmark cleanly when a faulted cuda context is detected
After the correctness section aborts on a sticky kernel fault, the
remaining sections cannot run; flush outputs and exit instead of
cascading into the next cuda call's traceback.
2026-07-14 08:06:45 +01:00
Disty0 49ee0dc647 set group_size_m to 8 on intel too 2026-07-14 02:16:33 +03:00
Disty0 72f8031838 SDNQ update matmul configs 2026-07-14 01:53:48 +03:00
Vladimir Mandic 65787cea89 update modernui
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-07-13 21:49:06 +02:00
Vladimir Mandic f8cfc408e9 strict subpaths
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-07-13 21:48:42 +02:00
Vladimir Mandic f829f2d776 fix infotext
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-07-13 20:58:33 +02:00
Vladimir Mandic 31da9cce6f gallery improve sort
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-07-13 20:35:05 +02:00
Vladimir Mandic fb71f63d77 fix gallery delete and save
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-07-13 19:08:59 +02:00
Disty0 d39bd45d04 check ipex and xpu on sdnq 2026-07-13 19:16:02 +03:00