SIGN IN SIGN UP

introduce _to_dim_order_copy op to runtime (#1970)

Summary:
Pull Request resolved: https://github.com/pytorch/executorch/pull/1970

This diff creates a new and special operator, `_to_dim_order_copy`. This new operator introduces two critical attributes to runtime system:
1. Extract memory_format information from tensor based on dim_order, instead of stride.
2. Support both channal_last and contiguous memory_format in runtime. Please note that memory format here is a parallel concept with memory layout, and supporting new format does not violate our contract on only supporting contiguous memory layout tensor. Details can be found in [here](https://discuss.pytorch.org/t/contigious-vs-non-contigious-tensor/30107) and [here](https://pytorch.org/blog/tensor-memory-format-matters/).

Furthermore, dim order is a specifial operator, which does not have a native aten variant but is needed by most model in edge dialect, so it can not directly be put in `kernels/portable/custom_ops.yaml` (need manually registered everytime, not work for an operator needed by many models), or `kernels/portable/functions.yaml` (should have native aten variant). To overcome that, this diff puts   `_to_dim_order_copy`'s aten mode under `kernels/aten`, while lean mode under `kernels/portable/functions.yaml`.

Also update dependencies and utils.

Reviewed By: larryliu0820

Differential Revision: D53747744

fbshipit-source-id: 8741e83d696c42acb956522cb29eb41d93b89399
S
Songhao Jia committed
cf407922c4836a18d0186ea8629532c5aac23497
Parent: 834b545
Committed by Facebook GitHub Bot <facebook-github-bot@users.noreply.github.com> on 5/6/2024, 4:28:15 AM