Repository navigation
Remove clones that only request a memory format - #24453
zonglinpeng wants to merge 1 commit into
Conversation
Summary: `rlx_arbitrary_image_stylization` fails in the ExecuTorch emitter: `InternalError: Tensor has a memory_format that is unsupported in ExecuTorch: torch.channels_last` (`exir/tensor.py` `memory_format_enum` raises `KeyError: torch.channels_last`). Its export carries `clone(memory_format=torch.channels_last)` on ops that stay on the CPU. Cadence lowers with `_skip_dim_order=True`, and so does Helios, which runs Cadence's remove passes. Every edge tensor is therefore contiguous and a memory format has no runtime representation. The emitter accepts only contiguous and preserve. The upstream `RemoveCloneOpsTransform` deliberately keeps clones that change memory format, because with dim order they carry a real layout, and Cadence's wrapper `RemoveCloneOpsTransformImported` ran it unchanged. Nothing removed the clone. The wrapper becomes one pass, renamed `RemoveCloneOpsPass`: a `RemoveCloneOpsTransform` subclass that also treats an `aten.clone` with any memory format as a plain copy, so the clone is removed. `_clone_dim_order` keeps the upstream behavior. Dead-code elimination still runs afterwards, as it did in the wrapper. The upstream transform is unchanged. The rename touches every caller in fbcode and xplat: Cadence passes, Helios sharding transforms, Jarvis, the SAS compiler and the xr_sonic gleam export. This replaces the Helios-only `StripCloneMemoryFormat` pass from the earlier version of this diff. Differential Revision: D125145150
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/24453
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 New Failure, 3 PendingAs of commit e34b34c with merge base 822cb60 ( NEW FAILURE - The following job has failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
@zonglinpeng has exported this pull request. If you are a Meta employee, you can view the originating Diff in D125145150. |
This PR needs a
|
Summary:
rlx_arbitrary_image_stylizationfails in the ExecuTorch emitter:InternalError: Tensor has a memory_format that is unsupported in ExecuTorch: torch.channels_last(exir/tensor.pymemory_format_enumraisesKeyError: torch.channels_last). Its export carriesclone(memory_format=torch.channels_last)on ops that stay on the CPU.Cadence lowers with
_skip_dim_order=True, and so does Helios, which runs Cadence's remove passes. Every edge tensor is therefore contiguous and a memory format has no runtime representation. The emitter accepts only contiguous and preserve. The upstreamRemoveCloneOpsTransformdeliberately keeps clones that change memory format, because with dim order they carry a real layout, and Cadence's wrapperRemoveCloneOpsTransformImportedran it unchanged. Nothing removed the clone.The wrapper becomes one pass, renamed
RemoveCloneOpsPass: aRemoveCloneOpsTransformsubclass that also treats anaten.clonewith any memory format as a plain copy, so the clone is removed._clone_dim_orderkeeps the upstream behavior. Dead-code elimination still runs afterwards, as it did in the wrapper. The upstream transform is unchanged.The rename touches every caller in fbcode and xplat: Cadence passes, Helios sharding transforms, Jarvis, the SAS compiler and the xr_sonic gleam export. This replaces the Helios-only
StripCloneMemoryFormatpass from the earlier version of this diff.Differential Revision: D125145150