[Vulkan] Implement packed contexts (#82730)
Summary:
High level description of this diff:
- VulkanOpContext is eliminated
- LinearPackedContext, Conv2dPackedContext, GruPackedContext & LstmPackedContext are introduced.
- They are child classes of the virtual class VulkanPackedContext.
- Their purpose is to pack and unpack the context for each of those ops. They unpack the context on serialization, and pack it on deserialization.
- They are different than the old op specific context (LinearOpContext, Conv2dOpContext, etc) in two important ways: they only store the packed data and they do not contain the logic for running the op. (In this diff, the unpacked functions for LinearPackedContext and Conv2dPackedContext haven't been implemented yet, so, we are cheating by including a private unpacked_ list inside each; but in a future diff, unpack functionality will be implemented for those two classes, and that private list removed).
- The old LinearOpContext, GruOpContext & LstmOpContext are completely eliminated. Conv2dOpContext is maintained for backwards compatibility, but it is just a wrapper around Conv2dPackedContext
- A lot of code from Convolution.cpp was repeated in the files TransposeConvolution2d.cpp and QuantizedConvolution.cpp. Therefore the logic was combined, introducing transposed and quantized flags where appropriate and everything was moved to Convolution.cpp & Convolution.h
- The top level convolution functions defined in Register.cpp are moved to Convolution.cpp
Test Plan:
Run vulkan_api_test
- On Mac:
```
buck run //xplat/caffe2:pt_vulkan_api_test_binAppleMac
```
- On Android:
```
buck build -c ndk.custom_libcxx=false -c pt.enable_qpl=0 //xplat/caffe2:pt_vulkan_api_test_binAndroid\#android-arm64 --show-output
adb push buck-out/gen/xplat/caffe2/pt_vulkan_api_test_binAndroid\#android-arm64 /data/local/tmp/vulkan_api_test
adb shell "/data/local/tmp/vulkan_api_test"
```
Run vulkan_quantized_api_test
- On Mac:
```
buck run //xplat/caffe2:pt_vulkan_quantized_api_test_binAppleMac
```
- On Android:
```
buck build -c ndk.custom_libcxx=false -c pt.enable_qpl=0 //xplat/caffe2:pt_vulkan_quantized_api_test_binAndroid\#android-arm64 --show-output
adb push buck-out/gen/xplat/caffe2/pt_vulkan_quantized_api_test_binAndroid\#android-arm64 /data/local/tmp/vulkan_quantized_api_test
adb shell "/data/local/tmp/vulkan_quantized_api_test"
```
Reviewed By: SS-JIA
Differential Revision: D38363981
Pull Request resolved: https://github.com/pytorch/pytorch/pull/82730
Approved by: https://github.com/SS-JIA