Skip to content

[AOTI][BE] Change test_aoti_inference to one-pass build - #164277

Closed
desertfire wants to merge 17 commits into
gh/desertfire/600/basefrom
gh/desertfire/600/head
Closed

desertfire wants to merge 17 commits into
gh/desertfire/600/basefrom
gh/desertfire/600/head

Conversation

@desertfire

@desertfire desertfire commented Sep 30, 2025 •

Copy link
Copy Markdown
Contributor

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 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.

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]
@desertfire
desertfire requested a review from a team as a code owner September 30, 2025 19:17
@pytorch-bot

pytorch-bot Bot commented Sep 30, 2025 •

Copy link
Copy Markdown

🔗 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 Failures

As of commit f92e2ef with merge base 2ce894b (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

desertfire added a commit that referenced this pull request Sep 30, 2025
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
Comment thread test/cpp/aoti_inference/test.cpp Resolved
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]
desertfire added a commit that referenced this pull request Sep 30, 2025
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
@desertfire desertfire added the topic: not user facing topic category label Oct 1, 2025
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]
desertfire added a commit that referenced this pull request Oct 1, 2025
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]
desertfire added a commit that referenced this pull request Oct 1, 2025
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]
desertfire added a commit that referenced this pull request Oct 1, 2025
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]
desertfire added a commit that referenced this pull request Oct 1, 2025
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]
desertfire added a commit that referenced this pull request Oct 1, 2025
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]
desertfire added a commit that referenced this pull request Oct 3, 2025
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]
desertfire added a commit that referenced this pull request Oct 3, 2025
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]
desertfire added a commit that referenced this pull request Oct 5, 2025
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]
desertfire added a commit that referenced this pull request Oct 7, 2025
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]
desertfire added a commit that referenced this pull request Oct 7, 2025
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]
@desertfire
desertfire requested a review from janeyx99 October 27, 2025 13:41
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}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when is INDUCTOR_BENCHMARKS set? Is this when test_inductor_aoti_cpp is going to be run?

@janeyx99 janeyx99 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Approval contingent on inductor_cpp_wrapper shard 1 CI passing (showing that the aoti_abi_check test is still running + passing on CI)

@janeyx99

Copy link
Copy Markdown
Contributor

@janeyx99

Copy link
Copy Markdown
Contributor

@pytorchbot merge

@pytorch-bot pytorch-bot Bot added the ciflow/trunk Trigger trunk jobs on your pull request label Oct 27, 2025
@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your 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

Advanced Debugging
Check the merge workflow status
here

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge failed

Reason: 1 jobs have failed, first few of them are: linux-aarch64 / linux-jammy-aarch64-py3.10 / build

Details for Dev Infra team Raised by workflow job

[ghstack-poisoned]
desertfire added a commit that referenced this pull request Oct 28, 2025
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
[ghstack-poisoned]
desertfire added a commit that referenced this pull request Oct 28, 2025
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
@desertfire

Copy link
Copy Markdown
Contributor Author

@pytorchbot merge

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your 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

Advanced Debugging
Check the merge workflow status
here

@github-actions
github-actions Bot deleted the gh/desertfire/600/head branch November 29, 2025 02:18
desertfire added a commit that referenced this pull request Oct 22, 2026
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
desertfire added a commit that referenced this pull request Oct 22, 2026
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
desertfire added a commit that referenced this pull request Oct 26, 2026
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
desertfire added a commit that referenced this pull request Oct 26, 2026
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
pytorchmergebot pushed a commit that referenced this pull request Oct 26, 2026
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/inductor ciflow/trunk Trigger trunk jobs on your pull request Merged topic: not user facing topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants