Skip to content
Open
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
14 changes: 13 additions & 1 deletion server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,11 @@ if(DFLASH27B_GPU_BACKEND STREQUAL "hip")
elseif(DFLASH27B_GPU_BACKEND STREQUAL "cuda")
target_sources(dflash_common PRIVATE
src/flashprefill_select.cpp
src/flashprefill.cpp)
src/flashprefill.cpp
src/common/draft_topk_cuda.cu)
# PUBLIC so consumers (e.g. the test_dflash executable) also see the macro
# and take the GPU draft top-K path instead of the CPU fallback.
target_compile_definitions(dflash_common PUBLIC DFLASH27B_HAVE_DRAFT_TOPK_CUDA=1)
# Multi-arch: scan all resolved arches and compile every applicable
# flashprefill kernel variant. This lets a single binary run on mixed
# GPUs (e.g. Volta sm_70 + Pascal sm_61) without "no kernel image" errors.
Expand Down Expand Up @@ -591,6 +595,14 @@ if(DFLASH27B_TESTS)
target_include_directories(test_flashprefill_kernels PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
target_link_libraries(test_flashprefill_kernels PRIVATE dflash_common CUDA::cudart)
endif()
# GPU draft top-K kernel vs CPU reference (extract_draft_topk). CUDA only:
# draft_topk_cuda.cu is compiled into dflash_common solely on the cuda backend.
if(DFLASH27B_GPU_BACKEND STREQUAL "cuda" AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/test_draft_topk_cuda.cpp")
add_executable(test_draft_topk_cuda test/test_draft_topk_cuda.cpp)
target_include_directories(test_draft_topk_cuda PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
target_link_libraries(test_draft_topk_cuda PRIVATE dflash_common CUDA::cudart)
add_test(NAME draft_topk_cuda COMMAND test_draft_topk_cuda)
endif()
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/test_kv_quant.cpp")
add_executable(test_kv_quant test/test_kv_quant.cpp)
target_include_directories(test_kv_quant PRIVATE ${DFLASH27B_SRC_INCLUDE_DIRS})
Expand Down
6 changes: 3 additions & 3 deletions server/scripts/bench_llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
DRAFT = None
TEST_DFLASH = os.environ.get("DFLASH_BIN", str(ROOT / "build" / f"test_dflash{BIN_SUFFIX}"))
TEST_GENERATE = os.environ.get("DFLASH_BIN_AR", str(ROOT / "build" / f"test_generate{BIN_SUFFIX}"))
TOKENIZER = os.environ.get("DFLASH_TOKENIZER", "Qwen/Qwen3.5-27B")
TOKENIZER = os.environ.get("DFLASH_TOKENIZER", "Qwen/Qwen3.6-27B")
TMPDIR = Path(tempfile.gettempdir()) / "dflash_bench"
TMPDIR.mkdir(parents=True, exist_ok=True)

Expand All @@ -53,8 +53,8 @@ def _gsm_gold(x):


BENCHES = [
("HumanEval", "openai_humaneval", None, "test", lambda x: x["prompt"], None, N_GEN),
("GSM8K", "gsm8k", "main", "test", lambda x: f"Question: {x['question']}\nAnswer: ", _gsm_gold, 1024),
("HumanEval", "openai/openai_humaneval", None, "test", lambda x: x["prompt"], None, N_GEN),
("GSM8K", "openai/gsm8k", "main", "test", lambda x: f"Question: {x['question']}\nAnswer: ", _gsm_gold, 1024),
("Math500", "HuggingFaceH4/MATH-500", None, "test", lambda x: f"Problem: {x['problem']}\nSolution: Put your final answer in \\boxed{{}}.\n", lambda x: x["answer"], 2048),
]

Expand Down
Loading
Loading