mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
[ET][CodeGen] Remove TORCH_API from NativeFunctions.h declarations (#134245)
Summary: Remove TORCH_API from the generated executorch/kernels/portable/NativeFunctions.h declarations These generated declarations are using ET tensors. They don't need to have the TORCH_API macro prefixed to them, since in this case TORCH_API is just empty. See [codegen/macros.h](https://www.internalfb.com/code/fbsource/[d12d7d3accfb12932368e0216124f2d735c51d73]/fbcode/executorch/codegen/macros.h) Test Plan: CI Differential Revision: D61490943 Pull Request resolved: https://github.com/pytorch/pytorch/pull/134245 Approved by: https://github.com/larryliu0820
This commit is contained in:
committed by
PyTorch MergeBot
parent
b07d0a22f5
commit
cae817c862
@ -337,12 +337,11 @@ def compute_native_function_declaration(
|
||||
metadata_list = kernel_index.get_kernels(g).values()
|
||||
if metadata_list is None:
|
||||
return []
|
||||
prefix = "TORCH_API"
|
||||
|
||||
# for kernels in lean mode, we declare two versions, one with context and one without.
|
||||
# In the end we will cleanup the unused one.
|
||||
def gen_decl(metadata: BackendMetadata, include_context: bool) -> str:
|
||||
return f"{prefix} {sig.decl(name=metadata.kernel, include_context=include_context)};"
|
||||
return f"{sig.decl(name=metadata.kernel, include_context=include_context)};"
|
||||
|
||||
return [
|
||||
gen_decl(metadata, include_context)
|
||||
@ -499,11 +498,11 @@ def gen_headers(
|
||||
headers = {
|
||||
"headers": [
|
||||
"#include <executorch/runtime/core/exec_aten/exec_aten.h> // at::Tensor etc.",
|
||||
"#include <executorch/codegen/macros.h> // TORCH_API",
|
||||
"#include <executorch/runtime/kernel/kernel_runtime_context.h>",
|
||||
],
|
||||
}
|
||||
if use_aten_lib:
|
||||
headers["headers"].append("#include <executorch/codegen/macros.h> // TORCH_API")
|
||||
cpu_fm.write(
|
||||
"NativeFunctions.h",
|
||||
lambda: dict(
|
||||
|
Reference in New Issue
Block a user