SIGN IN SIGN UP

Clean up api::vTensor class (#3149)

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

## Context

Now that we have forked the `api/` directory from PyTorch Vulkan, we can clean up the `vTensor` class and remove functionality that is not necessary for the ExecuTorch Vulkan delegate.

The following changes are made:

* Remove unused member variables and member functions from `vTensor` and `vTensorStorage`
* Remove all quantization related member variables, member functions, and the `vTensor` constructor for quantized tensors. The Quantization API will be reworked from the ground up.
* Rename `view_` (which is an instance of `vTensorStorage`) to `storage_`

Finally, the critical change that is introduced is that we now store `storage_` as a direct `vTensorStorage` member variable in `vTensor` instead of storing it as a `std::shared_ptr<vTensorStorage>`.

For context, the reason `storage_` was stored as a shared pointer is to be compliant with ATen Tensors, which needs to enable copy construction to enable the following:

```
at::Tensor b = at::rand(...);
// Oftentimes this will create a "view" of the tensor. a and b will point the the same underlying storage, but with different metadata.
at::Tensor a = b;
```

However, in the ExecuTorch delegate this is no longer necessary. Each Tensor is associated with it's own independent storage and is responsible for managing it's own memory. **By getting rid of `std::shared_ptr`, we can avoid a heap allocation and avoid chasing pointers whenever we need to access the resources of a `vTensor`.**

ghstack-source-id: 223225901
exported-using-ghexport

Reviewed By: jorgep31415

Differential Revision: D55811279

fbshipit-source-id: 95c0ecc9658ef9bc64ecee9e5c9e272da12786b8
S
Stephen Jia committed
bf5093a261513ad58be41261ff93de558e5e237b
Parent: 825db6c
Committed by Facebook GitHub Bot <facebook-github-bot@users.noreply.github.com> on 4/19/2024, 7:37:39 PM