A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 16, 09:30 UTC
[Build] Fix `FetchContent` multiple build issue (#9596)
Signed-off-by: luka <luka@neuralmagic.com>
Luka Govedič committed
Oct 23, 2024 at 00:43 UTC
51c24c9736b1dbe65cb203deb9e56d4037eb1ec6
2 files changed
+14
-4
CMakeLists.txt
+6
-4
@@ -169,12 +169,12 @@ endif()
169
170
#
171
# Use FetchContent for C++ dependencies that are compiled as part of vLLM's build process.
172
-# Configure it to place files in vllm/.deps, in order to play nicely with sccache.
172
+# setup.py will override FETCHCONTENT_BASE_DIR to play nicely with sccache.
173
+# Each dependency that produces build artifacts should override its BINARY_DIR to avoid
174
+# conflicts between build types. It should instead be set to ${CMAKE_BINARY_DIR}/<dependency>.
175
#
176
include(FetchContent)
175
-get_filename_component(PROJECT_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}" ABSOLUTE)
176
-file(MAKE_DIRECTORY "${FETCHCONTENT_BASE_DIR}")
177
-set(FETCHCONTENT_BASE_DIR "${PROJECT_ROOT_DIR}/.deps")
177
+file(MAKE_DIRECTORY ${FETCHCONTENT_BASE_DIR}) # Ensure the directory exists
178
message(STATUS "FetchContent base directory: ${FETCHCONTENT_BASE_DIR}")
179
180
#
@@ -509,6 +509,8 @@ else()
509
GIT_REPOSITORY https://github.com/vllm-project/flash-attention.git
510
GIT_TAG 013f0c4fc47e6574060879d9734c1df8c5c273bd
511
GIT_PROGRESS TRUE
512
+ # Don't share the vllm-flash-attn build between build types
513
+ BINARY_DIR ${CMAKE_BINARY_DIR}/vllm-flash-attn
514
)
515
endif()
516
setup.py
+8
@@ -157,6 +157,14 @@ class cmake_build_ext(build_ext):
157
# on subsequent calls to python.
158
cmake_args += ['-DVLLM_PYTHON_PATH={}'.format(":".join(sys.path))]
159
160
+ # Override the base directory for FetchContent downloads to $ROOT/.deps
161
+ # This allows sharing dependencies between profiles,
162
+ # and plays more nicely with sccache.
163
+ # To override this, set the FETCHCONTENT_BASE_DIR environment variable.
164
+ fc_base_dir = os.path.join(ROOT_DIR, ".deps")
165
+ fc_base_dir = os.environ.get("FETCHCONTENT_BASE_DIR", fc_base_dir)
166
+ cmake_args += ['-DFETCHCONTENT_BASE_DIR={}'.format(fc_base_dir)]
167
+
168
#
169
# Setup parallelism and build tool
170
#