Skip to content

Commit dbbe9cb

Browse files
ssjiaSS-JIA
authored andcommitted
[ET-VK] Make libtorch optional in custom op test binaries
Add `include_torch` parameter (default False) to `define_custom_op_test_binary()`. None of the custom op test binaries directly include torch/ATen/c10 headers, so libtorch was unnecessary baggage. Dropping it reduces the q4gsw_linear_adreno binary from ~1 GB to 74 MB. Differential Revision: [D104456804](https://our.internmc.facebook.com/intern/diff/D104456804/) ghstack-source-id: 379498992 Pull Request resolved: #19402
1 parent 93b764e commit dbbe9cb

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

backends/vulkan/test/custom_ops/targets.bzl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@ load(
66
"vulkan_spv_shader_lib",
77
)
88

9-
def define_custom_op_test_binary(custom_op_name, extra_deps = [], src_file = None):
9+
def define_custom_op_test_binary(custom_op_name, extra_deps = [], src_file = None, include_torch = False):
1010
deps_list = [
1111
":prototyping_utils",
1212
":operator_implementations",
1313
":custom_ops_shaderlib",
1414
"//executorch/backends/vulkan:vulkan_graph_runtime",
15-
runtime.external_dep_location("libtorch"),
16-
] + extra_deps
15+
] + ([runtime.external_dep_location("libtorch")] if include_torch else []) + extra_deps
1716

1817
src_file_str = src_file if src_file else "{}.cpp".format(custom_op_name)
1918

0 commit comments

Comments
 (0)