Skip to content

Commit 25d279d

Browse files
committed
[ET-VK] Organize utils
Refactor our `OpUtils.*`, `StagingUtils.*`, and `Utils.*` which have accumulated helper functions during the redesign. We split them and move them into two new folders: 1. `ops/utils`: Used by files in `ops/` and `ops/impl/`. 2. `ops/impl/utils`: Used only by files in `ops/impl/`. In general, this helps to unflatten the `ops/` directory: ``` [jorgep31415devvm15882.vll0 /data/users/jorgep31415/fbsource/xplat/executorch/backends/vulkan/runtime/graph/ops (98b0e789c)]$ tree . ├── ExecuteNode.cpp ├── ExecuteNode.h ├── impl │ ├── Arithmetic.cpp │ ├── Arithmetic.h │ ├── Staging.cpp │ ├── Staging.h │ └── utils │ ├── DimUtils.h │ ├── ScalarUtils.h │ ├── TensorUtils.cpp │ └── TensorUtils.h ├── OperatorRegistry.cpp ├── OperatorRegistry.h ├── PrepackNode.cpp ├── PrepackNode.h └── utils ├── BindingUtils.cpp ├── BindingUtils.h ├── StagingUtils.cpp └── StagingUtils.h 3 directories, 18 files ``` Since we're heavily updating include declarations, we also introduce the convention to only include the VK-API via ``` #include <ATen/native/vulkan/api/api.h> ``` instead of including more specific files, e.g., ``` #include <ATen/native/vulkan/api/Tensor.h> ``` Differential Revision: [D54690346](https://our.internmc.facebook.com/intern/diff/D54690346/) ghstack-source-id: 217990425 Pull Request resolved: #2323
1 parent b79697b commit 25d279d

20 files changed

+126
-105
lines changed

backends/vulkan/runtime/graph/ComputeGraph.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,15 @@
66
* LICENSE file in the root directory of this source tree.
77
*/
88

9-
#include <executorch/backends/vulkan/runtime/graph/ComputeGraph.h>
9+
// @lint-ignore-every CLANGTIDY
10+
// facebook-security-vulnerable-integer-sign-conversion
1011

11-
#include <executorch/backends/vulkan/runtime/graph/ops/StagingUtils.h>
12+
#include <executorch/backends/vulkan/runtime/graph/ComputeGraph.h>
1213

1314
#include <executorch/backends/vulkan/runtime/graph/ops/impl/Staging.h>
1415

16+
#include <executorch/backends/vulkan/runtime/graph/ops/utils/StagingUtils.h>
17+
1518
namespace at {
1619
namespace native {
1720
namespace vulkan {

backends/vulkan/runtime/graph/ComputeGraph.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@
1212

1313
#ifdef USE_VULKAN_API
1414

15-
#include <ATen/native/vulkan/api/Context.h>
16-
#include <ATen/native/vulkan/api/Tensor.h>
17-
#include <ATen/native/vulkan/api/Types.h>
15+
#include <ATen/native/vulkan/api/api.h>
1816

1917
#include <executorch/backends/vulkan/runtime/graph/GraphConfig.h>
2018

backends/vulkan/runtime/graph/GraphConfig.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
#ifdef USE_VULKAN_API
1212

13-
#include <ATen/native/vulkan/api/Context.h>
13+
#include <ATen/native/vulkan/api/api.h>
1414

1515
namespace at {
1616
namespace native {

backends/vulkan/runtime/graph/ops/ExecuteNode.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
#include <executorch/backends/vulkan/runtime/graph/ComputeGraph.h>
1212

13-
#include <executorch/backends/vulkan/runtime/graph/ops/Utils.h>
13+
#include <executorch/backends/vulkan/runtime/graph/ops/utils/BindingUtils.h>
1414

1515
namespace at {
1616
namespace native {

backends/vulkan/runtime/graph/ops/ExecuteNode.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010

1111
#ifdef USE_VULKAN_API
1212

13-
#include <ATen/native/vulkan/api/Context.h>
14-
#include <ATen/native/vulkan/api/Tensor.h>
15-
#include <ATen/native/vulkan/api/Types.h>
13+
#include <ATen/native/vulkan/api/api.h>
1614

1715
#include <executorch/backends/vulkan/runtime/graph/containers/Value.h>
1816

backends/vulkan/runtime/graph/ops/OperatorRegistry.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88

99
#include <executorch/backends/vulkan/runtime/graph/ops/OperatorRegistry.h>
1010

11-
#include <executorch/backends/vulkan/runtime/graph/ops/impl/Arithmetic.h>
12-
1311
namespace at {
1412
namespace native {
1513
namespace vulkan {

backends/vulkan/runtime/graph/ops/PrepackNode.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010

1111
#include <executorch/backends/vulkan/runtime/graph/ComputeGraph.h>
1212

13-
#include <executorch/backends/vulkan/runtime/graph/ops/StagingUtils.h>
14-
#include <executorch/backends/vulkan/runtime/graph/ops/Utils.h>
13+
#include <executorch/backends/vulkan/runtime/graph/ops/utils/BindingUtils.h>
14+
#include <executorch/backends/vulkan/runtime/graph/ops/utils/StagingUtils.h>
1515

1616
namespace at {
1717
namespace native {

backends/vulkan/runtime/graph/ops/PrepackNode.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010

1111
#ifdef USE_VULKAN_API
1212

13-
#include <ATen/native/vulkan/api/Context.h>
14-
#include <ATen/native/vulkan/api/Tensor.h>
15-
#include <ATen/native/vulkan/api/Types.h>
13+
#include <ATen/native/vulkan/api/api.h>
1614

1715
#include <executorch/backends/vulkan/runtime/graph/containers/Value.h>
1816

backends/vulkan/runtime/graph/ops/impl/Arithmetic.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@
88

99
#include <executorch/backends/vulkan/runtime/graph/ops/impl/Arithmetic.h>
1010

11-
#include <executorch/backends/vulkan/runtime/graph/ops/OpUtils.h>
1211
#include <executorch/backends/vulkan/runtime/graph/ops/OperatorRegistry.h>
1312

1413
#include <executorch/backends/vulkan/runtime/graph/ops/impl/Staging.h>
1514

15+
#include <executorch/backends/vulkan/runtime/graph/ops/impl/utils/ScalarUtils.h>
16+
#include <executorch/backends/vulkan/runtime/graph/ops/impl/utils/TensorUtils.h>
17+
1618
namespace at {
1719
namespace native {
1820
namespace vulkan {

backends/vulkan/runtime/graph/ops/impl/Arithmetic.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212

1313
#include <executorch/backends/vulkan/runtime/graph/ComputeGraph.h>
1414

15-
#include <executorch/backends/vulkan/runtime/graph/ops/Utils.h>
16-
1715
namespace at {
1816
namespace native {
1917
namespace vulkan {

0 commit comments

Comments
 (0)