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
7 changes: 7 additions & 0 deletions tools/server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ target_include_directories(${TARGET} PRIVATE ../mtmd)
target_include_directories(${TARGET} PRIVATE ${PROJECT_SOURCE_DIR})
target_link_libraries(${TARGET} PUBLIC llama-common mtmd ${CMAKE_THREAD_LIBS_INIT})

# Compile in the post-warmup roofline reset only when the HIP profiler is built
# (ggml-cuda-roofline.cpp, linked via ggml-hip). No-op in every other build.
if (GGML_HIP_ROOFLINE)
target_compile_definitions(${TARGET} PRIVATE GGML_HIP_ROOFLINE)
target_include_directories(${TARGET} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../ggml/src/ggml-cuda)
endif()

# llama-server-impl: server logic, reusable by app

set(TARGET llama-server-impl)
Expand Down
13 changes: 13 additions & 0 deletions tools/server/server-context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@
#include "mtmd.h"
#include "mtmd-helper.h"

// Optional per-op roofline profiler (HIP build with GGML_HIP_ROOFLINE). Used to
// discard warmup so the report covers only measured inference. Compiled out
// otherwise. See ggml/src/ggml-cuda/ggml-cuda-roofline.cpp.
#ifdef GGML_HIP_ROOFLINE
#include "ggml-cuda-roofline.h"
#endif

#include <algorithm>
#include <cstddef>
#include <cinttypes>
Expand Down Expand Up @@ -1527,6 +1534,12 @@ struct server_context_impl {
// propagate new defaults back to caller
params = params_base;

// Discard warmup from the per-op roofline profiler so the report covers
// only measured inference. Compiled out unless GGML_HIP_ROOFLINE.
#ifdef GGML_HIP_ROOFLINE
ggml_cuda_roofline_reset();
#endif

if (!is_resume) {
return init();
}
Expand Down
Loading