[PERF] Unify distributed communication for real-time LingBot-World v2 - #22
Merged
Conversation
Fuse normalization and modulation kernels, reuse LingBot model inputs and projected session data, and reduce redundant RoPE and KV bookkeeping across denoising steps. Keep FA4 return-LSE dispatch compatible and prefer tf-kernel RMSNorm when available. Add focused regression coverage for the optimized ops, cache invalidation, and denoising lifecycle.
Shard Wan VAE decode over height with halo exchange, colocate four-GPU decode with the DiT workers, and reuse local latent and shared CPU output buffers. Serialize overlapping DiT/decode collectives, streamline worker queues and thread pools, preserve synchronized phase profiles, and keep the documented four- and six-GPU placements covered by tests.
Record decoded-ready, LiveKit publish, and client metadata timing separately, wait for the controller before pipeline startup, and finish adapter sessions from target completion status. Keep the reproducible TeleFuser and SGLang benchmark launchers, add a direct-output validation path, and document the H100 environment, workload semantics, and compute-versus-delivery metric boundary without embedding comparison results.
Transport tensor outputs between independent worker groups with metadata references while CUDA IPC or shared memory carries the storage directly. Move final device placement into consumer ranks and allow method-scoped tensor transport without routing payloads through the parent process.\n\nDocument the channel lifecycle and cover FIFO, cancellation, CPU sharing, CUDA peer copies, and ParallelWorker bindings.\n\nVerification: focused worker unit tests and the two-GPU tensor-channel integration test passed; ruff and git diff --check passed.
Encode the bounded reference image once per session, distribute its latent directly to every DiT rank, and retain it for rank-local chunk slicing and mask construction. Connect non-colocated DiT and VAE stages through the generic tensor channel so large latents bypass the orchestrator.\n\nKeep scheduler timesteps and immutable RoPE frequency tables resident on worker devices, include condition memory in capacity accounting, and preserve the configured two-session capacity.\n\nVerification: 185 related unit tests and the full 957-frame four-GPU AIPerf runs passed; ruff, format check, and git diff --check passed.
Document the complete 957-frame TeleFuser runs in the cu128 and cu130 environments and compare target-side compute against the retained same-environment SGLang artifact. Keep client stream throughput separate because LiveKit uses realtime pacing while the WebSocket reference uses burst output.\n\nRecord synchronized compute time, first-frame decomposition, transport boundaries, warmup semantics, and artifact identifiers in both English and Chinese benchmark guides.\n\nVerification: both documented TeleFuser sessions completed 60 chunks successfully; git diff --check passed.
Force example regression runs onto TORCH_SDPA and disable Diffusers' optional xformers import path so the test backend is deterministic. Route Wan2.2 VAE and denoising tensors through WorkerTensorChannel, add lifecycle coverage, and document the regression backend. Verified with focused unit and worker tests plus the four previously failing GPU regression cases.
Centralize process-group collectives and submit independent communication before synchronization across sequence-parallel model paths. Harden worker tensor channels with pooled CUDA IPC buffers, rank-local sharding, generation acknowledgements, cancellation cleanup, and resident LingBot condition/latent handoff. Document the communication architecture in English and Chinese, and add focused unit, integration, and SGLang comparison coverage. Verification:\n- ruff check on changed Python files\n- pytest focused communication and LingBot suites (58 passed)\n- mkdocs build --strict\n- LingBot World V2 four-GPU 77-frame benchmark and example
Allow the local CI entry point to reuse an existing environment while explicitly hiding CUDA and binding pytest to the active Python interpreter. Make the RayWorker resource test simulate its CUDA branch so it remains deterministic on GitHub CPU runners. Verification:\n- bash scripts/run_ci_tests.sh --skip-install\n- unit tests: 940 passed, 3 skipped, 95 deselected\n- server tests: 62 passed\n- ruff check, format, and import checks
Publish the validated four-H100 LingBot-World v2 real-time gate in the project and example READMEs. Consolidate the bilingual AIPerf benchmark documentation around the 77-frame compute gate and the current one-minute LiveKit replay, including exact metric boundaries and reproducible commands. Remove stale NEW labels from the LingBot-Video news entries. Verification: AIPerf one-minute stream profile 1/1 succeeded; mkdocs build --strict; git diff --check.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
This PR optimizes TeleFuser's multi-GPU communication and LingBot-World v2 streaming pipeline to support real-time
four-H100 generation.
It introduces direct tensor channels between worker groups, centralizes distributed collectives, adds spatially
sharded VAE decoding, keeps bounded session data resident on GPU, and removes redundant work from the streaming DiT
path. It also improves CPU-only CI coverage and documents the validated four-GPU performance envelope.
Motivation
Large intermediate tensors previously crossed worker and orchestration boundaries through paths that introduced
avoidable synchronization, copies, and CPU involvement. LingBot-World v2 also repeated condition preparation,
device transfers, and cache-related work across chunks.
These costs prevented the four-GPU pipeline from consistently meeting its 16 FPS target. The new communication and
residency design keeps large tensors on their producer/consumer devices, overlaps independent communication where
possible, and reduces per-chunk computation without changing the public pipeline contract.
Type of Change
Changes Made
WorkerTensorChannelfor direct worker-to-worker tensor transfer using pooled CUDA IPC/P2P buffers or sharedCPU storage, including lifecycle, cancellation, acknowledgement, sharding, and fallback handling.
telefuser.distributed, submitting independent communication beforesynchronization and reusing the same primitives across sequence-parallel paths.
orchestrator-mediated latent transfers.
the bounded session lifetime.
Testing
pytest tests/Test commands:
GPU regression coverage also exercised the previously failing example cases. Wan pipeline-parallel behavior is
unchanged and remains outside this PR's scope.
Checklist
ruff)pre-commit run --all-filesexecuted on the final HEADpytest tests/suite executed[TYPE] Brief descriptionRelated Issues
N/A
Additional Notes
The public pipeline and service contracts remain compatible. Optimized tensor transport is method-scoped and retains
fallback behavior where direct CUDA transfer is unavailable.
Target compute and client delivery metrics are intentionally reported separately. LiveKit pacing, encoding, network
delivery, and client rendering are not included in
chunk_compute_fps.GPU Architecture Support
The new kernel and four-GPU paths were validated on H100/SM90. Other architectures have not been validated as part of
this PR.
Performance Impact
Validated on 4 x H100 80 GB, PyTorch 2.11.0+cu128, BF16 DiT, FP32 VAE, FlashAttention-4, with FSDP and
torch.compiledisabled:0.9335 / 0.9409 / 0.9410 / 1.0058 s.1.0932 / 1.1149 s.The average target-side compute rate meets the 16 FPS real-time gate. This does not claim that every individual chunk
finishes within one second or that end-to-end client delivery sustains 16 FPS.