Skip to content

Commit 1294598

Browse files
committed
Remove the logic for bundling tileiras into wheel
Signed-off-by: Jay Gu <jagu@nvidia.com>
1 parent cbda484 commit 1294598

File tree

3 files changed

+12
-68
lines changed

3 files changed

+12
-68
lines changed

setup.py

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,8 @@
22
#
33
# SPDX-License-Identifier: Apache-2.0
44
from distutils import file_util
5-
import shutil
6-
75
from setuptools import setup
86
from setuptools.command.build_ext import build_ext
9-
from setuptools.command.bdist_wheel import bdist_wheel
107
from setuptools.extension import Extension
118
import os
129
import sys
@@ -76,51 +73,6 @@ def run(self):
7673
dry_run=self.dry_run)
7774

7875

79-
class BdistWheelWithDeps(bdist_wheel):
80-
user_options = bdist_wheel.user_options + [
81-
('include-tileir', None, 'Include tileir dependency in the package'),
82-
('tileir-deps=', None, 'Path to extra tileir dependency to package'),
83-
]
84-
85-
def initialize_options(self):
86-
super().initialize_options()
87-
self.include_tileir = False
88-
self.tileir_deps = None
89-
90-
def finalize_options(self):
91-
super().finalize_options()
92-
93-
def _copy_tileir_deps(self, src, dst):
94-
bin_dir = os.path.join(dst, 'bin')
95-
lib_dir = os.path.join(dst, 'lib')
96-
file_util.copy_file(os.path.join(src, 'tileiras'), bin_dir,
97-
dry_run=self.dry_run)
98-
file_util.copy_file(os.path.join(src, 'ptxas'), bin_dir,
99-
dry_run=self.dry_run)
100-
file_util.copy_file(os.path.join(src, 'libnvvm.so'), lib_dir,
101-
dry_run=self.dry_run)
102-
103-
def run(self):
104-
build_py = self.get_finalized_command('build_py')
105-
build_lib = build_py.build_lib
106-
dst_dir = os.path.join(build_lib, 'cuda', 'tile', '_deps')
107-
dst_bin_dir = os.path.join(dst_dir, 'bin')
108-
dst_lib_dir = os.path.join(dst_dir, 'lib')
109-
if self.include_tileir:
110-
os.makedirs(dst_bin_dir, exist_ok=True)
111-
os.makedirs(dst_lib_dir, exist_ok=True)
112-
if self.tileir_deps:
113-
src_dir = os.path.abspath(self.tileir_deps)
114-
self._copy_tileir_deps(src_dir, dst_dir)
115-
else:
116-
compiler_src = shutil.which('tileiras')
117-
if compiler_src is None:
118-
raise FileNotFoundError("Cannot find `tileiras`. Make sure it is in PATH.")
119-
file_util.copy_file(compiler_src, dst_bin_dir, update=True, dry_run=self.dry_run)
120-
121-
super().run()
122-
123-
12476
def _get_csrc_dir(ext_name: str):
12577
prefix = "cuda.tile._"
12678
assert ext_name.startswith(prefix)
@@ -141,6 +93,5 @@ def _get_build_lib_filename(ext_name: str):
14193
],
14294
cmdclass=dict(
14395
build_ext=BuildExtWithCmake,
144-
bdist_wheel=BdistWheelWithDeps
14596
)
14697
)

src/cuda/tile/_compile.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -319,12 +319,6 @@ def _get_cuda_home() -> Optional[str]:
319319
return os.environ.get("CUDA_HOME")
320320

321321

322-
def _local_deps_dir():
323-
import cuda.tile
324-
package_dir = os.path.dirname(os.path.abspath(cuda.tile.__file__))
325-
return os.path.join(package_dir, '_deps')
326-
327-
328322
@dataclass
329323
class _CompilerBinary:
330324
path: str
@@ -410,19 +404,9 @@ def _find_pip_tileiras() -> Optional[str]:
410404

411405
@cache
412406
def _find_compiler_bin() -> _CompilerBinary:
413-
# search under cuda/tile/_deps
414407
bin_path = os.environ.get('PATH', '')
415408
ld_path = os.environ.get('LD_LIBRARY_PATH', "") if not is_windows() else ""
416409

417-
deps_bin_dir = os.path.join(_local_deps_dir(), 'bin')
418-
deps_lib_dir = os.path.join(_local_deps_dir(), 'lib')
419-
if os.path.exists(deps_bin_dir):
420-
logger.debug(f"Searching tileiras: {deps_bin_dir}")
421-
if (res := shutil.which("tileiras", path=deps_bin_dir)):
422-
bin_path = deps_bin_dir + ":" + bin_path
423-
ld_path = deps_lib_dir + ":" + ld_path
424-
return _CompilerBinary(res, bin_path, ld_path, pass_cuda_home_var=False)
425-
426410
# search from nvidia-cuda-tileiras pip package
427411
logger.debug("Searching tileiras from nvidia pip package")
428412
res = _find_pip_tileiras()

test/conftest.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
from functools import cache
1313

1414
from cuda.tile._bytecode.version import BytecodeVersion
15-
from cuda.tile._compile import _get_max_supported_bytecode_version
15+
from cuda.tile._compile import _get_max_supported_bytecode_version, _SUPPORTED_VERSIONS
16+
from cuda.tile._cext import dev_features_enabled
1617

1718

1819
def pytest_addoption(parser):
@@ -45,11 +46,19 @@ def get_tileiras_version():
4546

4647
def requires_tileiras(version: BytecodeVersion):
4748
"""Skip test if tileiras version is lower than required."""
49+
50+
def vstr(v):
51+
return f"{v.major()}.{v.minor()}"
52+
53+
if version not in _SUPPORTED_VERSIONS and not dev_features_enabled():
54+
return pytest.mark.skip(
55+
reason=f"Requires dev features enabled for version {vstr(version)}"
56+
)
57+
4858
current = get_tileiras_version()
4959
return pytest.mark.skipif(
5060
current < version,
51-
reason=f"Requires tileiras {version.major()}.{version.minor()}, "
52-
f"found {current.major()}.{current.minor()}"
61+
reason=f"Requires tileiras {vstr(version)}, found {vstr(current)}"
5362
)
5463

5564

0 commit comments

Comments
 (0)