Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -946,6 +946,17 @@ if(DFLASH27B_TESTS)
${CMAKE_CURRENT_SOURCE_DIR}/deps/llama.cpp/ggml/include)
target_link_libraries(bench_rocmfp_mix_gateup_glu PRIVATE
ggml ggml-base ${DFLASH27B_GGML_BACKEND_TARGET} hip::host)

# Benchmark, not a test: compares the generic segmented full sort with
# the exact two-stage block-radix TOP_K used by the DS4 long-context
# indexer. It also checks selected-index set parity at every tile count.
add_executable(bench_ds4_topk test/bench_ds4_topk.cpp)
set_source_files_properties(test/bench_ds4_topk.cpp PROPERTIES LANGUAGE HIP)
set_target_properties(bench_ds4_topk PROPERTIES HIP_ARCHITECTURES "${_dflash_archs}")
target_include_directories(bench_ds4_topk PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/deps/llama.cpp/ggml/include)
target_link_libraries(bench_ds4_topk PRIVATE
ggml ggml-base ${DFLASH27B_GGML_BACKEND_TARGET} hip::host)
endif()
add_executable(test_qwen35_tensor_parallel test/test_qwen35_tensor_parallel.cpp)
target_include_directories(test_qwen35_tensor_parallel PRIVATE ${DFLASH27B_SRC_INCLUDE_DIRS})
Expand Down Expand Up @@ -1572,6 +1583,7 @@ if(DFLASH27B_TESTS)
test/test_server_unit.cpp
test/test_anchor_params.cpp
test/test_derived_scalars.cpp
test/test_adaptive_spec_width.cpp
test/test_adaptive_keep_ratio.cpp
test/test_skip_park_guard.cpp
test/test_bandit_integration.cpp
Expand Down Expand Up @@ -1955,6 +1967,16 @@ if(DFLASH27B_TESTS)
add_dependencies(check test_concat_transpose)
endif()
endif()
if((DFLASH27B_GPU_BACKEND STREQUAL "cuda" OR
DFLASH27B_GPU_BACKEND STREQUAL "hip")
AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/test_moe_combine.cpp")
dflash_add_ggml_gpu_executable(
test_moe_combine test/test_moe_combine.cpp)
add_test(NAME moe_combine COMMAND test_moe_combine)
if(TARGET check)
add_dependencies(check test_moe_combine)
endif()
endif()
if((DFLASH27B_GPU_BACKEND STREQUAL "cuda" OR
DFLASH27B_GPU_BACKEND STREQUAL "hip")
AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/bench_paged_attention.cpp")
Expand Down
11 changes: 11 additions & 0 deletions server/deps/llama.cpp/ggml/include/ggml.h
Original file line number Diff line number Diff line change
Expand Up @@ -2560,6 +2560,17 @@ extern "C" {
int64_t ff_dim,
int64_t n_expert_used);

// Apply one routing weight to every expert output column and reduce the
// expert axis. `experts` is [n_embd, n_used, n_tokens] and
// `expert_weights` is [n_used, n_tokens]. Backends may fuse the weighting
// and reduction into one kernel.
GGML_API struct ggml_tensor * ggml_moe_combine(
struct ggml_context * ctx,
struct ggml_tensor * experts,
struct ggml_tensor * expert_weights);

// Compatibility alias for out-of-tree Laguna callers. New model code
// should use the model-neutral ggml_moe_combine API.
GGML_API struct ggml_tensor * ggml_laguna_moe_combine(
struct ggml_context * ctx,
struct ggml_tensor * experts,
Expand Down
Loading