Skip to content

Commit 1a7ecd5

Browse files
committed
timing for init step, clip for vulkan
1 parent 6200b6d commit 1a7ecd5

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,8 @@ llavaclip_default.o: examples/llava/clip.cpp examples/llava/clip.h
470470
$(CXX) $(CXXFLAGS) -c $< -o $@
471471
llavaclip_cublas.o: examples/llava/clip.cpp examples/llava/clip.h
472472
$(CXX) $(CXXFLAGS) $(CUBLAS_FLAGS) -c $< -o $@
473+
llavaclip_vulkan.o: examples/llava/clip.cpp examples/llava/clip.h
474+
$(CXX) $(CXXFLAGS) $(VULKAN_FLAGS) -c $< -o $@
473475

474476
#this is only used for openblas and accelerate
475477
ggml-blas.o: ggml/src/ggml-blas.cpp ggml/include/ggml-blas.h
@@ -663,10 +665,10 @@ koboldcpp_hipblas:
663665
endif
664666

665667
ifdef VULKAN_BUILD
666-
koboldcpp_vulkan: ggml_v4_vulkan.o ggml_v3.o ggml_v2.o ggml_v1.o expose.o gpttype_adapter_vulkan.o ggml-vulkan.o sdcpp_vulkan.o whispercpp_default.o llavaclip_default.o llava.o ggml-backend_vulkan.o $(OBJS_FULL) $(OBJS)
668+
koboldcpp_vulkan: ggml_v4_vulkan.o ggml_v3.o ggml_v2.o ggml_v1.o expose.o gpttype_adapter_vulkan.o ggml-vulkan.o sdcpp_vulkan.o whispercpp_default.o llavaclip_vulkan.o llava.o ggml-backend_vulkan.o $(OBJS_FULL) $(OBJS)
667669
$(VULKAN_BUILD)
668670
ifdef NOAVX2_BUILD
669-
koboldcpp_vulkan_noavx2: ggml_v4_vulkan_noavx2.o ggml_v3_noavx2.o ggml_v2_noavx2.o ggml_v1_failsafe.o expose.o gpttype_adapter_vulkan_noavx2.o ggml-vulkan.o sdcpp_vulkan.o whispercpp_default.o llavaclip_default.o llava.o ggml-backend_vulkan.o $(OBJS_SIMPLE) $(OBJS)
671+
koboldcpp_vulkan_noavx2: ggml_v4_vulkan_noavx2.o ggml_v3_noavx2.o ggml_v2_noavx2.o ggml_v1_failsafe.o expose.o gpttype_adapter_vulkan_noavx2.o ggml-vulkan.o sdcpp_vulkan.o whispercpp_default.o llavaclip_vulkan.o llava.o ggml-backend_vulkan.o $(OBJS_SIMPLE) $(OBJS)
670672
$(VULKAN_BUILD)
671673
else
672674
koboldcpp_vulkan_noavx2:

gpttype_adapter.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1961,6 +1961,9 @@ generation_outputs gpttype_generate(const generation_inputs inputs)
19611961
dry_sequence_breakers.clear();
19621962
dry_max_token_repeat.clear();
19631963

1964+
double time0 = 0, time1 = 0, time2 = 0;
1965+
timer_start();
1966+
19641967
for(int x=0;x<stop_token_max;++x)
19651968
{
19661969
std::string stopper = inputs.stop_sequence[x];
@@ -2421,8 +2424,8 @@ generation_outputs gpttype_generate(const generation_inputs inputs)
24212424
bool startedsampling = false;
24222425
bool v3_use_scratch = true; //for normal inference always use scratch
24232426

2427+
time0 = timer_check();
24242428
timer_start();
2425-
double time1 = 0, time2 = 0;
24262429

24272430
if(file_format == FileFormat::RWKV_1 || file_format==FileFormat::RWKV_2)
24282431
{
@@ -2872,7 +2875,7 @@ generation_outputs gpttype_generate(const generation_inputs inputs)
28722875
float pt2 = (time2*1000.0/(realnpredict==0?1:realnpredict));
28732876
float ts2 = (1000.0/pt2);
28742877
float tokens_per_second = (realnpredict == 0 ? 0 : realnpredict / (time1 + time2));
2875-
printf("\nCtxLimit:%d/%d, Amt:%d/%d, Process:%.2fs (%.1fms/T = %.2fT/s), Generate:%.2fs (%.1fms/T = %.2fT/s), Total:%.2fs (%.2fT/s)",(int)current_context_tokens.size(),(int)nctx, realnpredict, kcpp_params->n_predict, time1, pt1, ts1, time2, pt2, ts2, (time1 + time2), tokens_per_second);
2878+
printf("\nCtxLimit:%d/%d, Amt:%d/%d, Init:%.2fs, Process:%.2fs (%.1fms/T = %.2fT/s), Generate:%.2fs (%.1fms/T = %.2fT/s), Total:%.2fs (%.2fT/s)",(int)current_context_tokens.size(),(int)nctx, realnpredict, kcpp_params->n_predict, time0, time1, pt1, ts1, time2, pt2, ts2, (time1 + time2), tokens_per_second);
28762879
fflush(stdout);
28772880
output.status = 1;
28782881
output.stopreason = last_stop_reason;

0 commit comments

Comments
 (0)