mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-05-24 16:07:30 +08:00
Note _calc_cond_batch and _calc_cond_batch_multigpu must stay in sync
Per review feedback on #7063. The two functions share the conds-by-hooks accumulation, memory-fit batching, and per-chunk output aggregation; the multigpu variant adds per-device scheduling, .to(device) placement, per-device patcher/control lookup, and thread-pool dispatch around the inner loop. Documenting the relationship without extracting helpers -- extraction can land after the initial worksplit-multigpu release once both paths have settled. Amp-Thread-ID: https://ampcode.com/threads/T-019e4a00-fe3d-76bd-a2f2-a8c8c4040082 Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
parent
1417b711ce
commit
822a3ecf73
@ -218,6 +218,9 @@ def _calc_cond_batch_outer(model: BaseModel, conds: list[list[dict]], x_in: torc
|
|||||||
return executor.execute(model, conds, x_in, timestep, model_options)
|
return executor.execute(model, conds, x_in, timestep, model_options)
|
||||||
|
|
||||||
def _calc_cond_batch(model: BaseModel, conds: list[list[dict]], x_in: torch.Tensor, timestep: torch.Tensor, model_options: dict[str]):
|
def _calc_cond_batch(model: BaseModel, conds: list[list[dict]], x_in: torch.Tensor, timestep: torch.Tensor, model_options: dict[str]):
|
||||||
|
# NOTE: keep in sync with _calc_cond_batch_multigpu below. Shared logic
|
||||||
|
# (hooked_to_run accumulation, memory-fit batching, per-chunk output
|
||||||
|
# aggregation) is duplicated there with per-device scheduling layered on top.
|
||||||
if 'multigpu_clones' in model_options:
|
if 'multigpu_clones' in model_options:
|
||||||
return _calc_cond_batch_multigpu(model, conds, x_in, timestep, model_options)
|
return _calc_cond_batch_multigpu(model, conds, x_in, timestep, model_options)
|
||||||
out_conds = []
|
out_conds = []
|
||||||
@ -353,6 +356,10 @@ def _calc_cond_batch(model: BaseModel, conds: list[list[dict]], x_in: torch.Tens
|
|||||||
return out_conds
|
return out_conds
|
||||||
|
|
||||||
def _calc_cond_batch_multigpu(model: BaseModel, conds: list[list[dict]], x_in: torch.Tensor, timestep: torch.Tensor, model_options: dict[str]):
|
def _calc_cond_batch_multigpu(model: BaseModel, conds: list[list[dict]], x_in: torch.Tensor, timestep: torch.Tensor, model_options: dict[str]):
|
||||||
|
# NOTE: keep in sync with _calc_cond_batch above. Same conds-by-hooks
|
||||||
|
# accumulation, memory-fit batching, and output aggregation, but adds a
|
||||||
|
# per-device scheduler, per-device patcher/control lookup, tensor .to(device)
|
||||||
|
# placement, and MultiGPUThreadPool dispatch around the inner loop.
|
||||||
out_conds = []
|
out_conds = []
|
||||||
out_counts = []
|
out_counts = []
|
||||||
# separate conds by matching hooks
|
# separate conds by matching hooks
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user