Repository navigation
Commit eece52e
[AOTI] Add BC-safe c_shim v2 for _scaled_dot_product_attention_math_for_mps enable_gqa (#181549)
[AOTI] Add BC-safe c_shim v2 for _scaled_dot_product_attention_math_for_mps enable_gqa (#181448)
PR #179309 added enable_gqa to the _scaled_dot_product_attention_math_for_mps
op schema, which broke the AOTI c_shim ABI for downstream runtimes that
provide their own implementation (e.g. ExecuTorch Metal backend).
Add the op to fallback_ops.py with a v2 entry so the codegen produces a
BC-safe pair:
- _v2: new signature taking enable_gqa
- unversioned: old signature without enable_gqa, which calls the underlying
op with the schema default (false) at the call site
To make this work for non-optional args with defaults, extend the codegen
in gen_aoti_c_shim.py to emit the arg's schema default via default_expr for
skipped args, instead of always passing std::nullopt. std::nullopt remains
the fallback for args with no default.
Authored with Claude.
Pull Request resolved: #181448
Approved by: https://github.com/desertfire
ghstack dependencies: #181298, #181458
(cherry picked from commit 22790c5)
Co-authored-by: Manuel Candales <[email protected]>1 parent b39330b commit eece52e
3 files changed
Lines changed: 13 additions & 3 deletions
File tree
- torchgen
- aoti
- torch/csrc/inductor/aoti_torch/generated
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
214 | 214 | | |
215 | 215 | | |
216 | 216 | | |
217 | | - | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
218 | 227 | | |
219 | 228 | | |
220 | 229 | | |
| |||
0 commit comments