Skip to content

Commit 5f8aa6d

Browse files
larryliu0820facebook-github-bot
authored andcommitted
Let custom ops registration code only include ATen headers
Summary: X-link: pytorch/pytorch#107064 Basically we generate `CustomOpsNativeFunctions.h` for registering custom ops into PyTorch JIT runtime. This header needs to hookup with the C++ kernel implementation of all the custom ops. For this reason it should include ATen headers instead of Executorch headers. This PR changes it. Reviewed By: kirklandsign Differential Revision: D48282828 fbshipit-source-id: cf4ed96a7fb899b85a71d7efbc3fcd6c5a38632d
1 parent 9bc3662 commit 5f8aa6d

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

codegen/templates/NativeFunctions.h

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

1212
#include <tuple>
1313

14-
#include <executorch/runtime/core/exec_aten/exec_aten.h> // at::Tensor etc.
15-
#include <executorch/codegen/macros.h> // TORCH_API
16-
#include <executorch/runtime/kernel/kernel_runtime_context.h>
14+
${headers}
1715

1816
// ${generated_comment}
1917

shim/xplat/executorch/codegen/codegen.bzl

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -258,13 +258,7 @@ def exir_custom_ops_aot_lib(
258258
# @lint-ignore BUCKLINT link_whole
259259
link_whole = True,
260260
visibility = visibility,
261-
deps = [
262-
"//executorch/runtime/core/exec_aten:lib_aten",
263-
"//executorch/codegen:macros",
264-
] + kernels + deps,
265-
exported_deps = [
266-
"//executorch/runtime/kernel:kernel_runtime_context_aten",
267-
],
261+
deps = kernels + deps,
268262
external_deps = ["libtorch"],
269263
define_static_target = define_static_target,
270264
# Relax visibility restrictions since deps may include targets

0 commit comments

Comments
 (0)