16
16
logger .info ("Triton not installed or not compatible; certain GPU-related"
17
17
" functions will not be available." )
18
18
19
- class TritonPlaceholder (types .ModuleType ):
20
-
21
- def __init__ (self ):
22
- super ().__init__ ("triton" )
23
- self .jit = self ._dummy_decorator ("jit" )
24
- self .autotune = self ._dummy_decorator ("autotune" )
25
- self .heuristics = self ._dummy_decorator ("heuristics" )
26
- self .language = TritonLanguagePlaceholder ()
27
- logger .warning_once (
28
- "Triton is not installed. Using dummy decorators. "
29
- "Install it via `pip install triton` to enable kernel"
30
- "compilation." )
31
-
32
- def _dummy_decorator (self , name ):
33
-
34
- def decorator (func = None , ** kwargs ):
35
- if func is None :
36
- return lambda f : f
37
- return func
38
-
39
- return decorator
40
-
41
- class TritonLanguagePlaceholder (types .ModuleType ):
42
-
43
- def __init__ (self ):
44
- super ().__init__ ("triton.language" )
45
- self .constexpr = None
46
- self .dtype = None
47
- self .int64 = None
19
+
20
+ class TritonPlaceholder (types .ModuleType ):
21
+
22
+ def __init__ (self ):
23
+ super ().__init__ ("triton" )
24
+ self .jit = self ._dummy_decorator ("jit" )
25
+ self .autotune = self ._dummy_decorator ("autotune" )
26
+ self .heuristics = self ._dummy_decorator ("heuristics" )
27
+ self .language = TritonLanguagePlaceholder ()
28
+ logger .warning_once (
29
+ "Triton is not installed. Using dummy decorators. "
30
+ "Install it via `pip install triton` to enable kernel"
31
+ " compilation." )
32
+
33
+ def _dummy_decorator (self , name ):
34
+
35
+ def decorator (* args , ** kwargs ):
36
+ if args and callable (args [0 ]):
37
+ return args [0 ]
38
+ return lambda f : f
39
+
40
+ return decorator
41
+
42
+
43
+ class TritonLanguagePlaceholder (types .ModuleType ):
44
+
45
+ def __init__ (self ):
46
+ super ().__init__ ("triton.language" )
47
+ self .constexpr = None
48
+ self .dtype = None
49
+ self .int64 = None
0 commit comments