[AOTI] codegen for static linkage (#157129)

Design doc: https://docs.google.com/document/d/1ncV7RpJ8xDwy8-_aCBfvZmpTTL824C-aoNPBLLVkOHM/edit?tab=t.0 (internal)

- Add codegen for static linkage
- refactor test code for test_compile_after_package tests

For now,  the following options must be used together with `"aot_inductor.compile_standalone": True`.
"aot_inductor.package_cpp_only": True,

Will change `"aot_inductor.package_cpp_only"` to be automatically set to True in followup PR.

```
python test/inductor/test_aot_inductor_package.py -k test_compile_after_package
python test/inductor/test_aot_inductor_package.py -k test_run_static_linkage_model
```

Pull Request resolved: https://github.com/pytorch/pytorch/pull/157129
Approved by: https://github.com/desertfire
This commit is contained in:
Shangdi Yu
2025-07-10 16:03:50 +00:00
committed by PyTorch MergeBot
parent 9bdf87e891
commit 4781d72faa
10 changed files with 509 additions and 88 deletions

View File

@ -1310,7 +1310,9 @@ def main() -> None:
"include/**/*.hpp",
"include/*.cuh",
"include/**/*.cuh",
"csrc/inductor/aoti_runtime/model.h",
"_inductor/codegen/*.h",
"_inductor/codegen/aoti_runtime/*.h",
"_inductor/codegen/aoti_runtime/*.cpp",
"_inductor/script.ld",
"_export/serde/*.yaml",