diff --git a/backends/webgpu/runtime/ops/view_copy/ViewCopy.cpp b/backends/webgpu/runtime/ops/view_copy/ViewCopy.cpp index 82bc43d14cf..5dc169917c7 100644 --- a/backends/webgpu/runtime/ops/view_copy/ViewCopy.cpp +++ b/backends/webgpu/runtime/ops/view_copy/ViewCopy.cpp @@ -156,10 +156,17 @@ void view_copy_impl(WebGPUGraph& graph, const std::vector& args) { add_flat_copy(graph, args.at(0), args.at(args.size() - 1)); } +// clone = flat copy; survives Vulkan RemoveRedundantOpsTransform in Llama 1B. +void clone_impl(WebGPUGraph& graph, const std::vector& args) { + // args: [self, memory_format?, out]; out = last value-id. + add_flat_copy(graph, args.at(0), args.at(args.size() - 1)); +} + } // namespace WEBGPU_REGISTER_OPERATORS { WEBGPU_REGISTER_OP(aten.view_copy.default, view_copy_impl); + WEBGPU_REGISTER_OP(aten.clone.default, clone_impl); } } // namespace executorch::backends::webgpu