[Build] Add OpenAI triton_kernels (#28788)
Signed-off-by: Varun Sundar Rabindranath <vsundarr@redhat.com> Co-authored-by: Varun Sundar Rabindranath <vsundarr@redhat.com>
This commit is contained in:
committed by
GitHub
parent
49ef847aa8
commit
9912b8ccb8
17
setup.py
17
setup.py
@@ -299,6 +299,20 @@ class cmake_build_ext(build_ext):
|
||||
os.makedirs(os.path.dirname(dst_file), exist_ok=True)
|
||||
self.copy_file(file, dst_file)
|
||||
|
||||
if _is_cuda() or _is_hip():
|
||||
# copy vllm/third_party/triton_kernels/**/*.py from self.build_lib
|
||||
# to current directory so that they can be included in the editable
|
||||
# build
|
||||
print(
|
||||
f"Copying {self.build_lib}/vllm/third_party/triton_kernels "
|
||||
"to vllm/third_party/triton_kernels"
|
||||
)
|
||||
shutil.copytree(
|
||||
f"{self.build_lib}/vllm/third_party/triton_kernels",
|
||||
"vllm/third_party/triton_kernels",
|
||||
dirs_exist_ok=True,
|
||||
)
|
||||
|
||||
|
||||
class precompiled_build_ext(build_ext):
|
||||
"""Disables extension building when using precompiled binaries."""
|
||||
@@ -633,6 +647,9 @@ ext_modules = []
|
||||
if _is_cuda() or _is_hip():
|
||||
ext_modules.append(CMakeExtension(name="vllm._moe_C"))
|
||||
ext_modules.append(CMakeExtension(name="vllm.cumem_allocator"))
|
||||
# Optional since this doesn't get built (produce an .so file). This is just
|
||||
# copying the relevant .py files from the source repository.
|
||||
ext_modules.append(CMakeExtension(name="vllm.triton_kernels", optional=True))
|
||||
|
||||
if _is_hip():
|
||||
ext_modules.append(CMakeExtension(name="vllm._rocm_C"))
|
||||
|
||||
Reference in New Issue
Block a user