ref(upstream): FULL TREE — Deep-Spark xllm (1470) + ds_vllm csrc/models (703)
Replaces cherry-picked upstream_ref with complete source trees. xllm/ — Iluvatar official C++ inference engine (15MB, 1470 files) Complete: kernels → layers → models → runtime → scheduler → api Excluded: .git, binary images, third_party submodule checkouts ds_vllm/ — Iluvatar official vllm fork (8MB, 703 files) Included: csrc/ (ALL CUDA kernels), fused_moe/, qwen3_5 model, _custom_ops Excluded: tests, benchmarks, docs, examples (not needed for reference) Critical call chains now fully traceable: MoE: moe_topk_softmax_kernels.cuh → ixformer.h → fused_moe.cpp → layer GDN: qwen3_gated_delta_net_base.cpp → qwen3_5_gated_delta_net.cpp Attention: ixformer.h → xllm_paged_attention → attention.cpp
This commit is contained in:
104
upstream_ref/xllm/cmake/cc_shared_library.cmake
Normal file
104
upstream_ref/xllm/cmake/cc_shared_library.cmake
Normal file
@@ -0,0 +1,104 @@
|
||||
include(CMakeParseArguments)
|
||||
|
||||
# inspired by https://github.com/abseil/abseil-cpp
|
||||
# cc_shared_library()
|
||||
# CMake function to imitate Bazel's cc_shared_library rule.
|
||||
#
|
||||
# Parameters:
|
||||
# NAME: name of target
|
||||
# HDRS: List of public header files for the library
|
||||
# SRCS: List of source files for the library
|
||||
# DEPS: List of other libraries to be linked in to the binary targets
|
||||
# COPTS: List of private compile options
|
||||
# DEFINES: List of public defines
|
||||
# LINKOPTS: List of link options
|
||||
#
|
||||
# cc_library(
|
||||
# NAME
|
||||
# awesome
|
||||
# HDRS
|
||||
# "a.h"
|
||||
# SRCS
|
||||
# "a.cc"
|
||||
# )
|
||||
# cc_shared_library(
|
||||
# NAME
|
||||
# fantastic_lib
|
||||
# SRCS
|
||||
# "b.cc"
|
||||
# DEPS
|
||||
# :awesome
|
||||
# )
|
||||
#
|
||||
function(cc_shared_library)
|
||||
cmake_parse_arguments(
|
||||
CC_LIB # prefix
|
||||
"TESTONLY" # options
|
||||
"NAME" # one value args
|
||||
"HDRS;SRCS;COPTS;DEFINES;LINKOPTS;DEPS;INCLUDES" # multi value args
|
||||
${ARGN}
|
||||
)
|
||||
|
||||
if(CC_LIB_TESTONLY AND (NOT BUILD_TESTING))
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Check if this is a header only library
|
||||
set(_CC_SRCS "${CC_LIB_SRCS}")
|
||||
foreach(src_file IN LISTS _CC_SRCS)
|
||||
if(${src_file} MATCHES ".*\\.(h|inc)")
|
||||
list(REMOVE_ITEM _CC_SRCS "${src_file}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(_CC_SRCS STREQUAL "")
|
||||
set(CC_LIB_IS_INTERFACE 1)
|
||||
else()
|
||||
set(CC_LIB_IS_INTERFACE 0)
|
||||
endif()
|
||||
|
||||
if(NOT CC_LIB_IS_INTERFACE)
|
||||
add_library(${CC_LIB_NAME} SHARED)
|
||||
target_sources(${CC_LIB_NAME}
|
||||
PRIVATE ${CC_LIB_SRCS} ${CC_LIB_HDRS})
|
||||
|
||||
target_compile_options(${CC_LIB_NAME} PRIVATE
|
||||
-fvisibility=hidden
|
||||
-fvisibility-inlines-hidden
|
||||
)
|
||||
|
||||
target_link_options(${CC_LIB_NAME} PRIVATE
|
||||
-Wl,--exclude-libs,ALL
|
||||
-Wl,--no-undefined
|
||||
)
|
||||
target_link_options(${CC_LIB_NAME} PRIVATE -Wl,--whole-archive)
|
||||
target_link_libraries(${CC_LIB_NAME}
|
||||
PUBLIC ${CC_LIB_DEPS}
|
||||
PRIVATE ${CC_LIB_LINKOPTS}
|
||||
)
|
||||
target_link_options(${CC_LIB_NAME} PRIVATE -Wl,--no-whole-archive)
|
||||
target_include_directories(${CC_LIB_NAME}
|
||||
PUBLIC
|
||||
"$<BUILD_INTERFACE:${COMMON_INCLUDE_DIRS}>"
|
||||
${CC_LIB_INCLUDES}
|
||||
)
|
||||
target_compile_options(${CC_LIB_NAME} PRIVATE ${CC_LIB_COPTS})
|
||||
target_compile_definitions(${CC_LIB_NAME} PUBLIC ${CC_LIB_DEFINES})
|
||||
else()
|
||||
# Generating header only library
|
||||
add_library(${CC_LIB_NAME} INTERFACE)
|
||||
target_include_directories(${CC_LIB_NAME}
|
||||
INTERFACE
|
||||
"$<BUILD_INTERFACE:${COMMON_INCLUDE_DIRS}>"
|
||||
${CC_LIB_INCLUDES}
|
||||
)
|
||||
|
||||
target_link_libraries(${CC_LIB_NAME}
|
||||
INTERFACE ${CC_LIB_DEPS} ${CC_LIB_LINKOPTS}
|
||||
)
|
||||
target_compile_definitions(${CC_LIB_NAME} INTERFACE ${CC_LIB_DEFINES})
|
||||
endif()
|
||||
|
||||
# add alias for the library target
|
||||
add_library(:${CC_LIB_NAME} ALIAS ${CC_LIB_NAME})
|
||||
endfunction()
|
||||
Reference in New Issue
Block a user