Repository navigation
Fix solid green Refine Details output on Apple Silicon (blocking upload of tile blend weights) - #200
Open
Cemalettin Serit (cemserit) wants to merge 1 commit into
Conversation
ltx-core 1.6.0 uploads tile blend weights in modality_tiling._device_weights with non_blocking=True on every backend. MPS does not order the consumer after such a copy (ltx_core.devices.allow_async_transfer), so VideoModalityTilingHelper.blend multiplies the tile prediction by weights that have not landed. Every IC-LoRA job that tiles the transformer then ends as "succeeded" with an all-zero (solid green) video. Add a services.patches module that keeps upstream's upload where allow_async_transfer permits it (CUDA) and uses a blocking copy elsewhere. Fixes Lightricks#199 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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.
Fixes #199.
Problem
On Apple Silicon, LTX Desktop 1.3.2 finishes every Refine Details job as
succeededand writes a solid green video (all frames zero in Y, U and V). Details, reproduction and measurements are in #199.Cause
ltx-core 1.6.0 added
_device_weightsinltx_core/modality_tiling.py. It uploads a tile's blend weights withnon_blocking=Trueon every backend.ltx_core.devices.allow_async_transferstates that only CUDA orders a non-blocking transfer against the kernel that consumes it, andupload_from_hostfollows that rule, but_device_weightsdoes not. On MPSVideoModalityTilingHelper.blendthen multiplies the tile prediction by weights that have not landed.Change
A new module in
backend/services/patches/, following the existing pattern (mps_transfer_syncand others):mps_tiling_weights_sync.pyreplacesmodality_tiling._device_weights. Whereallow_async_transfer(like.device)is true (CUDA) it calls upstream's function unchanged. Elsewhere it builds the weights once per plan and uploads them with a blocking.to.ltx2_server.pynext tomps_transfer_sync, with its "Remove once ..." note.The root fix belongs in ltx-core and is one line in
_device_weights:Verification
On a MacBook Pro M5 Pro, 48 GB, macOS 26.5.1, with the Python environment bundled in the 1.3.2 app (ltx-core 1.6.0, torch 2.11.0), calling
LTXIcLoraPipelinewith the app's start-up patches and catalog settings for refine-details:denoisedat step 1 in -3.0e28 .. 3.8e28, non-finite from step 2, outputYAVG=0 UAVG=0 VAVG=0YAVG=122 UAVG=110 VAVG=145, correct pictureThe same replacement (blocking copy in
_device_weights, nothing else changed) also refined seven clips of 49 to 113 frames to 1080p correctly, including two-window runs.Tests
backend/tests/test_mps_tiling_weights_sync.py, one bug per test:test_patch_replaces_modality_tiling_device_weights: the patch is imported but not installed.test_mps_upload_is_never_non_blocking: the MPS upload goes back tonon_blocking=True(fails against upstream's function, checked).test_mps_weights_are_built_and_uploaded_once_per_plan: the patch loses upstream's once-per-plan cache.test_cuda_keeps_the_upstream_upload: the patch changes the CUDA path.Your guide asks for the test list to be agreed before tests are written. As an outside contributor I could not do that first, so the list is above; I am happy to cut or change any of them.
CI
CI on this pull request waits for a maintainer's approval, so I ran the same workflow on the same commit (
13495a2) inside my fork: https://github.com/cemserit/LTX-Desktop/actions/runs/43383238059ci_os): passed🤖 Generated with Claude Code