Include _native.h for structured_native_functions (#131208)

In gen.py, the code for generating CompositeViewCopyKernels.cpp includes *_native.h headers for "view_groups" but not "structured_native_functions". However, this results in the TORCH_API in the headers being ineffective and presents such functions being used outside libtorch_cpu.so

This patch ensures that gen.py includes the native headers for "structured_native_functions" in the same way as for "view_groups".

Pull Request resolved: https://github.com/pytorch/pytorch/pull/131208
Approved by: https://github.com/bdhirsh
This commit is contained in:
Nick Westlake 2024-07-24 02:55:33 +00:00 committed by PyTorch MergeBot
parent 31da9ee711
commit 7124efa81b

View File

@ -2664,7 +2664,9 @@ codegen to generate the correct cpp call for this op. Contact AOTInductor team f
]
+ [
"\n".join(
f"#include <ATen/ops/{f.root_name}_ops.h>"
f"#include <ATen/ops/{f.root_name}_ops.h>\n"
# NB: this include is also important for correct visibility
f"#include <ATen/ops/{f.root_name}_native.h>"
for f in [g.inplace, g.mutable, g.functional]
if f is not None and "generated" not in f.tags
)