Skip to content

Commit 1afff4a

Browse files
committed
[SPEC] Fix spec compiler & triton init
1 parent d3b025b commit 1afff4a

4 files changed

Lines changed: 23 additions & 7 deletions

File tree

python/triton/__init__.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
# ---------------------------------------
55
# Note: import order is significant here.
66

7+
# flagtree backend specialization
8+
from triton.flagtree_spec import spec
9+
spec("triton_extend_globals", globals())
10+
711
# submodules
812
from .runtime import (
913
autotune,
@@ -19,7 +23,7 @@
1923
)
2024
from .runtime.jit import constexpr_function, jit
2125
from .runtime._async_compile import AsyncCompileMode, FutureKernel
22-
from .compiler import compile, CompilationError, max_shared_mem
26+
from .compiler import compile, CompilationError
2327
from .errors import TritonError
2428
from .runtime._allocation import set_allocator
2529

@@ -44,7 +48,6 @@
4448
"JITFunction",
4549
"KernelInterface",
4650
"language",
47-
"max_shared_mem",
4851
"MockTensor",
4952
"must_use_result",
5053
"next_power_of_2",

python/triton/compiler/__init__.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
# flagtree backend path specialization
2-
from triton.flagtree_spec import spec_path
1+
from triton.flagtree_spec import spec_path, spec
32

3+
# flagtree backend path specialization
44
spec_path(__path__)
55

6-
from .compiler import CompiledKernel, ASTSource, IRSource, compile, make_backend, LazyDict, get_cache_key, max_shared_mem
6+
# flagtree backend specialization
7+
spec("compiler_extend_globals", globals())
8+
9+
from .compiler import CompiledKernel, ASTSource, IRSource, compile, make_backend, LazyDict, get_cache_key
710
from .errors import CompilationError
811

912
__all__ = [
1013
"compile", "make_backend", "ASTSource", "IRSource", "CompiledKernel", "CompilationError", "LazyDict",
11-
"get_cache_key", "max_shared_mem"
14+
"get_cache_key"
1215
]
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1-
from ._filecheck import spec_get_stub_target
21
from ._utils import apply_with_path, _tuple_create
2+
from ._filecheck import spec_get_stub_target
3+
from .compiler import compiler_extend_globals
34
from .language import language_extend_globals
5+
6+
def triton_extend_globals(globals_dict):
7+
# NOTE: Must use absolute path import.
8+
from triton.compiler.compiler import max_shared_mem
9+
globals_dict["max_shared_mem"] = max_shared_mem
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
def compiler_extend_globals(globals_dict):
2+
# NOTE: Must use absolute path import.
3+
from triton.compiler.compiler import max_shared_mem
4+
globals_dict["max_shared_mem"] = max_shared_mem

0 commit comments

Comments
 (0)