pytorch/torchgen
Serhat Gundem 11129d9317 Add new ops in fallback ops (#154251)
Fixes #ISSUE_NUMBER

## Background

Task: [T222738229](https://www.internalfb.com/intern/tasks/?t=222738229)

It's the first starter task on the project **_Enabling TorchNative Standalone on Whisper_**.  We are using cshim to create a layer of abstraction between _**libtorch**_ and **_AOTInductor generated artifacts_**.

So we needed to add an entry in the cshim for every API surface in libtorch. And we only care about operators that AOTInductor does not handle. And for this task, we only wanted to add it for the following ops.

## What I've done?

4 new fallback ops are added that show up in the Whisper model. (torchgen/aoti/fallback_ops.py)

- aten.permute (default)
- aten.squueze (dim)
- aten.abs (default)
- aten.hann_window (default)

Then I ran the below command to generate new header C shim header files. As it says [here](7e86a7c015/torchgen/gen.py (L2424-L2436%20for%20details))
`python torchgen/gen.py --update-aoti-c-shim`

Then, `python setup.py develop` to rebuild PyTorch

## Testing

Also 4 new tests have been added on test/inductor/test_aot_inductor.py

- test_proxy_executor_permute
- test_proxy_executor_abs
- test_proxy_executor_squeeze
- test_proxy_executor_hann

I ran these commands to test it (inside local pytorch root folder):

`python test/inductor/test_aot_inductor.py -k test_proxy_executor_permute`
`python test/inductor/test_aot_inductor.py -k test_proxy_executor_abs`
`python test/inductor/test_aot_inductor.py -k test_proxy_executor_squeeze`
`python test/inductor/test_aot_inductor.py -k test_proxy_executor_hann`

## NOTE:
I didn't see any order between the tests inside _test/inductor/test_aot_inductor.py_. That's why, I added new tests just after the test given in the example.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/154251
Approved by: https://github.com/angelayi
2025-05-28 22:11:07 +00:00
..
_autoheuristic Fix broken URLs (#152237) 2025-04-27 09:56:42 +00:00
aoti Add new ops in fallback ops (#154251) 2025-05-28 22:11:07 +00:00
api [BE] Ensure generated stub files by gen_pyi are properly formatted (#150730) 2025-05-17 12:30:40 +00:00
decompositions Revert "Use absolute path path.resolve() -> path.absolute() (#129409)" 2025-01-04 14:17:20 +00:00
dest [MTIA Aten Backend][2/n] Migrate clamp ops(clamp.out/clamp_min.out/clamp_max.out) from out-of-tree to in-tree (#154015) 2025-05-23 17:59:47 +00:00
executorch [torchgen] Refactor torchgen.utils.FileManager to accept pathlib.Path (#150726) 2025-05-15 02:52:24 +00:00
fuse
operator_versions [3/N] Use internal linkage in C++ files (#151297) 2025-05-05 17:48:39 +00:00
selective_build
shape_functions Revert "Use absolute path path.resolve() -> path.absolute() (#129409)" 2025-01-04 14:17:20 +00:00
static_runtime [1/N] Use std::string_view in torchgen (#146403) 2025-04-16 01:50:22 +00:00
__init__.py
BUCK.oss
BUILD.bazel
build.bzl
code_template.py [BE] Ensure generated stub files by gen_pyi are properly formatted (#150730) 2025-05-17 12:30:40 +00:00
context.py [2/N] Apply py39 ruff fixes (#141938) 2024-12-05 06:26:06 +00:00
gen_aoti_c_shim.py [1/N] Use std::string_view in torchgen (#146403) 2025-04-16 01:50:22 +00:00
gen_backend_stubs.py [BE][CI] bump ruff to 0.9.2: multiline assert statements (#144546) 2025-02-27 20:46:16 +00:00
gen_executorch.py [BE][CI] bump ruff to 0.9.2: multiline assert statements (#144546) 2025-02-27 20:46:16 +00:00
gen_functionalization_type.py Add env for disabling meta reference on functionalization. (#148822) 2025-03-11 16:13:35 +00:00
gen_lazy_tensor.py [BE][Easy] use pathlib.Path instead of dirname / ".." / pardir (#129374) 2024-12-29 17:23:13 +00:00
gen_schema_utils.py [2/N] Apply py39 ruff fixes (#141938) 2024-12-05 06:26:06 +00:00
gen_vmap_plumbing.py [BE][CI] bump ruff to 0.9.0: string quote styles (#144569) 2025-02-24 19:56:09 +00:00
gen.py [MTIA Aten Backend][2/n] Migrate clamp ops(clamp.out/clamp_min.out/clamp_max.out) from out-of-tree to in-tree (#154015) 2025-05-23 17:59:47 +00:00
local.py [BE][CI] bump ruff to 0.9.2: multiline assert statements (#144546) 2025-02-27 20:46:16 +00:00
model.py [MTIA Aten Backend][2/n] Migrate clamp ops(clamp.out/clamp_min.out/clamp_max.out) from out-of-tree to in-tree (#154015) 2025-05-23 17:59:47 +00:00
native_function_generation.py [aotd] capture rrelu_with_noise noise mutation in compile (#141867) 2024-12-04 12:18:58 +00:00
utils.py [torchgen] Refactor torchgen.utils.FileManager to accept pathlib.Path (#150726) 2025-05-15 02:52:24 +00:00
yaml_utils.py [BE][CI] bump ruff to 0.9.2: multiline assert statements (#144546) 2025-02-27 20:46:16 +00:00