Repository navigation
[AOTI][BE] Change test_aoti_inference to one-pass build - #164277
desertfire wants to merge 17 commits into
Conversation
Summary: To fix #159400. Currently, test_aoti_abi_check and test_aoti_inference need to be built in two passes, first build pytorch using the regular `pythonsetup.py develop` and then build with `CMAKE_FRESH=1 BUILD_AOT_INDUCTOR_TEST=1 python setup.py devleop`. This is cumbersome. Fix by: 1) Make test_aoti_abi_check to be not controlled by BUILD_AOT_INDUCTOR_TEST, because it is not AOTI-specific and doesn't rely on Export+AOTI. I will submit another PR to refactor/rename. 2) Rewrite CMakeLists.txt for test_aoti_inference to one-pass build which runs AOTI to compile models at the test time. Also update CI test script to get rid of two-pass build. [ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/164277
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit f92e2ef with merge base 2ce894b ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Summary: To fix #159400. Currently, test_aoti_abi_check and test_aoti_inference need to be built in two passes, first build pytorch using the regular `pythonsetup.py develop` and then build with `CMAKE_FRESH=1 BUILD_AOT_INDUCTOR_TEST=1 python setup.py devleop`. This is cumbersome. Fix by: 1) Make test_aoti_abi_check to be not controlled by BUILD_AOT_INDUCTOR_TEST, because it is not AOTI-specific and doesn't rely on Export+AOTI. I will submit another PR to refactor/rename. 2) Rewrite CMakeLists.txt for test_aoti_inference to one-pass build which runs AOTI to compile models at the test time. Also update CI test script to get rid of two-pass build. ghstack-source-id: c6d2a32 Pull Request resolved: #164277
Summary: To fix #159400. Currently, test_aoti_abi_check and test_aoti_inference need to be built in two passes, first build pytorch using the regular `pythonsetup.py develop` and then build with `CMAKE_FRESH=1 BUILD_AOT_INDUCTOR_TEST=1 python setup.py devleop`. This is cumbersome. Fix by: 1) Make test_aoti_abi_check to be not controlled by BUILD_AOT_INDUCTOR_TEST, because it is not AOTI-specific and doesn't rely on Export+AOTI. I will submit another PR to refactor/rename. 2) Rewrite CMakeLists.txt for test_aoti_inference to one-pass build which runs AOTI to compile models at the test time. Also update CI test script to get rid of two-pass build. [ghstack-poisoned]
Summary: To fix #159400. Currently, test_aoti_abi_check and test_aoti_inference need to be built in two passes, first build pytorch using the regular `pythonsetup.py develop` and then build with `CMAKE_FRESH=1 BUILD_AOT_INDUCTOR_TEST=1 python setup.py devleop`. This is cumbersome. Fix by: 1) Make test_aoti_abi_check to be not controlled by BUILD_AOT_INDUCTOR_TEST, because it is not AOTI-specific and doesn't rely on Export+AOTI. I will submit another PR to refactor/rename. 2) Rewrite CMakeLists.txt for test_aoti_inference to one-pass build which runs AOTI to compile models at the test time. Also update CI test script to get rid of two-pass build. ghstack-source-id: b3bbc0e Pull Request resolved: #164277
Summary: To fix #159400. Currently, test_aoti_abi_check and test_aoti_inference need to be built in two passes, first build pytorch using the regular `pythonsetup.py develop` and then build with `CMAKE_FRESH=1 BUILD_AOT_INDUCTOR_TEST=1 python setup.py devleop`. This is cumbersome. Fix by: 1) Make test_aoti_abi_check to be not controlled by BUILD_AOT_INDUCTOR_TEST, because it is not AOTI-specific and doesn't rely on Export+AOTI. I will submit another PR to refactor/rename. 2) Rewrite CMakeLists.txt for test_aoti_inference to one-pass build which runs AOTI to compile models at the test time. Also update CI test script to get rid of two-pass build. [ghstack-poisoned]
Summary: To fix #159400. Currently, test_aoti_abi_check and test_aoti_inference need to be built in two passes, first build pytorch using the regular `pythonsetup.py develop` and then build with `CMAKE_FRESH=1 BUILD_AOT_INDUCTOR_TEST=1 python setup.py devleop`. This is cumbersome. Fix by: 1) Make test_aoti_abi_check to be not controlled by BUILD_AOT_INDUCTOR_TEST, because it is not AOTI-specific and doesn't rely on Export+AOTI. I will submit another PR to refactor/rename. 2) Rewrite CMakeLists.txt for test_aoti_inference to one-pass build which runs AOTI to compile models at the test time. Also update CI test script to get rid of two-pass build. ghstack-source-id: 19d5df4 Pull Request resolved: #164277
Summary: To fix #159400. Currently, test_aoti_abi_check and test_aoti_inference need to be built in two passes, first build pytorch using the regular `pythonsetup.py develop` and then build with `CMAKE_FRESH=1 BUILD_AOT_INDUCTOR_TEST=1 python setup.py devleop`. This is cumbersome. Fix by: 1) Make test_aoti_abi_check to be not controlled by BUILD_AOT_INDUCTOR_TEST, because it is not AOTI-specific and doesn't rely on Export+AOTI. I will submit another PR to refactor/rename. 2) Rewrite CMakeLists.txt for test_aoti_inference to one-pass build which runs AOTI to compile models at the test time. Also update CI test script to get rid of two-pass build. [ghstack-poisoned]
Summary: To fix #159400. Currently, test_aoti_abi_check and test_aoti_inference need to be built in two passes, first build pytorch using the regular `pythonsetup.py develop` and then build with `CMAKE_FRESH=1 BUILD_AOT_INDUCTOR_TEST=1 python setup.py devleop`. This is cumbersome. Fix by: 1) Make test_aoti_abi_check to be not controlled by BUILD_AOT_INDUCTOR_TEST, because it is not AOTI-specific and doesn't rely on Export+AOTI. I will submit another PR to refactor/rename. 2) Rewrite CMakeLists.txt for test_aoti_inference to one-pass build which runs AOTI to compile models at the test time. Also update CI test script to get rid of two-pass build. ghstack-source-id: ba33efd Pull Request resolved: #164277
Summary: To fix #159400. Currently, test_aoti_abi_check and test_aoti_inference need to be built in two passes, first build pytorch using the regular `pythonsetup.py develop` and then build with `CMAKE_FRESH=1 BUILD_AOT_INDUCTOR_TEST=1 python setup.py devleop`. This is cumbersome. Fix by: 1) Make test_aoti_abi_check to be not controlled by BUILD_AOT_INDUCTOR_TEST, because it is not AOTI-specific and doesn't rely on Export+AOTI. I will submit another PR to refactor/rename. 2) Rewrite CMakeLists.txt for test_aoti_inference to one-pass build which runs AOTI to compile models at the test time. Also update CI test script to get rid of two-pass build. [ghstack-poisoned]
Summary: To fix #159400. Currently, test_aoti_abi_check and test_aoti_inference need to be built in two passes, first build pytorch using the regular `pythonsetup.py develop` and then build with `CMAKE_FRESH=1 BUILD_AOT_INDUCTOR_TEST=1 python setup.py devleop`. This is cumbersome. Fix by: 1) Make test_aoti_abi_check to be not controlled by BUILD_AOT_INDUCTOR_TEST, because it is not AOTI-specific and doesn't rely on Export+AOTI. I will submit another PR to refactor/rename. 2) Rewrite CMakeLists.txt for test_aoti_inference to one-pass build which runs AOTI to compile models at the test time. Also update CI test script to get rid of two-pass build. ghstack-source-id: 8c13a9c Pull Request resolved: #164277
Summary: To fix #159400. Currently, test_aoti_abi_check and test_aoti_inference need to be built in two passes, first build pytorch using the regular `pythonsetup.py develop` and then build with `CMAKE_FRESH=1 BUILD_AOT_INDUCTOR_TEST=1 python setup.py devleop`. This is cumbersome. Fix by rewriting CMakeLists.txt for test_aoti_inference to one-pass build which runs AOTI to compile models at the test time. Also update CI test script to get rid of two-pass build. [ghstack-poisoned]
Summary: To fix #159400. Currently, test_aoti_abi_check and test_aoti_inference need to be built in two passes, first build pytorch using the regular `pythonsetup.py develop` and then build with `CMAKE_FRESH=1 BUILD_AOT_INDUCTOR_TEST=1 python setup.py devleop`. This is cumbersome. Fix by rewriting CMakeLists.txt for test_aoti_inference to one-pass build which runs AOTI to compile models at the test time. Also update CI test script to get rid of two-pass build. ghstack-source-id: 4319435 Pull Request resolved: #164277
Summary: To fix #159400. Currently, test_aoti_abi_check and test_aoti_inference need to be built in two passes, first build pytorch using the regular `pythonsetup.py develop` and then build with `CMAKE_FRESH=1 BUILD_AOT_INDUCTOR_TEST=1 python setup.py devleop`. This is cumbersome. Fix by rewriting CMakeLists.txt for test_aoti_inference to one-pass build which runs AOTI to compile models at the test time. Also update CI test script to get rid of two-pass build. [ghstack-poisoned]
Summary: To fix #159400. Currently, test_aoti_abi_check and test_aoti_inference need to be built in two passes, first build pytorch using the regular `pythonsetup.py develop` and then build with `CMAKE_FRESH=1 BUILD_AOT_INDUCTOR_TEST=1 python setup.py devleop`. This is cumbersome. Fix by rewriting CMakeLists.txt for test_aoti_inference to one-pass build which runs AOTI to compile models at the test time. Also update CI test script to get rid of two-pass build. ghstack-source-id: 9a0701c Pull Request resolved: #164277
Summary: To fix #159400. Currently, test_aoti_abi_check and test_aoti_inference need to be built in two passes, first build pytorch using the regular `pythonsetup.py develop` and then build with `CMAKE_FRESH=1 BUILD_AOT_INDUCTOR_TEST=1 python setup.py devleop`. This is cumbersome. Fix by rewriting CMakeLists.txt for test_aoti_inference to one-pass build which runs AOTI to compile models at the test time. Also update CI test script to get rid of two-pass build. [ghstack-poisoned]
Summary: To fix #159400. Currently, test_aoti_abi_check and test_aoti_inference need to be built in two passes, first build pytorch using the regular `pythonsetup.py develop` and then build with `CMAKE_FRESH=1 BUILD_AOT_INDUCTOR_TEST=1 python setup.py devleop`. This is cumbersome. Fix by rewriting CMakeLists.txt for test_aoti_inference to one-pass build which runs AOTI to compile models at the test time. Also update CI test script to get rid of two-pass build. ghstack-source-id: 34a1ceb Pull Request resolved: #164277
Summary: To fix #159400. Currently, test_aoti_abi_check and test_aoti_inference need to be built in two passes, first build pytorch using the regular `pythonsetup.py develop` and then build with `CMAKE_FRESH=1 BUILD_AOT_INDUCTOR_TEST=1 python setup.py devleop`. This is cumbersome. Fix by rewriting CMakeLists.txt for test_aoti_inference to one-pass build which runs AOTI to compile models at the test time. Also update CI test script to get rid of two-pass build. [ghstack-poisoned]
Summary: To fix #159400. Currently, test_aoti_abi_check and test_aoti_inference need to be built in two passes, first build pytorch using the regular `pythonsetup.py develop` and then build with `CMAKE_FRESH=1 BUILD_AOT_INDUCTOR_TEST=1 python setup.py devleop`. This is cumbersome. Fix by rewriting CMakeLists.txt for test_aoti_inference to one-pass build which runs AOTI to compile models at the test time. Also update CI test script to get rid of two-pass build. ghstack-source-id: 8f220e5 Pull Request resolved: #164277
Summary: To fix #159400. Currently, test_aoti_abi_check and test_aoti_inference need to be built in two passes, first build pytorch using the regular `pythonsetup.py develop` and then build with `CMAKE_FRESH=1 BUILD_AOT_INDUCTOR_TEST=1 python setup.py devleop`. This is cumbersome. Fix by rewriting CMakeLists.txt for test_aoti_inference to one-pass build which runs AOTI to compile models at the test time. Also update CI test script to get rid of two-pass build. [ghstack-poisoned]
Summary: To fix #159400. Currently, test_aoti_abi_check and test_aoti_inference need to be built in two passes, first build pytorch using the regular `pythonsetup.py develop` and then build with `CMAKE_FRESH=1 BUILD_AOT_INDUCTOR_TEST=1 python setup.py devleop`. This is cumbersome. Fix by rewriting CMakeLists.txt for test_aoti_inference to one-pass build which runs AOTI to compile models at the test time. Also update CI test script to get rid of two-pass build. ghstack-source-id: 7569e98 Pull Request resolved: #164277
Summary: To fix #159400. Currently, test_aoti_abi_check and test_aoti_inference need to be built in two passes, first build pytorch using the regular `pythonsetup.py develop` and then build with `CMAKE_FRESH=1 BUILD_AOT_INDUCTOR_TEST=1 python setup.py devleop`. This is cumbersome. Fix by rewriting CMakeLists.txt for test_aoti_inference to one-pass build which runs AOTI to compile models at the test time. Also update CI test script to get rid of two-pass build. [ghstack-poisoned]
Summary: To fix #159400. Currently, test_aoti_abi_check and test_aoti_inference need to be built in two passes, first build pytorch using the regular `pythonsetup.py develop` and then build with `CMAKE_FRESH=1 BUILD_AOT_INDUCTOR_TEST=1 python setup.py devleop`. This is cumbersome. Fix by rewriting CMakeLists.txt for test_aoti_inference to one-pass build which runs AOTI to compile models at the test time. Also update CI test script to get rid of two-pass build. ghstack-source-id: 5700903 Pull Request resolved: #164277
Summary: To fix #159400. Currently, test_aoti_abi_check and test_aoti_inference need to be built in two passes, first build pytorch using the regular `pythonsetup.py develop` and then build with `CMAKE_FRESH=1 BUILD_AOT_INDUCTOR_TEST=1 python setup.py devleop`. This is cumbersome. Fix by rewriting CMakeLists.txt for test_aoti_inference to one-pass build which runs AOTI to compile models at the test time. Also update CI test script to get rid of two-pass build. [ghstack-poisoned]
Summary: To fix #159400. Currently, test_aoti_abi_check and test_aoti_inference need to be built in two passes, first build pytorch using the regular `pythonsetup.py develop` and then build with `CMAKE_FRESH=1 BUILD_AOT_INDUCTOR_TEST=1 python setup.py devleop`. This is cumbersome. Fix by rewriting CMakeLists.txt for test_aoti_inference to one-pass build which runs AOTI to compile models at the test time. Also update CI test script to get rid of two-pass build. ghstack-source-id: b93cf60 Pull Request resolved: #164277
Summary: To fix #159400. Currently, test_aoti_abi_check and test_aoti_inference need to be built in two passes, first build pytorch using the regular `pythonsetup.py develop` and then build with `CMAKE_FRESH=1 BUILD_AOT_INDUCTOR_TEST=1 python setup.py devleop`. This is cumbersome. Fix by rewriting CMakeLists.txt for test_aoti_inference to one-pass build which runs AOTI to compile models at the test time. Also update CI test script to get rid of two-pass build. [ghstack-poisoned]
| COPY ci_commit_pins/timm.txt timm.txt | ||
| COPY ci_commit_pins/torchbench.txt torchbench.txt | ||
| # Only build aoti cpp tests when INDUCTOR_BENCHMARKS is set to True | ||
| ENV BUILD_AOT_INDUCTOR_TEST ${INDUCTOR_BENCHMARKS} |
There was a problem hiding this comment.
when is INDUCTOR_BENCHMARKS set? Is this when test_inductor_aoti_cpp is going to be run?
janeyx99
left a comment
There was a problem hiding this comment.
Thanks! Approval contingent on inductor_cpp_wrapper shard 1 CI passing (showing that the aoti_abi_check test is still running + passing on CI)
|
Checked that https://github.com/pytorch/pytorch/actions/runs/18791842048/job/53631567795#logs is passing and test_aoti_abi_check is in there |
|
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Merge failedReason: 1 jobs have failed, first few of them are: linux-aarch64 / linux-jammy-aarch64-py3.10 / build Details for Dev Infra teamRaised by workflow job |
Summary: To fix #159400. Currently, test_aoti_abi_check and test_aoti_inference need to be built in two passes, first build pytorch using the regular `pythonsetup.py develop` and then build with `CMAKE_FRESH=1 BUILD_AOT_INDUCTOR_TEST=1 python setup.py devleop`. This is cumbersome. Fix by rewriting CMakeLists.txt for test_aoti_inference to one-pass build which runs AOTI to compile models at the test time. Also update CI test script to get rid of two-pass build. For test_aoti_abi_check, it is not AOTI specific, so we make it not guarded by BUILD_AOT_INDUCTOR_TEST. ghstack-source-id: a93892e Pull Request resolved: #164277
Summary: To fix #159400. Currently, test_aoti_abi_check and test_aoti_inference need to be built in two passes, first build pytorch using the regular `pythonsetup.py develop` and then build with `CMAKE_FRESH=1 BUILD_AOT_INDUCTOR_TEST=1 python setup.py devleop`. This is cumbersome. Fix by rewriting CMakeLists.txt for test_aoti_inference to one-pass build which runs AOTI to compile models at the test time. Also update CI test script to get rid of two-pass build. For test_aoti_abi_check, it is not AOTI specific, so we make it not guarded by BUILD_AOT_INDUCTOR_TEST. ghstack-source-id: 0460674 Pull Request resolved: #164277
|
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Fixes #199776. `test_aoti_inference` has collected no tests in CI since #164277. That change moved model generation from build time to test time and dropped the rebuild in the test job, but the binary still depended on its build directory, `build/test_aoti_inference`, which the build job does not ship (only `build/lib` and `build/bin` are): `libaoti_custom_class.so` was built there, the generated data is written there, and `compile_model.py` loaded the library from its cwd, which only worked because that cwd was the same directory. The binary failed to start, pytest-cpp skipped it, and run_test.py counted "no tests collected" as a pass; #199440 made that a failure and dropped the test from `test_inductor_aoti_cpp`. `aoti_custom_class` is now built into the default `build/lib`, which is shipped and already on the binary's RUNPATH. Its path is passed to the test as `AOTI_CUSTOM_CLASS_LIB` and from there to `compile_model.py` on the command line. The test creates the data directory before generating into it. The remaining build-time paths (data directory, test sources) still resolve in the test job because CI builds and tests in the same workspace path; making them fully relocatable (relative to the binary or via an env var) is a larger change that only matters if the test moves to a job where those paths differ. `test_inductor_aoti_cpp` also runs in the CPU `inductor_aoti_fallback` job, so `test.py` now skips its CUDA-only models when CUDA is unavailable, and the files-exist check only requires `script_model_cuda.pt` in CUDA/ROCm builds; otherwise every test process would regenerate all the data on CPU. Test Plan: Built with the test enabled on macOS arm64 (CPU). Apple ld rejects `-Wl,--no-as-needed`, so that flag was dropped locally for this build only. To mirror a CI test job, `build/test_aoti_inference` was moved aside before running, so the test had to create it and generate all data itself: ``` BUILD_AOT_INDUCTOR_TEST=1 pip install -e . -v --no-build-isolation mv build/test_aoti_inference /tmp/ cd test && ../build/bin/test_aoti_inference ``` All 9 CPU tests pass (with the previous commit's consts cpp fix). CUDA tests and the run_test.py path were not run locally; CI covers them via the a10g `inductor_cpp_wrapper` job. This PR was authored with the assistance of Claude (AI). ghstack-source-id: e244a0a Pull-Request: #201699
Fixes #199776. `test_aoti_inference` has collected no tests in CI since #164277. That change moved model generation from build time to test time and dropped the rebuild in the test job, but the binary still depended on its build directory, `build/test_aoti_inference`, which the build job does not ship (only `build/lib` and `build/bin` are): `libaoti_custom_class.so` was built there, the generated data is written there, and `compile_model.py` loaded the library from its cwd, which only worked because that cwd was the same directory. The binary failed to start, pytest-cpp skipped it, and run_test.py counted "no tests collected" as a pass; #199440 made that a failure and dropped the test from `test_inductor_aoti_cpp`. `aoti_custom_class` is now built into the default `build/lib`, which is shipped and already on the binary's RUNPATH. Its path is passed to the test as `AOTI_CUSTOM_CLASS_LIB` and from there to `compile_model.py` on the command line. The test creates the data directory before generating into it. The remaining build-time paths (data directory, test sources) still resolve in the test job because CI builds and tests in the same workspace path; making them fully relocatable (relative to the binary or via an env var) is a larger change that only matters if the test moves to a job where those paths differ. `test_inductor_aoti_cpp` also runs in the CPU `inductor_aoti_fallback` job, so `test.py` now skips its CUDA-only models when CUDA is unavailable, and the files-exist check only requires `script_model_cuda.pt` when a GPU is visible, matching the generators; otherwise every test process would regenerate all the data on CPU, or on a CUDA build without a visible GPU. Test Plan: Built with the test enabled on macOS arm64 (CPU). Apple ld rejects `-Wl,--no-as-needed`, so that flag was dropped locally for this build only. To mirror a CI test job, `build/test_aoti_inference` was moved aside before running, so the test had to create it and generate all data itself: ``` BUILD_AOT_INDUCTOR_TEST=1 pip install -e . -v --no-build-isolation mv build/test_aoti_inference /tmp/ cd test && ../build/bin/test_aoti_inference ``` All 9 CPU tests pass (with the previous commit's consts cpp fix). CUDA tests and the run_test.py path were not run locally; CI covers them via the a10g `inductor_cpp_wrapper` job. This PR was authored with the assistance of Claude (AI). ghstack-source-id: 6b2be4d Pull-Request: #201699
Fixes #199776. `test_aoti_inference` has collected no tests in CI since #164277. That change moved model generation from build time to test time and dropped the rebuild in the test job, but the binary still depended on its build directory, `build/test_aoti_inference`, which the build job does not ship (only `build/lib` and `build/bin` are): `libaoti_custom_class.so` was built there, the generated data is written there, and `compile_model.py` loaded the library from its cwd, which only worked because that cwd was the same directory. The binary failed to start, pytest-cpp skipped it, and run_test.py counted "no tests collected" as a pass; #199440 made that a failure and dropped the test from `test_inductor_aoti_cpp`. `aoti_custom_class` is now built into the default `build/lib`, which is shipped and already on the binary's RUNPATH. Its path is passed to the test as `AOTI_CUSTOM_CLASS_LIB` and from there to `compile_model.py` on the command line. The test creates the data directory before generating into it. The remaining build-time paths (data directory, test sources) still resolve in the test job because CI builds and tests in the same workspace path; making them fully relocatable (relative to the binary or via an env var) is a larger change that only matters if the test moves to a job where those paths differ. `test_inductor_aoti_cpp` also runs in the CPU `inductor_aoti_fallback` job, so `test.py` now skips its CUDA-only models when CUDA is unavailable, and the files-exist check only requires `script_model_cuda.pt` when a GPU is visible, matching the generators; otherwise every test process would regenerate all the data on CPU, or on a CUDA build without a visible GPU. Test Plan: Built with the test enabled on macOS arm64 (CPU). Apple ld rejects `-Wl,--no-as-needed`, so that flag was dropped locally for this build only. To mirror a CI test job, `build/test_aoti_inference` was moved aside before running, so the test had to create it and generate all data itself: ``` BUILD_AOT_INDUCTOR_TEST=1 pip install -e . -v --no-build-isolation mv build/test_aoti_inference /tmp/ cd test && ../build/bin/test_aoti_inference ``` All 9 CPU tests pass (with the previous commit's consts cpp fix). CUDA tests and the run_test.py path were not run locally; CI covers them via the a10g `inductor_cpp_wrapper` job. This PR was authored with the assistance of Claude (AI). ghstack-source-id: 572755e Pull-Request: #201699
Fixes #199776. `test_aoti_inference` has collected no tests in CI since #164277. That change moved model generation from build time to test time and dropped the rebuild in the test job, but the binary still depended on its build directory, `build/test_aoti_inference`, which the build job does not ship (only `build/lib` and `build/bin` are): `libaoti_custom_class.so` was built there, the generated data is written there, and `compile_model.py` loaded the library from its cwd, which only worked because that cwd was the same directory. The binary failed to start, pytest-cpp skipped it, and run_test.py counted "no tests collected" as a pass; #199440 made that a failure and dropped the test from `test_inductor_aoti_cpp`. `aoti_custom_class` is now built into the default `build/lib`, which is shipped and already on the binary's RUNPATH. Its path is passed to the test as `AOTI_CUSTOM_CLASS_LIB` and from there to `compile_model.py` on the command line. The test creates the data directory before generating into it. The remaining build-time paths (data directory, test sources) still resolve in the test job because CI builds and tests in the same workspace path; making them fully relocatable (relative to the binary or via an env var) is a larger change that only matters if the test moves to a job where those paths differ. `test_inductor_aoti_cpp` also runs in the CPU `inductor_aoti_fallback` job, so `test.py` now skips its CUDA-only models when CUDA is unavailable, and the files-exist check only requires `script_model_cuda.pt` when a GPU is visible, matching the generators; otherwise every test process would regenerate all the data on CPU, or on a CUDA build without a visible GPU. Test Plan: Built with the test enabled on macOS arm64 (CPU). Apple ld rejects `-Wl,--no-as-needed`, so that flag was dropped locally for this build only. To mirror a CI test job, `build/test_aoti_inference` was moved aside before running, so the test had to create it and generate all data itself: ``` BUILD_AOT_INDUCTOR_TEST=1 pip install -e . -v --no-build-isolation mv build/test_aoti_inference /tmp/ cd test && ../build/bin/test_aoti_inference ``` All 9 CPU tests pass (with the previous commit's consts cpp fix). CUDA tests and the run_test.py path were not run locally; CI covers them via the a10g `inductor_cpp_wrapper` job. This PR was authored with the assistance of Claude (AI). ghstack-source-id: 78e521f Pull-Request: #201699
…1699) Fixes #199776. `test_aoti_inference` has collected no tests in CI since #164277. That change moved model generation from build time to test time and dropped the rebuild in the test job, but the binary still depended on its build directory, `build/test_aoti_inference`, which the build job does not ship (only `build/lib` and `build/bin` are): `libaoti_custom_class.so` was built there, the generated data is written there, and `compile_model.py` loaded the library from its cwd, which only worked because that cwd was the same directory. The binary failed to start, pytest-cpp skipped it, and run_test.py counted "no tests collected" as a pass; #199440 made that a failure and dropped the test from `test_inductor_aoti_cpp`. `aoti_custom_class` is now built into the default `build/lib`, which is shipped and already on the binary's RUNPATH. Its path is passed to the test as `AOTI_CUSTOM_CLASS_LIB` and from there to `compile_model.py` on the command line. The test creates the data directory before generating into it. The remaining build-time paths (data directory, test sources) still resolve in the test job because CI builds and tests in the same workspace path; making them fully relocatable (relative to the binary or via an env var) is a larger change that only matters if the test moves to a job where those paths differ. `test_inductor_aoti_cpp` also runs in the CPU `inductor_aoti_fallback` job, so `test.py` now skips its CUDA-only models when CUDA is unavailable, and the files-exist check only requires `script_model_cuda.pt` when a GPU is visible, matching the generators; otherwise every test process would regenerate all the data on CPU, or on a CUDA build without a visible GPU. Test Plan: Built with the test enabled on macOS arm64 (CPU). Apple ld rejects `-Wl,--no-as-needed`, so that flag was dropped locally for this build only. To mirror a CI test job, `build/test_aoti_inference` was moved aside before running, so the test had to create it and generate all data itself: ``` BUILD_AOT_INDUCTOR_TEST=1 pip install -e . -v --no-build-isolation mv build/test_aoti_inference /tmp/ cd test && ../build/bin/test_aoti_inference ``` All 9 CPU tests pass (with the previous commit's consts cpp fix). CUDA tests and the run_test.py path were not run locally; CI covers them via the a10g `inductor_cpp_wrapper` job. This PR was authored with the assistance of Claude (AI). Pull Request resolved: #201699 Approved by: https://github.com/angelayi
Stack from ghstack (oldest at bottom):
Summary: To fix #159400. Currently, test_aoti_abi_check and test_aoti_inference need to be built in two passes, first build pytorch using the regular
pythonsetup.py developand then build withCMAKE_FRESH=1 BUILD_AOT_INDUCTOR_TEST=1 python setup.py devleop. This is cumbersome. Fix by rewriting CMakeLists.txt for test_aoti_inference to one-pass build which runs AOTI to compile models at the test time. Also update CI test script to get rid of two-pass build. For test_aoti_abi_check, it is not AOTI specific, so we make it not guarded by BUILD_AOT_INDUCTOR_TEST.