Skip to content

[diffusion] Remove unused helpers and write-only state - #43064

Merged
mickqian merged 76 commits into
mainfrom
codex/diffusion-dead-code-audit
Oct 9, 2026
Merged

mickqian merged 76 commits into
mainfrom
codex/diffusion-dead-code-audit

Conversation

@mickqian

@mickqian mickqian commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Remove unused helpers, write-only state and duplicated implementations:

  • USP's obsolete collective wait wrapper and its unused import, NVFP4's unused tensor-shape wrapper, and SVG2's unused kwargs checker.

  • Qwen edit's unused condition-image sizing method and Qwen VAE's unused constructor-time convolution counts.

  • Old Cache-DiT step-count/warmup fields; mounting still uses the complete active cache key.

  • LTX's old LoRA phase field; switching still uses the active phase/strength signature.

  • Unused disaggregation configuration copies and RIFE's unused resolved-path field.

  • Encoder's unused mapping copy and the unused stage logging setter.

  • Empty HF config registry and unreachable config reloading; standard AutoConfig registration remains supported.

  • Obsolete disagg_args compatibility shim and its alias-only test; actual role/CLI definitions stay in server_args/disagg.py.

  • Share spatial VAE tile geometry across tiled encode/decode and parallel tiled/patch decode, retaining independent traversal, blending and communication.

  • Share SLA/SageSLA projection initialization, feature-map setup and reference linear-attention math within the existing backend module; keep sparse kernels separate.

  • Share identical TP query/KV head partition rules across Llama, Qwen3, Gemma2 and Gemma3; retain model-specific projections, RoPE, QK norm and sliding attention.

  • Reuse the existing linear weight allocator for ConvRot INT8 JIT and comfy backends; keep their validation, scale storage and postprocessing independent.

  • Share MOVA audio/video text and time embeddings, time projection and block initialization, preserving registration order and distinct heads/patch convolutions.

  • Reuse common sampling request extras for action policies without changing their fields, inheritance or action-specific request merge.

  • Share Qwen-Image/JoyImage/Krea2 channelwise VAE decode normalization without changing tensor construction or reciprocal/cast order.

  • Share LTX2/SANA-WM video latent normalization in the existing VAE config module.

  • Inherit identical CUDA/MUSA unsupported-device methods and the default XPU communicator.

  • Reuse identical ModelOpt FP8 inference dispatch while retaining separate postprocessing.

  • Reuse the existing unquantized linear weight allocator for embeddings, without changing the embedding method's base class or its apply/embedding implementations.

  • Unused diffusion CPU-architecture probe (the SRT implementation remains used and unchanged), plus eight obsolete test-only HTTP/port/memory/video/GT helper functions and their typing-only import.

  • Uncalled post-training SP reduce, temporary logger suppression and error-formatting helpers.

  • Inline the single-caller AutoConfig wrapper and remove redundant NVFP4 list forwarding.

  • Share Wan/LingBot 3D sequence-shard RoPE coordinate construction in the existing NDRotaryEmbedding class, keeping their independent model-level LRU caches.

  • Share identical generic/H3 latent input verification in the existing latent-preparation module, preserving H3's inheritance and noise-generation path.

  • Unwired function-level Python tracing and its unused env entry. Setting the removed env emits a retirement warning; --enable-trace request tracing is unchanged.

  • Superseded CLI cleanup, safetensors shard filtering, single-file NVFP4 wrapper, and unused HF helpers/context-length constant. Active file-selection and quantization paths are unchanged; SRT's same-named utilities are untouched.

  • Share H3 positive-finite float validation between sampling configuration and canonical requests through the existing configuration utility module, preserving accepted inputs and error messages.

  • Share 2x2 latent packing across Qwen-Image, FLUX.1 and LongCat through the existing pipeline configuration base, removing FLUX's dependency on a private Qwen helper. FLUX.2's distinct layout is unchanged.

  • Share Cosmos3's QKV/output projection initialization within its existing model module; causal and cross-attention retain separate head checks, norms and execution paths.

  • Reuse the existing prequantized NVFP4 GEMM implementation for the ordinary linear path's duplicated tail, preserving activation quantization, tuple opt-in rejection and output reshape.

  • Share SANA-WM AdaLN modulation preparation between dense and streaming block entry points, without merging their attention, cache or FFN control flow.

  • Remove thirteen unused parallel-state/communication and WebUI argument helpers. Keep process-group initialization/destruction, active DP accessors and the declared distributed exports unchanged.

  • Remove unused LTX2 latent denormalization helpers, Z-Image padding inspection and the obsolete sequence-rank alias. Active decoder normalization and canonical SP accessors remain unchanged.

  • Remove superseded capacity-blind disaggregation selection, its unused maximum-slot setting and kwargs plumbing, and the empty completion hook. Capacity-aware selection is now the abstract policy contract; production algorithms, counters, locks and pool routing are unchanged.

  • Store disaggregation request start timestamps directly instead of allocating a private dataclass with an unused stage timestamp; preserve exported statistics, locking and formulas. Remove LTX2's unused generic coordinate wrapper while retaining the directly used video/audio methods.

  • Remove forward-context batch-size timing that was permanently disabled with no configuration or caller, together with its unused globals/imports and unwritten attention-backend field/setter. Preserve active timestep, metadata, batch and nested-context restoration; request/stage observability is unchanged.

  • Remove the unused pipeline JSON-export method and its exclusive imports, plus empty stage hook/offload methods with no callers or overrides. Keep CLI JSON loading and active stage load_model fallback intact.

  • Remove MOVA scheduler's uncalled training target/weight and reverse-recovery methods, unused training branch/argument and write-only training state. Retain train_timesteps/train_sigmas because inference step_from_to uses their lookup tables.

  • Share the validation and construction logic of MOVA's directional sequential and single-modality pair modes within their existing scheduler method, retaining each direction's tensor operation order and errors.

