mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
[inductor][ez] add template/externchoice uid (#161341)
# why - to have a central registry of templates/externkernelchoice to match them to heuristics etc, they need unique names - mm is both the triton template name and the aten_mm name # what - add a uid() to KernelTemplate/ExternKernelChoice that returns name - override in ExternKernel to prepend "aten::" - override in TritonTemplate to prepend "triton::" This id is just use to find template heuristics, so it has no other impact # testing ``` python3 -bb -m pytest test/inductor/test_max_autotune.py -v ``` Differential Revision: [D81520579](https://our.internmc.facebook.com/intern/diff/D81520579) Pull Request resolved: https://github.com/pytorch/pytorch/pull/161341 Approved by: https://github.com/jansel, https://github.com/eellison ghstack dependencies: #162075, #161340
This commit is contained in:
committed by
PyTorch MergeBot
parent
9602590b15
commit
4902c76c65
@ -2391,6 +2391,17 @@ class KernelTemplate:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.name = name
|
||||
|
||||
@property
|
||||
def uid(self) -> str:
|
||||
"""
|
||||
entry point to override for templates to ensure a uid e.g. through a prefix
|
||||
|
||||
the purpose of this is that every KernelTemplate/ExternKernelChoice is unique
|
||||
in the system, but reproducible e.g. restarting pytorch should yield the same id
|
||||
"""
|
||||
# TODO(coconutruben): add some central registration to assert on global uniqueness
|
||||
return self.name
|
||||
|
||||
def maybe_append_choice(
|
||||
self, choices: list[Any], **kwargs: Any
|
||||
) -> Optional[NotImplementedError]:
|
||||
|
||||
Reference in New Issue
Block a user