Skip to content

llama-server: reset roofline profiler after warmup - #159

Draft
amd-callumm wants to merge 1 commit into
AMD-Ecosystem:gfx11from
amd-callumm:llama_server_ttft_roofline
Draft

amd-callumm wants to merge 1 commit into
AMD-Ecosystem:gfx11from
amd-callumm:llama_server_ttft_roofline

Conversation

@amd-callumm

Copy link
Copy Markdown

Overview

(Work in progress)
Adds ggml_cuda_roofline_reset() call at the end of load_model(), after all initialization completes (e.g. model load, speculative decode setup, mmproj load) but before any user requests. This excludes warmup/initialization overhead from TTFT measurements to give a more representative run-to-run value, useful for benchmarking purposes.

Additional information

Following the pattern from llama-mtmd-cli (ref: PR #42) and llama-bench:

  • Add roofline header include with #ifdef GGML_HIP_ROOFLINE guard
  • Call ggml_cuda_roofline_reset() after params propagation
  • Update CMakeLists.txt with compile definitions and include dirs

Testing

Tested on a machine equipped with a gfx1151 AMDGPU:

  • Created 2 source builds of llama-server with -DGGML_HIP=ON -DGGML_HIP_ROOFLINE=ON:
    • Baseline from AMD-Ecosystem/llama.cpp:gfx11 (without these changes)
    • Second build with these changes on top of the gfx11 branch
  • Using TheBloke/TinyLlama-1.1B-Chat-v1.0-GGUF, ran multiple iterations of a chat completion request with both llama-server builds
  • Measured GPU time and kernel invocation count

Results of change:

  • GPU invocations: 3480 --> 2774 (-20%)
  • Measured GPU time: 48.7ms --> 39.5ms

NOT YET VERIFIED: TTFT or timings.prompt_ms impact.

Requirements

Add ggml_cuda_roofline_reset() call at the end of load_model(), after
all initialization completes (model load, MTP/speculative setup, mmproj
load) but before any user requests. This excludes warmup/initialization
overhead from TTFT measurements.

Following the pattern from PR AMD-Ecosystem#42 (llama-mtmd-cli) and llama-bench:
- Add roofline header include with #ifdef GGML_HIP_ROOFLINE guard
- Call ggml_cuda_roofline_reset() after params propagation
- Update CMakeLists.txt with compile definitions and include dirs

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant