Repository navigation
[AOTI] Make test_aoti_inference runnable from CI build artifacts - #201699
desertfire wants to merge 5 commits into
Conversation
PR Status: Approved 🚀Please fix all CI failures and trigger merge by commenting "@pytorchbot merge". ✅ AUTOMATED REVIEW - Ready for human review:
Findings (1): Reviewed commit: 🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/201699
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit df124a7 with merge base 79a25ad ( 🟡 GREEN LIGHT - OUTDATED (earlier commit) - PR requires human review:
reason: This comment was automatically generated by Dr. CI and updates every 15 minutes. |
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
|
@claude, was test_aoti_inference run in the inductor_cpp_wrapper shard, https://github.com/pytorch/pytorch/actions/runs/39726128445/job/119657279629 ? |
|
Claude finished @desertfire's task in 38s —— View job Yes. Evidence from the job log
Per-test results are in the job's test-report artifacts: |
|
@pytorchbot merge |
|
This PR has pending changes requested. Please address the comments and update the PR before merging. |
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
Withdrawn: the automated review of 7b2da50 found nothing blocking.
[ghstack-poisoned]
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
[ghstack-poisoned]
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
There was a problem hiding this comment.
Automated review of df124a7: nothing blocking; ready for human review.
The PR makes test_aoti_inference runnable from CI build artifacts and re-enables it in test_inductor_aoti_cpp. It also turns data-generation failures into hard errors, but that error may cause every test to be reported as skipped instead of failed. Recommendation: Needs Discussion.
⚪ 1 non-blocking finding
pytorch/test/cpp/aoti_inference/test.cpp
Line 82 in df124a7
A generation failure probably shows up as skipped tests, not failures (medium confidence). The new TORCH_CHECKs run inside ensureTestDataGenerated(), whose only caller is the static AotInductorTest::SetUpTestSuite() (line 1692). Recent googletest releases catch an exception thrown in SetUpTestSuite(), record it on the suite rather than on a test, and Skip() every test in the suite. pytest-cpp runs each test with --gtest_filter, accepts exit code 1, and reports a skip when that test's XML entry is marked skipped. So if test.py or compile_model.py fails in CI (e.g. under TORCHINDUCTOR_LITE_MODE=1 in inductor_aoti_fallback), all AotInductorTest.* cases would show as skipped and run_test.py would pass. Before this PR, each test at least failed in torch::jit::load. Fix: call ensureTestDataGenerated() from a non-static SetUp() so a failure counts against the test, wrapped in ASSERT_NO_THROW or a catch that calls FAIL(). std::call_once is fine there because it re-runs the callable after it throws. Not verified against the pinned googletest. To check, break compile_model.py and run python test/run_test.py --cpp -i cpp/test_aoti_inference.
This review is AI-generated and advisory. Each new automated review replaces the previous one.
Withdrawn: the automated review of df124a7 found nothing blocking.
|
@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 |
Stack from ghstack (oldest at bottom):
Fixes #199776.
test_aoti_inferencehas collected no tests in CI since #164277. That changemoved 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 (onlybuild/liband
build/binare):libaoti_custom_class.sowas built there, the generateddata is written there, and
compile_model.pyloaded 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_classis now built into the defaultbuild/lib, which is shippedand already on the binary's RUNPATH. Its path is passed to the test as
AOTI_CUSTOM_CLASS_LIBand from there tocompile_model.pyon the commandline. 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_cppalso runs in the CPUinductor_aoti_fallbackjob, sotest.pynow skips its CUDA-only models when CUDA is unavailable, and thefiles-exist check only requires
script_model_cuda.ptwhen 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. Tomirror a CI test job,
build/test_aoti_inferencewas moved aside beforerunning, so the test had to create it and generate all data itself:
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_wrapperjob.This PR was authored with the assistance of Claude (AI).