@@ -1090,16 +1090,12 @@ int llama_context::decode(const llama_batch & batch_inp) {
10901090 ggml_status status;
10911091 const auto * res = process_ubatch (ubatch, LLM_GRAPH_TYPE_DECODER, mctx.get (), status);
10921092
1093- #ifdef GGML_PERF
1093+ #if defined( GGML_PERF)
10941094 ggml_perf_accumulate (perf_totals, res->get_gf ());
1095- #endif /* GGML_PERF */
1096-
1097- #ifdef GGML_PERF_DETAIL
1098- if (perf_all_shape_fp) {
1099- ggml_perf_write_detailed_csv (res->get_gf (), perf_all_shape_fp);
1100- }
1095+ #elif defined(GGML_PERF_DETAIL)
11011096 ggml_perf_accumulate (perf_totals, res->get_gf ());
1102- #endif /* GGML_PERF_DETAI */
1097+ ggml_perf_write_detailed_csv (res->get_gf (), perf_all_shape_fp);
1098+ #endif /* GGML_PERF || GGML_PERF_DETAIL */
11031099
11041100
11051101 if (!res) {
@@ -2763,7 +2759,7 @@ llama_perf_context_data llama_perf_context(const llama_context * ctx) {
27632759}
27642760
27652761
2766- #ifdef GGML_PERF
2762+ #if defined( GGML_PERF)
27672763void ggml_perf_print_totals (struct ggml_perf_totals totals[GGML_OP_COUNT]) {
27682764 LLAMA_LOG_TSAVORITE (" \n === GGML Perf Summary ===\n " );
27692765 LLAMA_LOG_TSAVORITE (" %-16s %7s %14s %16s\n " , " Op" , " Runs" , " Total us" , " Avg us" );
@@ -2791,7 +2787,8 @@ void ggml_perf_print_totals(struct ggml_perf_totals totals[GGML_OP_COUNT]) {
27912787 }
27922788 }
27932789}
2794- #elif GGML_PERF_DETAIL
2790+
2791+ #elif defined(GGML_PERF_DETAIL)
27952792void ggml_perf_print_totals (struct ggml_perf_totals totals[GGML_OP_COUNT]) {
27962793 LLAMA_LOG_TSAVORITE (" \n === GGML Perf Summary ===\n " );
27972794 LLAMA_LOG_TSAVORITE (" %-16s %-8s %7s %14s %16s\n " , " Op" , " Target" , " Runs" , " Total us" , " Avg us" );
@@ -2855,7 +2852,7 @@ void llama_perf_context_print(const llama_context * ctx) {
28552852 __func__, data.t_eval_ms , data.n_eval , data.t_eval_ms / data.n_eval , 1e3 / data.t_eval_ms * data.n_eval );
28562853 LLAMA_LOG_INFO (" %s: total time = %10.2f ms / %5d tokens\n " , __func__, (t_end_ms - data.t_start_ms ), (data.n_p_eval + data.n_eval ));
28572854
2858- #ifdef GGML_PERF
2855+ #if defined( GGML_PERF) || defined(GGML_PERF_DETAIL)
28592856 LLAMA_LOG_TSAVORITE (" \n %s: load time = %10.2f ms\n " , __func__, data.t_load_ms );
28602857 LLAMA_LOG_TSAVORITE (" %s: prompt eval time = %10.2f ms / %5d tokens (%8.2f ms per token, %8.2f tokens per second)\n " ,
28612858 __func__, data.t_p_eval_ms , data.n_p_eval , data.t_p_eval_ms / data.n_p_eval , 1e3 / data.t_p_eval_ms * data.n_p_eval );
@@ -2864,7 +2861,7 @@ void llama_perf_context_print(const llama_context * ctx) {
28642861 LLAMA_LOG_TSAVORITE (" %s: total time = %10.2f ms / %5d tokens\n " , __func__, (t_end_ms - data.t_start_ms ), (data.n_p_eval + data.n_eval ));
28652862
28662863 ggml_perf_print_totals (const_cast <ggml_perf_totals *>(ctx->perf_totals ));
2867- #endif /* GGML_PERF */
2864+ #endif /* GGML_PERF || GGML_PERF_DETAIL */
28682865}
28692866
28702867void llama_perf_context_reset (llama_context * ctx) {
0 commit comments