143 existing production files: net 1,820 lines removed, including the obsolete disaggregation shim. 109 net lines removed from existing test files, including obsolete helper definitions; one stale source reference corrected. No test cases or assertions were removed. No new files, configuration, tests, or numerical-path changes.

  • Reuse offload component-name normalization for load ordering; remove its duplicate implementation without changing suffix handling or risk ranking.

  • Share identical model unwrapping between Ideogram and Z-Image BCG prompt padders in their existing prompt-padding utility; preserve wrapper lookup order and the separate model-identification semantics.

  • Remove six obsolete channels_last_3d API-existence checks in VAE loading/layout and parallel convolution. Keep device-policy gates, tensor-layout checks, conversion exceptions, and environment overrides unchanged.

  • Use the public PyTorch schema-inference API directly for custom-op registration; remove the obsolete PyTorch 2.4 private fallback and a catch-and-rethrow-only AttributeError handler. Preserve duplicate-registration protection and fake implementation registration.

  • Remove catch-and-rethrow-only wrappers from default weight loading and Qwen2.5-VL parameter lookup. Keep scalar filling, shape validation, extra-bias skipping, and missing-parameter errors unchanged; do not remove exclusion handlers ahead of broader recovery catches.

Validation

  • Loader rethrow cleanup: two retained full-module AST contracts match after unwrapping only the redundant tries. Forty-eight native CPU/CUDA scalar/copy cases, twelve shape-error cases, and twenty-four Qwen production-method dispatch/error cases match, including parameter-storage identity. Existing weight-utils/Qwen-generation/text-loader suites pass (79 tests, 9 subtests, 3 skips); pre-commit passes. No full-checkpoint E2E claim.

  • Custom-op registration cleanup: retained full-module AST matches on the supported public-schema branch after removing the redundant rethrow handler. Twelve native CPU/CUDA cases cover schemas, duplicate registration, mutation, and FakeTensor for FP32/FP16/BF16; three error contracts match. Existing OOT-platform/quantization suites pass (90 tests, 31 subtests); pre-commit passes. No model E2E or performance claim.

  • channels_last_3d guard retirement: four retained full-module AST contracts match when the supported PyTorch API is present; 48 CPU/CUDA layout cases, six simulated device policies, and six native conversion states agree with the frozen parent. Existing VAE-loader, Wan-frame, and LTX channels-last tests pass (49 tests, 8 subtests); pre-commit passes. No real non-CUDA or multi-GPU execution claim.

  • BCG unwrap deduplication: three retained full-module AST contracts match; 42 CPU/CUDA comparisons preserve wrapper object identity, rotary outputs, and metadata-cache reuse. Existing BCG padding/coordinate suites pass (34 tests, 5 subtests); pre-commit passes. This is not a full CUDA-graph or checkpoint E2E benchmark.

  • Component-name deduplication: retained full-module AST matches after replacing the helper; 132 frozen-parent name/risk-rank cases agree, including Unicode and repeated suffixes. Existing component-loading-order and layerwise-offload suites pass (202 tests) on RTX PRO 6000; pre-commit passes.

  • Share Llama/Qwen3 encoder loading in existing weight_utils.py: preserve rotary-cache filtering, KV-scale remapping, stacked shard loading and Qwen3-only model. prefix removal; no other encoder adopts this helper. TP1 native frozen/current checks cover 64 real safetensors loads, 128 forwards, 8 FP8 shard loads, 32 successful dispatches and 32 matching dispatch errors. Weight/output/hidden-state values and ATen sequences match, source tensors stay unchanged and measured load peak allocation does not increase. 76 existing tests and 9 subtests pass, 3 skip; pre-commit passes. Tiny loader-only medians remain about 1 ms; no full-checkpoint E2E or speedup claim.

  • Remove four identity assignments in packed linear loading, VSA metadata and PIL input handling; replace the no-op PIL branch with the same invalid-input check. Three full-module AST comparisons account for only these no-ops; 32 frozen/current PIL/bytes/path/data-URL image conversions and invalid-input errors match. 49 existing linear/VSA/image API/input-validation tests and pre-commit pass. No kernel, tensor math or full-checkpoint performance claim.

  • Share legacy Column/RowParallelLinear checkpoint slicing and copying within linear.py, eliminating two self-assignments. Keep each loader entry point and all constructor, forward, packed/QKV and v2 loader bodies unchanged. 360 frozen/current CPU/CUDA FP32/FP16/BF16 rank-loading comparisons cover TP1/2/4 rank slices, already-sharded checkpoints, scalar scales, shape assertions and unchanged parameter storage; retained module AST matches. 145 existing tests and 27 subtests pass; pre-commit passes. Rank slicing validation is not a multi-GPU collective E2E or speedup claim.

  • Hunyuan3D denoising and Kandinsky6 decoding: inherit shared stage initialization instead of forwarding-only constructors. Existing call signatures remain accepted; base-class optional arguments are now exposed. All remaining module AST matches the frozen parent. 16 CPU/CUDA FP32/BF16 frozen/current initialization comparisons preserve state keys, component references, pipeline weakrefs and attention backend selection; 80 existing tests and pre-commit pass. No full-checkpoint E2E or speedup claim.

  • Stateless initialization: remove super-only constructors from SiluAndMul, MOVA MulAdd, T5MultiHeadAttention and NPUMXFP4Config. Four complete-module AST comparisons preserve every other method; inherited initialization and 12 CPU/CUDA FP32/BF16 operation checks pass, as do NPU configuration metadata checks (no physical NPU kernel claim). 150 existing tests and 34 subtests pass, 3 skip; pre-commit passes. No full-checkpoint E2E or speedup claim.

  • LoRA linear initialization: remove five parameter-forwarding constructors and inherit the existing common initialization. Preserve argument names/order/defaults, snapshots, state registration, adapters and every forward/slicing body; complete retained module AST matches. 80 real linear/LoRA CPU/CUDA FP32/BF16 constructor comparisons preserve state, RNG and snapshot clone/view semantics for positional/keyword arguments. 59 existing LoRA tests pass; pre-commit passes. No full-checkpoint E2E or speedup claim.

  • Constructor/state cleanup: remove unused LTX audio VAE z_shape copies, communicator global_world_size copy, obsolete CustomOp.default_on stub and two super-only GELU constructors. Keep inherited initialization, explicit platform-forward overrides, registration and all numerical bodies. Four complete retained module ASTs match; 32 native CPU/CUDA FP32/BF16 activation-gradient/audio-VAE comparisons and real single-rank Gloo retained-state comparison match the frozen parent. 75 existing OOT/distributed/model-boundary/disaggregation tests plus 14 subtests pass; pre-commit passes. No full-checkpoint E2E or performance claim.

  • Inherited defaults: reuse Platform device-capability/default-communicator methods in MPS/NPU, parent Diffusers pipeline initialization and default replicated Helios stage parallelism; remove uncalled no-op NPU/ROCm/XPU warning hooks. Retained ASTs in six modules match after explicit removals. Frozen-parent native-module checks preserve query values, initialization return and parallelism; 103 existing platform/OOT, Helios, disaggregation and selector tests plus 31 subtests pass. Pre-commit passes. Preserve Qwen cache-policy overrides and CustomOp overrides whose presence affects OOT dispatch. No physical MPS/NPU/ROCm or full-model benchmark claim.

  • Metadata-builder lifecycle: remove the unused abstract prepare hook, all 14 no-op implementations, abstract constructor and 13 empty constructors. Keep VSA-H3 workspace-cache initialization and every build method unchanged. All 14 retained module ASTs match after explicit removals. 11 real imported builder constructors/state/signatures match the frozen parent; three optional backends lack dependencies and are statically checked only. Build remains mandatory; build-only extensions instantiate. 119 existing attention/H3 tests and 33 subtests pass, three tests skip; pre-commit passes. No backend-kernel or E2E speedup claim.

  • Unwired interfaces: remove the unreferenced VideoRemixRequest schema, UnspecifiedPlatform placeholder and obsolete check_sampling_param wrapper. Platform fallback still selects CPU; native/OOT contracts and active sampling validation are retained. Wan progressive denoising inherits the identical no-op resolution hook. Four retained module ASTs match after explicit removals. 104 existing platform/OOT, API, sampling and progressive tests plus 74 subtests pass; pre-commit passes. Retired interfaces have no compatibility shim.

  • Dead configuration/constants: remove the unconsumed logging dictionary and its exclusive import/format aliases, unused RoPE cache and six unused model/video constants. Retained code in all six modules has identical ASTs after the explicit removals. 57 existing logging, RoPE, SR tiling, LingBot and realtime tests pass; pre-commit passes. Active logger setup, encoding and video transport remain unchanged.

  • Retired placement interface: remove unwired ResidencyTarget/RankResidencyReport types and their exclusive constants/imports; preserve WarmupMemoryRecord and all active estimation formulas. Complete retained AST matches; JSON wire format and 2,048 frozen-parent estimate comparisons match. 79 existing auto-residency, warmup, RoPE and FLUX2 tests pass after merging main. No checkpoint E2E or performance claim.

  • SANA refiner blocks: reuse the existing video-block body across ordinary and streaming refiners, with explicit self-attention callbacks. Preserve independent attention implementations, KV prefix/capture, modulation, cross-attention and FFN operation order. Complete module ASTs match after the explicit helper/call-site normalization. 120 real Diffusers LTX2 block CPU/CUDA FP32/BF16 comparisons preserve output/layout, ATen sequence and captured KV across interleaved/split RoPE, context boundaries and pre/post capture/history modes. 92 existing SANA tests and two subtests pass. No full-checkpoint E2E or speedup claim.

  • GLM/mesh state: remove unread GLM default-size calculation and MeshRender camera/bake attribute copies; retain constructor arguments, request sizing and projection selection. Two complete module ASTs match after three assignment removals. 48 native CPU/CUDA mesh projection comparisons and nine GLM constructor/component-policy comparisons pass; 25 existing GLM/Hunyuan3D tests and three subtests pass. No full rendering, checkpoint E2E or performance claim.

  • Coordinator/postprocessing state: remove unread SRVGG constructor copies, Qwen layered default-size state and retired coordinator flags/annotation. Constructor interfaces and active communicator creation remain unchanged. Three complete module ASTs match after exact state deletions; 48 native SRVGG CPU/CUDA FP32/BF16 registration, weight, RNG and forward comparisons pass across activations, depths and scales. 60 existing distributed/graph/role tests and five subtests pass. No multi-GPU inference or performance claim.

  • Realtime text-cache copying: consolidate two single-caller list wrappers into the existing field-copy function. Preserve tensor identity, independent outer lists and nested sequence-length lists, including None/empty inputs. 120 native CPU/CUDA FP32/BF16 copy-contract checks and 184 existing cache/model-boundary/residency tests pass, with one existing skip. No numerical or performance claim.

  • RealESRGAN transfer wrappers: inline the single-caller H2D/D2H pass-throughs, retaining preprocessing, postprocessing and every existing timing region. Whole-module AST matches after exact inlining. 48 native small SRVGG/RRDB CPU/CUDA FP32/BF16 batch upscales preserve pixel output, layout, ATen calls, RNG and input arrays across batch 1/2 and native/downsample/extra-upsample output sizes; empty and mismatched inputs retain their behavior. No pretrained-checkpoint E2E or performance claim.

  • Encoder/shape component copies: remove eight unused attributes in T5Stack, Pi05 RMSNorm and Hunyuan3D VAE helpers, retaining constructor signatures and actual branch, projection and attention settings. Three remaining complete module ASTs match. 64 native CPU/CUDA FP32/BF16 constructor/state/RNG comparisons pass, including 56 Pi05/Hunyuan3D forwards with exact output/stride. 94 existing encoder/Pi05/Hunyuan3D tests and three subtests pass, with three existing skips. T5 coverage is construction only; no pretrained-checkpoint E2E or performance claim.

  • Audio component copies: remove six unused scalar attributes from DAC/H3 audio encoders, AliasFree activation, LTX audio patchifier and LTX vocoder, retaining actual channel/filter/layout/dilation settings. Five complete module ASTs match after assignment removal; 40 native CPU/CUDA FP32/BF16 waveform or patchify/unpatchify comparisons preserve output/stride, state, registration and RNG. 47 existing audio/VAE/configuration tests and five subtests pass. No pretrained-checkpoint E2E or performance claim.

  • Unread DiT constructor copies: remove seven ordinary attributes from Wan/causal Wan, Qwen-Image, FLUX/FLUX.2, Cosmos3 and LTX2. Keep constructor arguments, projection bias/domain sizing and parameter-loader closures unchanged. Seven complete module ASTs match after assignment removal; 56 native CPU/CUDA FP32/BF16 constructor comparisons preserve registration, parameter metadata, ATen calls and RNG across flag/domain/epsilon settings. 168 existing model tests and 56 subtests pass. No multi-rank, full-checkpoint E2E or performance claim.

  • MOVA image-position state: remove unused model copies and an empty placeholder, retaining the configuration fields and all checkpoint parameters. Complete remaining module ASTs match after five assignment deletions; 32 native audio/video CPU/CUDA FP32/BF16 constructor comparisons preserve registration, state keys, parameter metadata, ATen operations and RNG across both flag settings. 57 existing component-loader/disaggregation tests and two subtests pass. No full-checkpoint E2E or performance claim.

  • Gemma3 fused-shard loading: share the duplicated text/vision shard-ID conversion in the existing model module, preserving initial attempt, fallback order and exceptions. Remaining whole-module AST matches after helper extraction, and all three helper bodies are AST-identical. 96 native single-rank CPU/CUDA FP32/BF16 QKV/merged-linear load and error comparisons are exact; 61 existing Siglip/encoder/linear-loader tests and three subtests pass, with three existing skips. No multi-rank, full-checkpoint E2E or performance claim.

  • Latest unused-state cleanup: remove four ordinary H3 VAE attributes, preserving all checkpoint parameters and actual sampling/epsilon settings. Whole-module ASTs match after subtracting the assignments; 16 native CPU/CUDA FP32/BF16 SnakeBeta output, gradient, state and RNG comparisons are exact. 18 existing H3 VAE tests pass. No full-checkpoint E2E or performance claim.

  • Recent CLI/LTX and model/attention cleanup: remove unused CLI argument-name lists and their helpers, old LTX state copies, Hunyuan/SANA/condition-encoder copies and FlashAttentionImpl's unused default metadata allocation. Active configuration, projection initialization, temporal tiling and caller-supplied attention metadata remain unchanged. Complete remaining ASTs match; 59 existing CLI/LTX tests and nine subtests, then 151 model/backend tests and seven subtests pass (two existing skips). 16 native FA4 FP16/BF16 output/LSE comparisons are exact. No FA3 or full-checkpoint E2E claim.

  • Recent placement wrapper cleanup: remove unused Pi05 postload pruning, residency option property and generic resize wrapper; preserve role-aware constructors, policy fields and active preprocessing. Remaining ASTs match; 72 policy/wire comparisons are exact and 127 existing tests pass.

  • Unused configuration conveniences: remove Krea2 packed-width property, disaggregation device resolver and local-mode property, without changing model projections, configuration fields, CLI or active startup/device paths. Complete remaining module ASTs match after the deletions and exclusive typing-import cleanup. 271 existing Krea2/server-args/disaggregation tests and 100 subtests pass. No full-checkpoint E2E or performance claim.

  • Audio/API helper removal: remaining complete module ASTs match after deleting three unused methods and exclusive imports. 24 native small Cosmos3 audio-decoder CPU/CUDA FP32/BF16 comparisons match exactly in output/stride across tanh/none normalization and batched/unbatched latents; API URL constructors match. 184 existing Cosmos3/ComfyUI tests and 53 subtests pass, with one skip and three expected failures. The extra apps/test_h3_request.py suite has a collection failure from its incomplete folder_paths stub, reproduced with the unchanged parent server API; it is not claimed as passed. Framework VideoInput and H3 executor hooks remain intact. No full-checkpoint E2E or performance claim.

  • Unwired model configuration wrappers: remove unused Ideogram finalize forwarding, Qwen Edit Plus resize helper and H3 audio capability methods. Keep active loader hooks, image preprocessing, audio fields and disaggregation support unchanged. Remaining complete module ASTs match; four Ideogram configuration updates and four native PIL image paths match the frozen parent. 192 existing model/configuration/admission/loader tests and 41 subtests pass. No full-checkpoint E2E or performance claim.

  • Unused VAE/config methods: remove uncalled Gaussian nll and its exclusive NumPy import, MOVA normalize wrapper and LTX enum convenience methods; preserve DAC KL, MOVA denormalization and all enum values/configuration fields. Complete remaining module ASTs match. 36 native CPU/CUDA FP32/FP64/BF16 distribution comparisons preserve mode, sample, KL and generator state exactly. 84 existing configuration/VAE/conditioning/decoding tests and seven subtests pass. No full-checkpoint E2E or performance claim.

  • Embedding cleanup: remove unused diffusion logits reindexing and the unregistered embedding-LoRA stub; SRT implementations stay unchanged. Complete parent-module ASTs match after subtracting only retired definitions/imports. 142 existing encoder/GGUF/LoRA tests and eight subtests pass, with three existing skips. No full-checkpoint E2E or performance claim.

  • Directional pair-mode reuse: 336 native CPU/CUDA FP32/FP64/BF16 comparisons across empty, odd/even and strided inputs preserve output, gradient, stride and full ATen order; 24 invalid-input exceptions match. The 5,376 schedule/inference comparisons and 57 related existing tests plus two subtests pass again. No full-checkpoint E2E or speedup claim.

  • MOVA scheduler inference: 5,376 frozen-parent CPU/CUDA FP32/BF16 step, add-noise and explicit-pair updates match exactly across reverse/inverse/extra-step/exponential flags, terminal shifts and seven pair postprocess modes. Lookup tables, paired schedules and remaining module AST are unchanged after removing the retired training interface. 57 existing loader/disaggregation tests and two subtests pass. No full-checkpoint E2E or speedup claim.

  • Retired pipeline interfaces: complete parent-module AST comparisons preserve all remaining code after subtracting three unused methods and exclusive imports; actual JSON loading and retained stage load_model remain available. 312 existing configuration, server-args, stage-profiling and decoding tests plus 102 subtests pass. No full-checkpoint E2E or performance claim.

  • Forward-context cleanup: 120 nested, exception, metadata and batch comparisons preserve values, identities and restoration; active getter/context-manager AST matches after removing the disabled branches. 52 existing attention backend, cache reset, LoRA and USP tests plus two subtests pass. No full-checkpoint E2E or performance claim.

  • Timing storage and coordinate cleanup: 2,002 sequential frozen-parent metric snapshot comparisons match exactly, including zero timestamps, duplicate/unknown IDs and throughput-window pruning; 1,500 concurrent lifecycles preserve all metrics. The remaining complete LTX2 module is AST-identical. 26 existing observability/disaggregation/LTX coordinate tests pass. No full-checkpoint E2E or measured performance claim.

  • Capacity-aware dispatch cleanup: all retained selection algorithms are AST-identical. 10,362 frozen-parent sequential policy/pool selections and counter comparisons match across one to five workers, exhausted capacity and ties. Eight-thread balance, actual orchestrator construction and invalid-policy/instance errors pass; 58 related disaggregation tests pass. No distributed full-model E2E or performance claim.

  • Obsolete model helpers: complete-module AST comparisons preserve all remaining code after deleting unused LTX2 video/audio denormalization, Z-Image padding and SP-rank wrappers; actual model/config imports pass. 65 existing configuration, decoding and parallel-runtime tests and five subtests pass. Active normalization and attention-mask paths are unchanged; no full-checkpoint E2E or performance claim.

  • Unused helper removal: the remaining complete AST of all three modules matches the parent after subtracting exactly the thirteen functions and unused argparse import; declared distributed exports still resolve. 51 existing WebUI/bootstrap/parallel-runtime tests and 18 subtests pass. No full-checkpoint E2E or performance claim; direct imports of retired internal helpers are intentionally not kept as compatibility shims.

  • SANA-WM modulation: 16 native dense and 48 consecutive streaming FP32/BF16 block comparisons match exactly in output/cache and warmed ATen sequence; cold outputs also match. Existing shared first-signature fusion checks are warmed symmetrically before trace comparison. 101 related tests and two subtests pass; two external-reference tests retain their original dependency skips. No full-checkpoint E2E or performance claim.

  • NVFP4 delegation revalidated on the current code: 96 real FlashInfer FP4 cold/warm kernel comparisons and eight CUDA Graph pairs (two replays each) match exactly, including stride, ATen order, RNG and input/weight immutability. 20 backend/capability/checkpoint tests and 12 subtests pass. Coverage uses Blackwell's default auto backend; no all-backend or full-model speedup claim.

  • Cosmos3 projection initialization: 32 CPU/CUDA FP32/BF16 unquantized/FP8 constructor comparisons preserve registration order, parameter metadata, ATen calls and RNG; 16 unquantized native projection comparisons match exactly. 165 existing Cosmos3 tests and 63 subtests pass. No new multi-GPU or full-checkpoint E2E claim.

  • Shared 2x2 packing: 192 CPU/CUDA FP32/BF16 old/new comparisons match exactly in output, gradient, stride and storage sharing across contiguous/transposed/channels-last inputs; four invalid-shape exception comparisons match. 120 related LongCat/Qwen/provided-latent/RoPE tests pass. This is helper/configuration validation, not a full-checkpoint E2E or speedup claim.

  • H3 shared positive-finite validation: 108 old/new return-value and exception comparisons match; both callers use the same implementation. 87 related sampling/admission/FastH3 tests and 34 subtests pass in the isolated GPU environment. No full-checkpoint E2E or performance claim for this helper-only change.

  • Repository-wide reference audit, including dynamic attribute-name references.

  • For helper/state deletions, the remaining complete modules are AST-identical after removing the explicitly listed dead definitions/assignments/imports. Trace retirement additionally adds a conditional warning for users setting the unused env.

  • Pre-commit and diff checks pass.

  • VAE tile geometry: 18 existing tests and 12 subtests pass, including four-process Gloo TP x SP grouping. 64 geometry comparisons and 32 native small Hunyuan VAE CPU/CUDA FP32/BF16 tiled encode/decode requests match exactly, including ATen order. No full-checkpoint, multi-GPU VAE or performance claim.

  • SLA common components: 50 existing tests and 4 subtests pass. 72 CPU/CUDA/meta initialization comparisons match metadata, ATen calls and RNG; 96 linear-output comparisons and 12 native SLA sparse forwards are exact. Unknown-feature errors match. SageSLA's optional kernel is unavailable: only its shared components and unchanged availability assertion were verified, not Sage kernel execution or full-model E2E.

  • Encoder head partition: 43 existing tests pass. For each rank, 5,780 frozen-parent rule/error comparisons and 96 CUDA constructor comparisons match; 96 native attention forwards are exact on single GPU and TP2, covering sharded/replicated KV heads and global/sliding attention. FP8 coverage is construction only. This cleanup removes duplicated rules at unchanged net LOC; no full-checkpoint E2E claim.

  • ConvRot allocation: 141 existing tests and 22 subtests pass, with 1 skip and 3 expected failures. 324 frozen-parent CPU/CUDA/meta comparisons preserve allocation, parameter metadata, ATen calls and RNG; 10 invalid-shape/attribute-collision comparisons preserve errors and partial registration. JIT cold import does not read kitchen settings. No full-checkpoint E2E claim.

  • MOVA initialization: 62 existing tests pass. Frozen-parent comparisons cover 16 CPU/CUDA FP32/BF16 unquantized/FP8 constructors per rank; module/parameter metadata, ATen calls and RNG match. Native embedding/projection and CUDA block outputs are exact for single GPU, TP2 and Ulysses2. CPU TP2 reproduces the same unsupported NCCL collective error. No full-checkpoint E2E claim.

  • Action request extras: 88 existing tests and 34 subtests pass; 48 frozen-parent base/Pi05/Flux3 comparisons preserve nested references, explicit fields, request merge and subclass dispatch.

  • Channelwise VAE normalization: 43 existing tests and 34 subtests pass; 108 frozen-parent CPU/CUDA comparisons match values, ATen order and RNG. 18 invalid-shape errors match. No full-checkpoint E2E claim.

  • LTX video normalization: 124 existing tests and 7 subtests pass; 192 native CPU/CUDA FP32/FP16/BF16 frozen-parent comparisons are exact, including scale precedence, missing statistics and strided tensors.

  • Platform defaults: 35 existing tests and 31 subtests pass, plus AST deletion checks, native CUDA properties and XPU class resolution. No MUSA/XPU hardware inference claim.

  • ModelOpt FP8 dispatch: 74 existing tests and 22 subtests pass; 24 native CUDA FP8 comparisons are exact.

  • Latest embedding allocation cleanup: 175 existing encoder/quantization/GGUF tests and 30 subtests pass, with 3 skips. 54 frozen-parent CPU/CUDA/meta cases match allocation shape/dtype/metadata, ATen calls and RNG state; native embedding/linear outputs and metadata-collision errors are unchanged. Embedding-first and GGUF-first cold imports pass. No full-model startup or MPS performance claim.

  • Preceding unused-helper cleanup: 309 existing consistency (including audio), performance-metric/baseline, OpenAI-utility and server-args tests plus 100 subtests pass offline on RTX PRO 6000. Remaining complete modules are AST-identical after the listed deletions/import cleanup; cold imports and retained video validation pass. An extra failure-injection runner suite was interrupted after 84 passes because its seven-attempt subprocess retries spend substantial time in pytest exit GC; that interrupted suite is not claimed as passed.

  • Preceding RoPE deduplication: 45 existing LingBot/RoPE tests pass. 80 frozen-parent CPU/CUDA comparisons across FP32/FP64, rank offsets, frame boundaries and empty shards are exact, including ATen calls, RNG state and cache-hit object identity. Cache wrappers remain separate. This commit adds 3 net lines while removing a duplicated algorithm; it is not a speedup claim.

  • Preceding latent-verification cleanup: 66 existing tests and 5 subtests pass on RTX PRO 6000. Frozen-parent comparisons match across 1,296 validation calls, 12 combined-error cases, and 32 native grouped H3 latent-preparation requests; these use small synthetic geometry, not full checkpoints.

  • Preceding wrapper cleanup: 133 existing encoder/quantization/component-identity tests and 27 subtests pass offline, with 3 skips. Native encoder configs match at slots 0/1; the NVFP4 implementation and signature are AST-identical under the public entry-point name.

  • Preceding trace retirement: 230 existing logging/request-trace/server-args tests and 100 subtests pass offline. Unset legacy env is silent; explicit 0/1 emits the retirement warning.

  • Preceding shim/helper cleanup: 332 existing server-args/disaggregation/logging/residency/rollout tests and 100 subtests pass with HF_HUB_OFFLINE=1. The initial online run was interrupted after confirming an unrelated HF TLS handshake wait; no assertions or tests were bypassed.

  • Preceding config-registry cleanup: 78 existing loader/HF tests pass, with 3 skips and 3 subtests. Exact config parity checked for Qwen2.5-VL, Qwen3, CLIP, T5 and a custom AutoConfig registration, including overrides and GGUF rejection.

  • Preceding utility-only commit: 144 existing file-selection/HF/quantization/config tests and 28 subtests pass in an isolated RTX PRO 6000 environment.

  • The preceding base-class cleanup passed 69 existing encoder/stage/executor tests, with 3 skips and 3 subtests.

  • The earlier state cleanup passed 257 related tests and 13 subtests.

  • Native small Qwen VAE: finite weights and consecutive encode/decode requests match exactly in FP32 and BF16.

  • The preceding helper-only commit passed 152 existing USP/quantization tests, with 3 skips and 29 subtests. Four encoder-loader tests initially lacked world-group initialization; the unmodified parent reproduced them, and using the repository's existing single-process model-parallel fixture resolved them without changing assertions.

  • No full-checkpoint E2E or performance claim. SVG2's optional kernel dependency is absent, so its coverage is limited to module import.


