pytorch
626bb3d3 - [iOS GPU][Design] Use function_constants to simply shader kernels (#54518)

Commit
3 years ago
[iOS GPU][Design] Use function_constants to simply shader kernels (#54518) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/54518 When I was reading the Metal Shader Language Specification, I noticed that using `function_constants` in C++ attributes could let us do compile time kernel selection, which can drastically reduce the complexity of writing GPU kernels for different input texture types. We should apply this trick to all our existing shader functions. ghstack-source-id: 124497703 Test Plan: - Metal op tests ``` 2021-03-20 23:35:20.496922-0700 PyTorchPlayground[48215:8455407] [bool test_view()],[1 10 2 2 ],[SUCCEED] 2021-03-20 23:35:20.522714-0700 PyTorchPlayground[48215:8455407] [bool test_view2()],[1 10 2 2 ],[SUCCEED] 2021-03-20 23:35:20.553591-0700 PyTorchPlayground[48215:8455407] [bool test_view3()],[5 8 ],[SUCCEED] 2021-03-20 23:35:20.571194-0700 PyTorchPlayground[48215:8455407] [bool test_view4()],[5 8 ],[SUCCEED] ``` - Sandcastle CI - CircleCI Reviewed By: SS-JIA Differential Revision: D27218965 fbshipit-source-id: 763c54d551de3a88e4ff0007894200d72f00958c
Author
Parents
Loading