1616import os
1717import warnings
1818
19+ from . import comm , config , functional
20+ from .dist_attn_runtime_mgr import (
21+ init_dist_attn_runtime_key ,
22+ init_dist_attn_runtime_mgr ,
23+ )
24+
25+ if importlib .util .find_spec ("magi_attention._version" ) is None :
26+ warnings .warn (
27+ "You are using magi_attention without installing it. This may cause some unexpected errors."
28+ )
29+ version = None
30+ else :
31+ from ._version import __version__ as git_version
32+
33+ version = git_version
34+
35+ __version__ : str | None = version
36+
1937
2038def is_sanity_check_enable () -> bool :
2139 """
@@ -85,17 +103,6 @@ def is_profile_mode_enable() -> bool:
85103 return os .environ .get ("MAGI_ATTENTION_PROFILE_MODE" , "0" ) == "1"
86104
87105
88- def is_cpp_backend_enable () -> bool :
89- """
90- Toggle this env variable to ``1`` to enable C++ backend
91- for core data structures (AttnRange, AttnMaskType, etc.)
92- and fall back to Python implementation.
93-
94- Default value is ``0``
95- """
96- return os .environ .get ("MAGI_ATTENTION_CPP_BACKEND" , "0" ) == "1"
97-
98-
99106def dist_attn_runtime_dict_size () -> int :
100107 """
101108 Set the value of this env variable to control
@@ -106,31 +113,13 @@ def dist_attn_runtime_dict_size() -> int:
106113 return int (os .environ .get ("MAGI_ATTENTION_DIST_ATTN_RUNTIME_DICT_SIZE" , "1000" ))
107114
108115
109- from . import comm , config , functional # noqa: E402
110- from .dist_attn_runtime_mgr import ( # noqa: E402
111- init_dist_attn_runtime_key ,
112- init_dist_attn_runtime_mgr ,
113- )
114-
115- if importlib .util .find_spec ("magi_attention._version" ) is None :
116- warnings .warn (
117- "You are using magi_attention without installing it. This may cause some unexpected errors."
118- )
119- version = None
120- else :
121- from ._version import __version__ as git_version
122-
123- version = git_version
124-
125- __version__ : str | None = version
126-
127116__all__ = [
128117 "init_dist_attn_runtime_key" ,
129118 "init_dist_attn_runtime_mgr" ,
130119 "is_sanity_check_enable" ,
131120 "is_flatten_head_groups_enable" ,
132121 "is_cuda_device_max_connections_one" ,
133- "is_cpp_backend_enable " ,
122+ "dist_attn_runtime_dict_size " ,
134123 "config" ,
135124 "comm" ,
136125 "functional" ,
0 commit comments