CI States

Latest PR Test (Base): ✅ Run #37888402926
Latest PR Test (Extra): ❌ Run #37888402612
Latest PR Test (AMD ROCm 10): ⏳ Run #37888402820

@mickqian mickqian added run-ci CI: run the baseline test suite on this PR diffusion SGLang Diffusion labels Oct 8, 2026
@github-actions github-actions Bot added the quant LLM Quantization label Oct 8, 2026
@mickqian mickqian changed the title [diffusion] Remove unused private helpers [diffusion] Remove unused helpers and write-only state Oct 8, 2026
@mickqian

mickqian commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator Author

Another small deduplication in cad067f: reuse the identical ModelOpt FP8 inference method, while retaining separate weight postprocessing (packed-shard scales and ROCm conversion), configuration factories, and class inheritance. One existing production file, net -11 lines; cumulative production reduction is 390 lines. No new repository tests.

Validation on RTX PRO 6000: 24 native CUDA FP8 comparisons against the parent implementation are exact (FP16/BF16, varying token counts, bias, CUTLASS enabled/disabled). Existing transformer quantization tests: 74 passed and 22 subtests passed. Pre-commit passed. These are component tests, not full-model E2E or a performance claim.

@mickqian

mickqian commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator Author

7121bd0 removes redundant platform overrides: CUDA/MUSA base classes inherit the same unsupported-device methods, and XPU inherits the default device communicator. Concrete device implementations and XPU's CPU all-to-all communicator remain unchanged. Net -24 production lines; cumulative reduction is 414 lines, with no new repository tests.

