Fix Hunyuan 3D 2.1 multi-GPU worksplit: use cond_or_uncond instead of hardcoded chunk(2)#13478
Merged
Kosinkadink merged 1 commit intoworksplit-multigpufrom Apr 20, 2026
Merged
Conversation
… hardcoded chunk(2) Amp-Thread-ID: https://ampcode.com/threads/T-019da964-2cc8-77f9-9aae-23f65da233db Co-authored-by: Amp <amp@ampcode.com>
3e7c01f to
4b8fa98
Compare
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.
Problem
Hunyuan 3D 2.1 throws
ValueError: not enough values to unpack (expected 2, got 1)when using multi-GPU worksplit (MultiGPU CFG Splitnode).The model's
forward()method hardcodescontext.chunk(2, dim=0)assuming both cond and uncond are always batched together. In multi-GPU worksplit mode, a device may only receive one of them, sochunk(2)on a batch of 1 returns only 1 chunk.Fix
Use
transformer_options["cond_or_uncond"]to detect whether both cond and uncond are present in the batch. Only perform the half-swap when both are present (len == 2andset == {0, 1}). When only one is present, skip the reordering entirely (identity operation).Changes
comfy/ldm/hunyuan3dv2_1/hunyuandit.py: Replace hardcodedchunk(2)with conditional swap gated oncond_or_uncondPerformance (dual RTX 4090)
Sampling-only speed (isolating the accelerated portion)
End-to-end wall time (includes non-accelerated VAE decode + mesh generation)
Sampling-only speedup is near-theoretical 2x for CFG split across 2 GPUs. Overall speedup is lower because VAE decode and mesh generation are not accelerated by worksplit.
Benchmarks: 2 warmup runs + 5 timed runs, batch_size=1, 30 steps, euler sampler.