[inductor][ez] return choicecallers directly (#161345)

# why

- remove repeat patterns
- we have everything to make the choicecallers
  - templates
  - input_nodes
  - layouts
  - all the kwargs

# what

- yield a choicecaller directly from V.choices.get_mm_configs

# testing

```
python3 -bb -m pytest test/inductor/test_max_autotune.py -v
```

Differential Revision: [D81520577](https://our.internmc.facebook.com/intern/diff/D81520577)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/161345
Approved by: https://github.com/jansel
ghstack dependencies: #162075, #161340, #161341, #161342, #161343, #161344
This commit is contained in:
Ruben Rodriguez Buchillon
2025-09-05 07:38:42 -07:00
committed by PyTorch MergeBot
parent 031d79cb51
commit d63ad53a99
7 changed files with 190 additions and 234 deletions

View File

@ -1919,6 +1919,18 @@ class ExternKernelChoice:
# unique by prefixing with aten
return f"aten::{self.name}"
def choice_or_none(self, **kwargs: Any) -> Optional[ChoiceCaller]:
"""
Maybe generates a new ChoiceCaller and returns it, or None if generation fails.
kwargs: Additional kwargs to be passed to generate a new ChoiceCaller.
"""
temp_choices: list[Any] = []
result = self.maybe_append_choice(temp_choices, **kwargs)
if result is None and len(temp_choices) == 1:
return temp_choices[0]
return None
def maybe_append_choice(
self, choices: list[Any], **kwargs: Any
) -> Optional[NotImplementedError]: