Skip to content

Commit d589da7

Browse files
authored
[SPEC] Fix spec language | compiler | triton | gluon init (#790)
* [SPEC] Fix spec language init * [SPEC] Fix spec compiler & triton init * [SPEC] Fix spec gluon init * [SPEC] Fix spec gluon
1 parent 89a3666 commit d589da7

37 files changed

Lines changed: 2052 additions & 127 deletions

File tree

python/triton/__init__.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
"""isort:skip_file"""
22
__version__ = '3.6.0'
33

4+
from triton.flagtree_spec import spec
5+
46
# ---------------------------------------
57
# Note: import order is significant here.
68

@@ -19,21 +21,19 @@
1921
)
2022
from .runtime.jit import constexpr_function, jit
2123
from .runtime._async_compile import AsyncCompileMode, FutureKernel
22-
from .compiler import compile, CompilationError, max_shared_mem
24+
from .compiler import compile, CompilationError
2325
from .errors import TritonError
2426
from .runtime._allocation import set_allocator
2527

2628
from . import language
2729
from . import testing
2830
from . import tools
2931

30-
# flagtree backend language extension
31-
from .flagtree_spec import spec
32-
33-
spec("init_language")
34-
3532
must_use_result = language.core.must_use_result
3633

34+
# flagtree backend specialization
35+
spec("triton_extend_globals", globals())
36+
3737
__all__ = [
3838
"AsyncCompileMode",
3939
"autotune",
@@ -49,7 +49,6 @@
4949
"JITFunction",
5050
"KernelInterface",
5151
"language",
52-
"max_shared_mem",
5352
"MockTensor",
5453
"must_use_result",
5554
"next_power_of_2",

python/triton/_filecheck.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,14 @@
1010
from triton.experimental.gluon._runtime import GluonASTSource
1111
from triton.runtime.jit import create_function_from_signature
1212
from triton._C.libtriton import ir
13+
from triton.flagtree_spec import spec
1314

1415
# ===-----------------------------------------------------------------------===#
1516
# filecheck_test
1617
# ===-----------------------------------------------------------------------===#
1718

1819
# Stub target for testing the frontend.
19-
# flagtree backend path specialization
20-
from triton.flagtree_spec import spec
21-
20+
# flagtree backend specialization
2221
stub_target = spec("spec_get_stub_target")
2322
if not stub_target:
2423
stub_target = GPUTarget("cuda", 100, 32)

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+
from .compiler import CompiledKernel, ASTSource, IRSource, compile, make_backend, LazyDict, get_cache_key
77
from .errors import CompilationError
88

9+
# flagtree backend specialization
10+
spec("compiler_extend_globals", globals())
11+
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: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1-
# flagtree backend path specialization
21
from triton.flagtree_spec import spec_path
32

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

6-
from triton._flagtree_backend import FLAGTREE_BACKEND
6+
from ._runtime import constexpr_function, jit
7+
from triton.language.core import must_use_result
78
from . import nvidia
8-
# flagtree backend path specialization
9-
if FLAGTREE_BACKEND == "hcu":
9+
from triton._flagtree_backend import FLAGTREE_BACKEND
10+
if FLAGTREE_BACKEND == "hcu": # flagtree hcu
1011
from . import hcu
1112
else:
1213
from . import amd
13-
from ._runtime import constexpr_function, jit
14-
from triton.language.core import must_use_result
1514

1615
__all__ = ["constexpr_function", "jit", "must_use_result", "nvidia", "hcu" if FLAGTREE_BACKEND == "hcu" else "amd"]

python/triton/experimental/gluon/amd/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from triton.flagtree_spec import spec_path
22

3+
# flagtree backend path specialization
34
spec_path(__path__)
45

56
from . import gfx1250

python/triton/experimental/gluon/language/__init__.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
from triton.flagtree_spec import spec_path
2-
3-
spec_path(__path__)
4-
51
from ._core import (
62
base_value,
73
base_type,

python/triton/experimental/gluon/language/nvidia/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from triton.flagtree_spec import spec_path
22

3+
# flagtree backend path specialization
34
spec_path(__path__)
45

56
from . import blackwell

python/triton/experimental/gluon/nvidia/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from triton.flagtree_spec import spec_path
22

3+
# flagtree backend path specialization
34
spec_path(__path__)
45

56
from . import hopper

python/triton/language/__init__.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
"""isort:skip_file"""
22
# Import order is significant here.
33

4-
# flagtree backend path specialization
5-
from triton.flagtree_spec import spec_path
4+
from triton.flagtree_spec import spec_path, spec
65

6+
# flagtree backend path specialization
77
spec_path(__path__)
88

99
from . import math
@@ -115,7 +115,6 @@
115115
store,
116116
sub,
117117
tensor,
118-
to_tensor,
119118
trans,
120119
tuple,
121120
tuple_type,
@@ -143,6 +142,9 @@
143142
)
144143
from . import target_info
145144

145+
# flagtree backend specialization
146+
spec("language_extend_globals", globals())
147+
146148
__all__ = [
147149
"PropagateNan",
148150
"TRITON_MAX_TENSOR_NUMEL",
@@ -270,7 +272,6 @@
270272
"swizzle2d",
271273
"target_info",
272274
"tensor",
273-
"to_tensor",
274275
"topk",
275276
"trans",
276277
"tuple",

python/triton/runtime/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# flagtree backend path specialization
21
from triton.flagtree_spec import spec_path
32

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

66
from .autotuner import (Autotuner, Config, Heuristics, autotune, heuristics)

0 commit comments

Comments
 (0)