Validation: full-module AST comparison confirms only those five methods were deleted. Native CUDA device queries, inherited exceptions, and XPU class resolution pass. Existing platform detection, out-of-tree runtime, and worker bootstrap tests: 35 passed, 31 subtests passed. Pre-commit passed. No MUSA/XPU hardware inference or performance claim.

@github-actions github-actions Bot added the Multi-modal multi-modal language model label Oct 8, 2026
detain added a commit to detain/sglang that referenced this pull request Oct 8, 2026
… of sgl-project#43064)

Squash of 13 commits 48c3a28..da3d8c6 (PR rebased onto main tip
407f7f0; net diff via git apply -3). Removes rethrow-only wrappers,
obsolete channels_last_3d/sinc fallbacks, identity assignments; shares
BCG model unwrapping, component-name normalization, and LLM-encoder
weight loading (load_llm_encoder_weights).

Conflict resolutions:
- encoders/llama.py + qwen3.py: took theirs (shared helper call).
  Ported load_stacked_weight() def from merged upstream sgl-project#42988 (not in
  our tree) into weight_utils.py as the helper's dependency.
- layers/lora/linear.py: kept OURS in all 4 blocks — our sgl-project#37460 rework
  already removes the per-class inits/forwards this PR targets; the one
  clean hunk (redundant LinearWithLoRA.__init__) applied.
- disaggregation/orchestrator.py: kept OURS (file is our sgl-project#32550 DAG
  rewrite; the PR's receiver-dispatch dedupe targeted old main shape).
  Net file unchanged.
- Skipped two PR file-hunks outright: vaes/alias_free.py and
  model_specific_stages/kandinsky6/decoding.py exist only upstream of
  our merge-base (not in this tree).

Tests: py_compile all; unit -k lora/encoder/padding/breakable/vision/
transfer 347 passed; weight_utils runai-module failures pre-existing
(env lacks runai_model_streamer), file untouched by PR.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

amd apple-silicon diffusion SGLang Diffusion mthreads Multi-modal multi-modal language model npu quant LLM Quantization run-ci CI: run the baseline test suite on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant