You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enable the existing rms_affine modulate and residual fusions in LingBotVideo:
Keep the timestep embedding broadcastable across tokens instead of expanding it with ggml_repeat, and call ctx->expand_graph(temb6) so timestep ops stay outside the first block's fusion pattern.
Swap the ggml_mul operand order on gated residuals to match the fused residual pattern.
Pass gf to get_context(gf) so graph expansion is wired up.
Related Issue / Discussion
N/A
Additional Information
Tested on Windows with an RTX 5070 Ti Laptop GPU and CUDA 13.4 using lingbot-video-dense-1.3b.safetensors, Qwen3-VL-4B-Instruct-Q4_K_M, and Wan 2.1 VAE at 512x288, 17 frames, CFG 3, seed 42, with --offload-to-cpu --vae-tiling.
Across three interleaved 10-step runs, mean sampling time dropped from 7.68 s to 6.19 s, steady-state throughput rose from 1.66 it/s to 2.04 it/s, and the DiT CUDA compute workspace dropped from 514.41 MB to 287.44 MB.
On a 20-step run using the documented cat prompt, sampling time dropped from 17.06 s to 12.96 s with visually matching output frames, PSNR 39.91 dB and mean pixel difference 1.01 / 255.
Under nsys on a 3-step CFG run, all 288 sd_rms_affine modulate and 288 residual kernels fired, removing 576 standalone rms_norm_f32 and 288 gate mul launches.
LingBot MoE 30B shares LingBotBlock but was not tested with real weights due to local disk and VRAM limits; Vulkan and Metal were not tested.
No actionable comments were generated in the recent review.
Walkthrough
LingBot Video now uses a single timestep embedding per batch for modulation, applies gates to attention and FFN outputs, and passes the graph to the runner context lookup.
Changes: LingBot Video Forward Pass
Layer / File(s)
Summary
Modulation and graph construction src/model/diffusion/lingbot_video.hpp
temb6 uses a one-token shape and is expanded into the graph before the block loop. Attention and FFN outputs are multiplied by their gates. build_graph calls get_context(gf).
This change enables existing fused modulation kernels in LingBot Video to reduce sampling time and memory. No concrete correctness or stability defect was found. The author reports matching output on CUDA. The MoE variant, Vulkan and Metal were not tested, which is ordinary residual uncertainty.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: enabling rms_affine modulation fusion for LingBot video, under a perf() prefix. The raw summary shows changes to LingBot block modulation, timestep embedding handling,…
Description check
The description follows the template's main sections: Summary, Related Issue / Discussion, Additional Information, and Checklist. The Summary explains what changed and why. The Related Issue section s…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the main change: enabling rms_affine modulation fusion for LingBot video, under a perf() prefix. The raw summary shows changes to LingBot block modulation, timestep embedding handling, and get_context(gf), which match the title's focus on fusion. The title does not mention the operand order swap or the get_context change, but it does not need to cover every detail.
Full details: Description check
Explanation
The description follows the template's main sections: Summary, Related Issue / Discussion, Additional Information, and Checklist. The Summary explains what changed and why. The Related Issue section says N/A. The Additional Information section gives detailed test notes and limits. The checklist has the contribution guidelines item checked. The template's model documentation checklist item is absent. That item applies only if the PR adds or changes model support, and this PR changes performance code paths, so the omission is minor.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: db72b383-7fba-4dc0-acb9-b7a13cf19f9e
Commits
Reviewing files that changed from the base of the PR and between 5fa203c and 2515763.
Files selected for processing: 1
src/model/diffusion/lingbot_video.hpp
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Enable the existing
rms_affinemodulate and residual fusions inLingBotVideo:ggml_repeat, and callctx->expand_graph(temb6)so timestep ops stay outside the first block's fusion pattern.ggml_muloperand order on gated residuals to match the fused residual pattern.gftoget_context(gf)so graph expansion is wired up.Related Issue / Discussion
N/A
Additional Information
Tested on Windows with an RTX 5070 Ti Laptop GPU and CUDA 13.4 using
lingbot-video-dense-1.3b.safetensors,Qwen3-VL-4B-Instruct-Q4_K_M, and Wan 2.1 VAE at512x288, 17 frames, CFG 3, seed 42, with--offload-to-cpu --vae-tiling.nsyson a 3-step CFG run, all 288sd_rms_affinemodulate and 288 residual kernels fired, removing 576 standalonerms_norm_f32and 288 gatemullaunches.LingBot MoE 30B shares
LingBotBlockbut was not tested with real weights due to local disk and VRAM limits; Vulkan and Metal were not tested.Checklist
Summary by CodeRabbit