diffusers
71a6fd9f - Remove compile bottlenecks from ZImage pipeline (#13461)

Commit
201 days ago
Remove compile bottlenecks from ZImage pipeline (#13461) * [core] Remove DtoH syncs from ZImage pipeline denoising loop * [core] Replace boolean mask indexing with torch.where in ZImage transformer Boolean mask indexing (tensor[mask] = val) implicitly calls nonzero(), which triggers a DtoH sync that stalls the CPU while the GPU queue drains. Replacing it with torch.where eliminates these syncs from the transformer's pad-token assignment. Profiling (4-step turbo, fix_2 vs fix_1): - Eager: nonzero CPU time drops from ~2091 ms to <1 ms; index_put eliminated - Compile: nonzero CPU time drops from ~3057 ms to <1 ms; index_put eliminated --------- Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>
Parents
Loading