Skip to content

Commit 5035652

Browse files
authored
bugfix: Cast build paths to str before setuputils Extension (#1058)
Before, when building wheel with AOT enabled: ``` ... return _build_backend().build_wheel( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/dist-packages/setuptools/build_meta.py", line 415, in build_wheel return self._build_with_temp_dir( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/dist-packages/setuptools/build_meta.py", line 397, in _build_with_temp_dir self.run_setup() File "/usr/local/lib/python3.12/dist-packages/setuptools/build_meta.py", line 313, in run_setup exec(code, locals()) File "<string>", line 275, in <module> File "/usr/local/lib/python3.12/dist-packages/torch/utils/cpp_extension.py", line 1207, in CUDAExtension return setuptools.Extension(name, sources, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/dist-packages/setuptools/extension.py", line 133, in __init__ super().__init__(name, sources, *args, **kw) File "/usr/local/lib/python3.12/dist-packages/setuptools/_distutils/extension.py", line 111, in __init__ raise AssertionError("'sources' must be a list of strings") AssertionError: 'sources' must be a list of strings ... ``` Due to `setuptools/_distutils/extension.py`: ``` ... if not isinstance(name, str): raise AssertionError("'name' must be a string") if not (isinstance(sources, list) and all(isinstance(v, str) for v in sources)): raise AssertionError("'sources' must be a list of strings") ... ```
1 parent 3dd02a5 commit 5035652

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

setup.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,11 +265,13 @@ def __init__(self, *args, **kwargs) -> None:
265265
"csrc/group_gemm_e4m3_bf16_sm90.cu",
266266
"csrc/group_gemm_e5m2_bf16_sm90.cu",
267267
]
268-
decode_sources = list(gen_dir.glob("*decode_head*.cu"))
268+
decode_sources = [str(path) for path in gen_dir.glob("*decode_head*.cu")]
269269
prefill_sources = [
270-
f for f in gen_dir.glob("*prefill_head*.cu") if "_sm90" not in f.name
270+
str(f) for f in gen_dir.glob("*prefill_head*.cu") if "_sm90" not in f.name
271+
]
272+
prefill_sm90_sources = [
273+
str(path) for path in gen_dir.glob("*prefill_head*_sm90.cu")
271274
]
272-
prefill_sm90_sources = list(gen_dir.glob("*prefill_head*_sm90.cu"))
273275
ext_modules = [
274276
torch_cpp_ext.CUDAExtension(
275277
name="flashinfer.flashinfer_kernels",

0 commit comments

Comments
 (0)