Torch Compile Model (Ray)
Free speed, if you can stand the warmup
- ray_actors
- ray_actors
Torch Compile Model (Ray) is the one node in this pack that has nothing to do with splitting work across GPUs. It's a performance knob for the model that's already loaded in your Ray workers. You run a multi-GPU setup because one card isn't enough, and then you remember you left the free 10-30% on the table because the model is running eagerly instead of compiled. This node fixes that.
Raylight is Komikndr's multi-GPU pack for ComfyUI - Ray workers, USP sequence parallelism, FSDP weight sharding. This little utility sits under Raylight/extra and wraps the model held by your RAY_ACTORS chain in torch.compile, inside every worker.
How it works
The node takes two inputs: ray_actors (the model chain, same as every guidance/utility node in the pack) and backend, which is a choice between inductor and cudagraphs. It clones the model and registers a torch.compile wrapper with a guard filter that skips anything carrying transformer_options - that's the pack's way of dodging the dynamic-shape recompilations that make torch.compile miserable in ComfyUI.
Honest take: this is an experimental knob, and it behaves like one. The first run after you enable it spends a long time compiling - that's the warmup, not a hang. You only get paid back if you run the same resolution, frame count, and step setup repeatedly. Generate once and change everything between runs? You'll eat the compile cost over and over. It's a batch-and-iterate tool, not a set-and-forget.
The inputs
- ray_actors - in, then out. Wire from your Load Diffusion Model (Ray) or any patch chain, then into your sampler.
- backend -
inductoris the general default;cudagraphscan squeeze more out on Nvidia but is pickier about dynamic shapes and can outright fail on some models. If you get a compile error withcudagraphs, switch toinductorbefore you blame the pack.
Install
Same as the rest of the pack:
cd ComfyUI/custom_nodes
git clone https://github.com/komikndr/raylight
cd raylight
<your_python> -m pip install -r requirements.txt
or just search raylight in ComfyUI Manager and install from there. No extra dependencies beyond the pack's usual ray and xfuser - torch.compile is part of PyTorch itself.
Common issues
The two things people actually hit: the long first-run stall (that's compilation - let it finish), and nothing happening at all, which means the node isn't in the chain. It must sit between the loader and the sampler in execution order, same as any Ray patch node. If you're on FSDP, also be aware compiled + sharded is the frontier where the pack is least battle-tested - if you see odd errors, the quickest test is to bypass this node entirely and see if the workflow runs clean without it.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| ray_actors | RAY_ACTORS | — | |
| backend | COMBO | 2 options: inductor, cudagraphs |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| ray_actors | RAY_ACTORS | — |