Skip to content

Feat. MindIE-SD compilation support.#759

Open
zhangtao0408 wants to merge 2 commits intovipshop:mainfrom
zhangtao-npu:mindiesd_compile
Open

Feat. MindIE-SD compilation support.#759
zhangtao0408 wants to merge 2 commits intovipshop:mainfrom
zhangtao-npu:mindiesd_compile

Conversation

@zhangtao0408
Copy link
Contributor

@zhangtao0408 zhangtao0408 commented Jan 27, 2026

Test Env

device Ascend910B3
torch 2.8.0
torch-npu 2.8.0
CANN 8.3.RC2
Device 910B3x1

Test Codes

  1. Prepare Env
git clone --branch master --single-branch https://gitcode.com/Ascend/MindIE-SD.git
cd ./MindIE-SD
pip install wheel && python3 setup.py bdist_wheel
pip install ./dist/*.whl --force-reinstall --no-deps
  1. Run test
FLUX_PATH=/PATH/TO/FLUX.1-dev

# Non-Compilation
python3 -m cache_dit.generate flux --model-path $FLUX_PATH

# Compilation
python3 -m cache_dit.generate flux --model-path $FLUX_PATH --compile

Results

1. Performance

Model Batch Size Resolution Compile E2E Time(s)
flux.1-dev 1 1024x1024 14.09
flux.1-dev 1 1024x1024 12.85

2. Output

2.1. No Compile

flux 1024x1024 C0_Q0_NONE

2.2. Compiled

flux 1024x1024 C1_Q0_NONE

@DefTruth
Copy link
Member

@zhangtao0408 Hi~ thanks for working on this! Could please also share the results of distributed inference? w/ or w/o MindIE-SD Compilation. For example:

torchrun --nproc_per_node=4 -m cache_dit.generate flux --parallel ulysses
torchrun --nproc_per_node=4 -m cache_dit.generate flux --parallel ulysses --compile

return _backend


def maybe_wrap_torch_compile():
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename to _maybe_xxx since we don't want users use this help func directly.


_original_torch_compile = torch.compile

# MindIESD Backend Available
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should check the platform before patching. The patching should only be applied while the platform is NPU, otherwise, skip this patch.

Suggested change
# MindIESD Backend Available
# MindIESD Backend Available
if current_platform.device_type != "npu":
return # DO NOTHING

@DefTruth DefTruth mentioned this pull request Jan 28, 2026
8 tasks
@DefTruth DefTruth mentioned this pull request Mar 11, 2026
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants