Skip to content

Commit 05ce648

Browse files
committed
upd
1 parent a841721 commit 05ce648

File tree

3 files changed

+17
-28
lines changed

3 files changed

+17
-28
lines changed

flashinfer-cubin/build_backend.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,8 @@
1313

1414
from build_utils import get_git_version
1515

16-
17-
# add flashinfer._build_meta, always override to ensure version is up-to-date
18-
build_meta_file = Path(__file__).parent.parent / "flashinfer" / "_build_meta.py"
19-
version_file = Path(__file__).parent.parent / "version.txt"
20-
if version_file.exists():
21-
with open(version_file, "r") as f:
22-
version = f.read().strip()
23-
git_version = get_git_version(cwd=Path(__file__).parent.parent)
24-
with open(build_meta_file, "w") as f:
25-
f.write('"""Build metadata for flashinfer package."""\n')
26-
f.write(f'__version__ = "{version}"\n')
27-
f.write(f'__git_version__ = "{git_version}"\n')
16+
# Skip version check when building flashinfer-cubin package
17+
os.environ["FLASHINFER_DISABLE_VERSION_CHECK"] = "1"
2818

2919

3020
def _download_cubins():

flashinfer-jit-cache/build_backend.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,8 @@
2626

2727
from build_utils import get_git_version
2828

29-
30-
# add flashinfer._build_meta, always override to ensure version is up-to-date
31-
build_meta_file = Path(__file__).parent.parent / "flashinfer" / "_build_meta.py"
32-
version_file = Path(__file__).parent.parent / "version.txt"
33-
if version_file.exists():
34-
with open(version_file, "r") as f:
35-
version = f.read().strip()
36-
git_version = get_git_version(cwd=Path(__file__).parent.parent)
37-
with open(build_meta_file, "w") as f:
38-
f.write('"""Build metadata for flashinfer package."""\n')
39-
f.write(f'__version__ = "{version}"\n')
40-
f.write(f'__git_version__ = "{git_version}"\n')
29+
# Skip version check when building flashinfer-jit-cache package
30+
os.environ["FLASHINFER_DISABLE_VERSION_CHECK"] = "1"
4131

4232

4333
def _create_build_metadata():

flashinfer/jit/env.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,16 @@ def _get_cubin_dir():
4444
import flashinfer_cubin
4545

4646
flashinfer_cubin_version = flashinfer_cubin.__version__
47-
if flashinfer_version != flashinfer_cubin_version:
47+
# Allow bypassing version check with environment variable
48+
if (
49+
not os.getenv("FLASHINFER_DISABLE_VERSION_CHECK")
50+
and flashinfer_version != flashinfer_cubin_version
51+
):
4852
raise RuntimeError(
4953
f"flashinfer-cubin version ({flashinfer_cubin_version}) does not match "
5054
f"flashinfer version ({flashinfer_version}). "
51-
"Please install the same version of both packages."
55+
"Please install the same version of both packages. "
56+
"Set FLASHINFER_DISABLE_VERSION_CHECK=1 to bypass this check."
5257
)
5358

5459
return pathlib.Path(flashinfer_cubin.get_cubin_dir())
@@ -78,11 +83,15 @@ def _get_aot_dir():
7883
flashinfer_jit_cache_version = flashinfer_jit_cache.__version__
7984
# NOTE(Zihao): we don't use exact version match here because the version of flashinfer-jit-cache
8085
# contains the CUDA version suffix: e.g. 0.3.1+cu129.
81-
if not flashinfer_jit_cache_version.startswith(flashinfer_version):
86+
# Allow bypassing version check with environment variable
87+
if not os.getenv(
88+
"FLASHINFER_DISABLE_VERSION_CHECK"
89+
) and not flashinfer_jit_cache_version.startswith(flashinfer_version):
8290
raise RuntimeError(
8391
f"flashinfer-jit-cache version ({flashinfer_jit_cache_version}) does not match "
8492
f"flashinfer version ({flashinfer_version}). "
85-
"Please install the same version of both packages."
93+
"Please install the same version of both packages. "
94+
"Set FLASHINFER_DISABLE_VERSION_CHECK=1 to bypass this check."
8695
)
8796

8897
return pathlib.Path(flashinfer_jit_cache.get_jit_cache_dir())

0 commit comments

Comments
 (0)