Skip to content

Commit d6264cf

Browse files
authored
Eliminate wrapper facades for the Triton hooks API (#4245)
Signed-off-by: Anatoly Myachev <anatoly.myachev@intel.com>
1 parent 1d99b7a commit d6264cf

File tree

3 files changed

+1
-61
lines changed

3 files changed

+1
-61
lines changed

python/triton/_utils.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -35,26 +35,3 @@ def _impl(path: tuple[int, ...], current: Any):
3535
_impl((), iterable)
3636

3737
return list(ret.keys())
38-
39-
40-
class ClassPropertyDescriptor:
41-
42-
def __init__(self, fget, fset=None):
43-
self.fget = fget
44-
self.fset = fset
45-
46-
def __get__(self, obj, cls):
47-
return self.fget(cls)
48-
49-
def __set__(self, obj, value):
50-
if self.fset is None:
51-
raise AttributeError("can't set attribute")
52-
self.fset(obj.__class__, value)
53-
54-
def setter(self, fset):
55-
self.fset = fset
56-
return self
57-
58-
59-
def classproperty(func):
60-
return ClassPropertyDescriptor(func)

python/triton/compiler/compiler.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
from ..runtime.cache import get_cache_manager, get_dump_manager, get_override_manager
1010
from ..runtime.driver import driver
1111
from ..tools.disasm import get_sass, get_spvdis
12-
from .._utils import classproperty
1312
# TODO: this shouldn't be here
1413
from .code_generator import ast_to_ttir
1514
from pathlib import Path
@@ -432,24 +431,6 @@ def __missing__(self, key):
432431

433432
class CompiledKernel:
434433

435-
# FIXME: remove launch_enter_hook/launch_exit_hook properties
436-
# when pytorch has a compatible layer for the new API.
437-
@classproperty
438-
def launch_enter_hook(cls):
439-
return knobs.runtime.launch_enter_hook
440-
441-
@launch_enter_hook.setter
442-
def launch_enter_hook(cls, value):
443-
knobs.runtime.launch_enter_hook = value
444-
445-
@classproperty
446-
def launch_exit_hook(cls):
447-
return knobs.runtime.launch_exit_hook
448-
449-
@launch_exit_hook.setter
450-
def launch_exit_hook(cls, value):
451-
knobs.runtime.launch_exit_hook = value
452-
453434
def __init__(self, src, metadata_group, hash):
454435
from collections import namedtuple
455436
metadata_path = next((Path(p) for c, p in metadata_group.items() if c.endswith(".json")))

python/triton/runtime/jit.py

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from types import ModuleType
1515
from .. import knobs
1616
from ..runtime.driver import driver
17-
from .._utils import find_paths_if, get_iterable_path, classproperty
17+
from .._utils import find_paths_if, get_iterable_path
1818

1919
TRITON_MODULE = __name__[:-len(".runtime.jit")]
2020

@@ -494,24 +494,6 @@ class JitFunctionInfo:
494494

495495
class JITFunction(KernelInterface[T]):
496496

497-
# FIXME: remove cache_hook/compiled_hook properties
498-
# when pytorch has a compatible layer for the new API.
499-
@classproperty
500-
def cache_hook(cls):
501-
return knobs.runtime.jit_cache_hook
502-
503-
@cache_hook.setter
504-
def cache_hook(cls, value):
505-
knobs.runtime.jit_cache_hook = value
506-
507-
@classproperty
508-
def compiled_hook(cls):
509-
return knobs.runtime.jit_post_compile_hook
510-
511-
@compiled_hook.setter
512-
def compiled_hook(cls, value):
513-
knobs.runtime.jit_post_compile_hook = value
514-
515497
def _call_hook(
516498
self,
517499
hook,

0 commit comments

Comments
 (0)