Skip to content

Commit 1dd5038

Browse files
committed
Use torch custom op instead of pybind
Signed-off-by: qizixi <[email protected]>
1 parent e45036e commit 1dd5038

File tree

12 files changed

+1183
-1758
lines changed

12 files changed

+1183
-1758
lines changed

CMakeLists.txt

Lines changed: 8 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -948,38 +948,14 @@ set(VLLM_SUFFIX_CACHE_EXT_SRC
948948
"csrc/suffix_cache/suffix_tree.cc")
949949

950950
message(STATUS "Enabling suffix_cache extension.")
951-
add_library(
952-
_suffix_cache_C MODULE
953-
${VLLM_SUFFIX_CACHE_EXT_SRC}
954-
)
955-
956-
# Set properties for the suffix_cache extension
957-
set_target_properties(_suffix_cache_C PROPERTIES
958-
CXX_STANDARD 17
959-
CXX_STANDARD_REQUIRED ON
960-
)
961-
962-
# Include directories
963-
target_include_directories(_suffix_cache_C PRIVATE
964-
csrc
965-
)
966-
967-
# Link against torch and python
968-
target_link_libraries(_suffix_cache_C PRIVATE
969-
torch
970-
${TORCH_PYTHON_LIBRARY}
971-
)
972-
973-
# Set output name without lib prefix
974-
set_target_properties(_suffix_cache_C PROPERTIES
975-
PREFIX ""
976-
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/vllm"
977-
)
978-
979-
# Install the extension
980-
install(TARGETS _suffix_cache_C
981-
LIBRARY DESTINATION vllm
982-
COMPONENT _suffix_cache_C
951+
define_gpu_extension_target(
952+
_suffix_cache_C
953+
DESTINATION vllm
954+
LANGUAGE CXX
955+
SOURCES ${VLLM_SUFFIX_CACHE_EXT_SRC}
956+
COMPILE_FLAGS ${CXX_COMPILE_FLAGS}
957+
USE_SABI 3
958+
WITH_SOABI
983959
)
984960

985961
if(VLLM_GPU_LANG STREQUAL "HIP")

0 commit comments

Comments
 (0)