Skip to content

Fix MPS tensor contiguity issue in tiled_scale_multidim for arbitrary image sizes #8352

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Lightje
Copy link

@Lightje Lightje commented May 31, 2025

Fixes RuntimeError: view size is not compatible with input tensor's size and stride when using ImageUpscaleWithModel on macOS with MPS backend, which required 512x512 images.

Changes Made:
Added samples = samples.contiguous() at the start.
Added tile = (min(tile[0], samples.shape[2]), min(tile[1], samples.shape[3])) for dynamic tile sizing.
Modified output[b:b+1] = function(s.contiguous()).to(output_device) in the single-tile case.
Modified ps = function(s_in.contiguous()).to(output_device) in the tiled loop.
@Lightje Lightje requested a review from comfyanonymous as a code owner May 31, 2025 00:57
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.

1 participant