perf: keep raw dit image tensors on cpu until vae preprocess. - #2261
Open
chuanhaoyu wants to merge 1 commit into
Open
perf: keep raw dit image tensors on cpu until vae preprocess.#2261chuanhaoyu wants to merge 1 commit into
chuanhaoyu wants to merge 1 commit into
Conversation
chuanhaoyu
requested review from
DongheJin,
DragonFive,
JimHsiung,
Kang-Meng,
liujinguang0125,
liutongxuan,
ustcfy,
xiao-yu-chen,
yingxudeng,
yinjiawei01 and
zhang-minchao
as code owners
August 18, 2026 11:04
chuanhaoyu
force-pushed
the
feature/dit-keep-raw-images-cpu
branch
from
August 18, 2026 11:07
c6097f3 to
892ab4e
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.
Description
Keep raw DiT uint8 image tensors on CPU in
DiTForwardInput::to(), and only move compute tensors to NPU.VAEImageProcessor::resize()still uses a CPU Lanczos kernel, so movingimages/images_list/mask_images/control_image/last_imagesto NPU early caused an extra NPU->CPU->NPU round-trip. This change avoids that copy for large and multi-image inputs such as Qwen Image Edit Plus.Prompt embeddings, latents,
masked_image_latents, andprompt_audiostill follow the original.to(device)behavior.Related Issues
N/A
Change Type
Pull Request Checklist
Thank you for contributing to xLLM. Before requesting review, please make sure the following items are complete.
PR Title and Commit Messages
<type>: <subject>.Pre-commit Checks
pre-commitby runningpip install pre-commitor an equivalent command.pre-commit install.pre-commit run --all-filesand fixed any reported issues.Self Review
.agents/skills/code-review/references/custom-code-style.md, especially code written or assisted by AI.mainbranch.Build and Test Coverage
python setup.py build testhas passed on a CUDA machine.python setup.py build testhas passed on an NPU machine.python setup.py build testhas passed on an MLU machine.Reviewer Notes
This PR only changes
xllm/core/runtime/dit_forward_params.h.Validated on NPU with Qwen Image Edit Plus:
images_liststays on CPU before VAE preprocesscondition_img/vae_imgstill land on NPU after preprocessNPU Lanczos resize is out of scope. Flux Fill / Flux Control / Wan I2V share the same raw-image fields, but dedicated end-to-end smoke was not run because those model services were not available in this environment.