Files
Adrian Abeyta 9978001139 [Stable-ABI] Add STABLE_TORCH_WARN and STABLE_TORCH_WARN_ONCE macros (#200065)
Adds `STABLE_TORCH_WARN` and `STABLE_TORCH_WARN_ONCE` to stable ABI. Needed for torchvision's [decode_webp](https://github.com/pytorch/vision/blob/main/torchvision/csrc/io/image/cpu/decode_webp.cpp#L62-L63).

## Summary
- Introduces `STABLE_TORCH_WARN` and `STABLE_TORCH_WARN_ONCE` mirroring [TORCH_WARN / TORCH_WARN_ONCE](https://github.com/pytorch/pytorch/blob/b50a07471edbdf47bdd042a13b774d3a7a1664d2/c10/util/Exception.h#L713-L747). The difference in behavior is such that messages go through `std::ostringstream` instead of `c10::str` and are always a `UserWarning`.
- `STABLE_TORCH_WARN` only needs `aoti_torch_warn` so it works at any target version. `STABLE_TORCH_WARN_ONCE` needs the new `torch_is_warn_always_enabled` shim to respect `set_warn_always`, so it's gated to 2.16+.
- Adds a `libtorch_agn_2_16_extension`.  `STABLE_TORCH_WARN` is tested from the 2_9 extension and `STABLE_TORCH_WARN_ONCE` from 2_16.

Supported by @janeyx99
Pull Request resolved: https://github.com/pytorch/pytorch/pull/200065
Approved by: https://github.com/janeyx99
2026-10-21 01:06:27 +00:00
..
…