How komikndr/raylight works
Raylight is a ComfyUI extension for multi-GPU diffusion sampling: workflow nodes configure parallelism and launch Ray workers, which run distributed sampling and return results. The main stages are node registration and orchestration, worker/topology setup, model loading and patching, distributed diffusion/attention, and output decoding. README-documented capabilities include USP, CFG, FSDP, LoRA, quantized loading, ControlNet, and distributed VAE decoding. Several relationships below are evidenced by the source index or README; unsampled implementation details are not inferred.
Main entry points: ray_worker.py Ray worker · nodes.py Workflow nodes · sd.py Distributed model loading · usp.py Unified sequence parallelism
Components 21
ComfyUI workflow
- Extension registration
__init__.py - Workflow nodes
src/raylight/nodes.py - Custom sampler
src/raylight/comfy_extra_dist/nodes_custom_sampler.py
Ray orchestration
- Ray worker
src/raylight/distributed_worker/ray_worker.py - Worker configuration
src/raylight/distributed_worker/raylightworker_config_schema.py - Parallel group setup
src/raylight/distributed_worker/parallel_group_manager.py
Model preparation
- Distributed model loading
src/raylight/comfy_dist/sd.py - Model patching
src/raylight/comfy_dist/model_patcher.py - LoRA support
src/raylight/comfy_dist/lora.py - Quantized model support
src/raylight/comfy_dist/quant_ops.py - GGUF integration
src/raylight/expansion/comfyui_gguf/nodes.py
Distributed sampling
- Unified sequence parallelism
src/raylight/distributed_modules/usp.py - CFG parallelism
src/raylight/distributed_modules/cfg.py - Distributed attention
src/raylight/distributed_modules/attention.py - Wan sequence implementation
src/raylight/diffusion_models/wan/xdit_context_parallel.py - OmniGen sequence implementation
src/raylight/diffusion_models/omnigen/xdit_context_parallel.py - Distributed ControlNet
src/raylight/distributed_worker/ray_worker_controlnet.py
Decode and progress
- Distributed VAE decode
src/raylight/distributed_worker/ray_worker_vae.py - Decode progress
src/raylight/decode_progress.py - Sampler progress
src/raylight/progress.py
Other components
- ComfyUI
Connections 26
- ComfyUI → Extension registration: loads extension
- Extension registration → Workflow nodes: imports mappings
__init__.py - ComfyUI → Workflow nodes: runs nodes
- Workflow nodes → Ray worker: launches workers
src/raylight/nodes.py - Workflow nodes → Worker configuration: configures workers
src/raylight/nodes.py - Workflow nodes → Sampler progress: uses progress
src/raylight/nodes.py - Workflow nodes → Decode progress: uses decode status
src/raylight/nodes.py - Custom sampler → Workflow nodes: patches sampler
src/raylight/comfy_extra_dist/nodes_custom_sampler.py - Ray worker → Worker configuration: reads config
src/raylight/distributed_worker/ray_worker.py - Ray worker → Parallel group setup: initializes topology
src/raylight/distributed_worker/ray_worker.py - Parallel group setup → Worker configuration: derives parallel config
src/raylight/distributed_worker/parallel_group_manager.py - Ray worker → Unified sequence parallelism: patches USP
src/raylight/distributed_worker/ray_worker.py - Ray worker → CFG parallelism: patches CFG
src/raylight/distributed_worker/ray_worker.py - Ray worker → Distributed ControlNet: dispatches control
src/raylight/distributed_worker/ray_worker.py - Ray worker → Distributed VAE decode: dispatches decode
src/raylight/distributed_worker/ray_worker.py - Ray worker → Sampler progress: reports progress
src/raylight/distributed_worker/ray_worker.py - Distributed VAE decode → Decode progress: updates status
src/raylight/distributed_worker/ray_worker_vae.py - Unified sequence parallelism → Wan sequence implementation: uses model handler
src/raylight/distributed_modules/usp.py - Unified sequence parallelism → OmniGen sequence implementation: uses model handler
src/raylight/distributed_modules/usp.py - Wan sequence implementation → Distributed attention: uses attention
src/raylight/diffusion_models/wan/xdit_context_parallel.py - OmniGen sequence implementation → Distributed attention: uses attention
src/raylight/diffusion_models/omnigen/xdit_context_parallel.py - Workflow nodes → Distributed model loading: loads model
src/raylight/nodes.py - Distributed model loading → Model patching: uses patcher
src/raylight/comfy_dist/sd.py - Workflow nodes → LoRA support: loads LoRA
- Ray worker → Quantized model support: uses quant operations
src/raylight/distributed_worker/ray_worker.py - Distributed model loading → GGUF integration: supports GGUF loading
src/raylight/comfy_dist/sd.py