Skip to content

Commit 95f57bb

Browse files
authored
ggml : remove ggml_task_type and GGML_PERF (#8017)
* ggml : remove ggml_task_type and GGML_PERF * check abort_callback on main thread only * vulkan : remove usage of ggml_compute_params * remove LLAMA_PERF
1 parent e112b61 commit 95f57bb

File tree

8 files changed

+398
-1078
lines changed

8 files changed

+398
-1078
lines changed

CMakeLists.txt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,6 @@ option(LLAMA_BUILD_SERVER "llama: build server example"
144144
option(LLAMA_LASX "llama: enable lasx" ON)
145145
option(LLAMA_LSX "llama: enable lsx" ON)
146146

147-
# add perf arguments
148-
option(LLAMA_PERF "llama: enable perf" OFF)
149-
150147
# Required for relocatable CMake package
151148
include(${CMAKE_CURRENT_SOURCE_DIR}/scripts/build-info.cmake)
152149

@@ -870,10 +867,6 @@ if (LLAMA_CPU_HBM)
870867
target_link_libraries(ggml PUBLIC memkind)
871868
endif()
872869

873-
if (LLAMA_PERF)
874-
add_compile_definitions(GGML_PERF)
875-
endif()
876-
877870
function(get_flags CCID CCVER)
878871
set(C_FLAGS "")
879872
set(CXX_FLAGS "")

Makefile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -344,9 +344,6 @@ ifdef LLAMA_GPROF
344344
MK_CFLAGS += -pg
345345
MK_CXXFLAGS += -pg
346346
endif
347-
ifdef LLAMA_PERF
348-
MK_CPPFLAGS += -DGGML_PERF
349-
endif
350347

351348
# Architecture specific
352349
# TODO: probably these flags need to be tweaked on some architectures

ggml-vulkan.cpp

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -513,8 +513,8 @@ static size_t vk_skip_checks;
513513
static size_t vk_output_tensor;
514514

515515
static void ggml_vk_print_tensor(ggml_backend * ctx, const ggml_tensor * tensor, const char * name);
516-
static void ggml_vk_check_results_0(ggml_backend_vk_context * ctx, ggml_compute_params * params, ggml_tensor * tensor);
517-
static void ggml_vk_check_results_1(ggml_backend_vk_context * ctx, ggml_compute_params * params, ggml_tensor * tensor);
516+
static void ggml_vk_check_results_0(ggml_backend_vk_context * ctx, ggml_tensor * tensor);
517+
static void ggml_vk_check_results_1(ggml_backend_vk_context * ctx, ggml_tensor * tensor);
518518
#endif
519519

520520
typedef void (*ggml_vk_func_t)(ggml_backend_vk_context * ctx, vk_context * subctx, const ggml_tensor * src0, const ggml_tensor * src1, ggml_tensor * dst);
@@ -5644,7 +5644,7 @@ static void ggml_vk_build_graph(ggml_backend_vk_context * ctx, ggml_tensor * nod
56445644
}
56455645
}
56465646

5647-
static bool ggml_vk_compute_forward(ggml_backend_vk_context * ctx, ggml_compute_params * params, ggml_tensor * tensor){
5647+
static bool ggml_vk_compute_forward(ggml_backend_vk_context * ctx, ggml_tensor * tensor){
56485648
ggml_tensor_extra_gpu * extra = nullptr;
56495649

56505650
switch (tensor->op) {
@@ -5697,17 +5697,10 @@ static bool ggml_vk_compute_forward(ggml_backend_vk_context * ctx, ggml_compute_
56975697
return false;
56985698
}
56995699

5700-
if (params->ith != 0) {
5701-
return true;
5702-
}
5703-
if (params->type == GGML_TASK_TYPE_INIT || params->type == GGML_TASK_TYPE_FINALIZE) {
5704-
return true;
5705-
}
5706-
57075700
VK_LOG_DEBUG("ggml_vk_compute_forward(" << tensor << ", name=" << tensor->name << ", op=" << ggml_op_name(tensor->op) << ", type=" << tensor->type << ", ne0=" << tensor->ne[0] << ", ne1=" << tensor->ne[1] << ", ne2=" << tensor->ne[2] << ", ne3=" << tensor->ne[3] << ", nb0=" << tensor->nb[0] << ", nb1=" << tensor->nb[1] << ", nb2=" << tensor->nb[2] << ", nb3=" << tensor->nb[3] << ", view_src=" << tensor->view_src << ", view_offs=" << tensor->view_offs << ")");
57085701

57095702
#ifdef GGML_VULKAN_CHECK_RESULTS
5710-
ggml_vk_check_results_0(ctx, params, tensor);
5703+
ggml_vk_check_results_0(ctx, tensor);
57115704
#endif
57125705

57135706
vk_context& subctx = ctx->gc.contexts[extra->ctx_idx];
@@ -6214,23 +6207,20 @@ GGML_CALL static ggml_status ggml_backend_vk_graph_compute(ggml_backend_t backen
62146207
ggml_vk_build_graph(ctx,cgraph->nodes[i], i == last_node);
62156208
}
62166209

6217-
ggml_compute_params params = {};
6218-
params.type = GGML_TASK_TYPE_COMPUTE;
6219-
params.ith = 0;
62206210
for (int i = 0; i < cgraph->n_nodes; i++) {
62216211
ggml_tensor * node = cgraph->nodes[i];
62226212

62236213
if (ggml_vk_is_empty(node)) {
62246214
continue;
62256215
}
62266216

6227-
bool ok = ggml_vk_compute_forward(ctx, &params, node);
6217+
bool ok = ggml_vk_compute_forward(ctx, node);
62286218
if (!ok) {
62296219
fprintf(stderr, "%s: error: op not supported %s (%s)\n", __func__, node->name, ggml_op_name(node->op));
62306220
}
62316221
#ifdef GGML_VULKAN_CHECK_RESULTS
62326222
else {
6233-
ggml_vk_check_results_1(ctx, &params, node);
6223+
ggml_vk_check_results_1(ctx, node);
62346224
}
62356225
#endif
62366226
GGML_ASSERT(ok);
@@ -6600,11 +6590,8 @@ void * comp_result;
66006590
size_t comp_size;
66016591
size_t comp_nb[GGML_MAX_DIMS];
66026592
size_t check_counter = 0;
6603-
static void ggml_vk_check_results_0(ggml_backend_vk_context * ctx, ggml_compute_params * params, ggml_tensor * tensor) {
6604-
if (params->ith != 0) {
6605-
return;
6606-
}
6607-
if (params->type == GGML_TASK_TYPE_INIT || params->type == GGML_TASK_TYPE_FINALIZE || tensor->op == GGML_OP_TRANSPOSE) {
6593+
static void ggml_vk_check_results_0(ggml_backend_vk_context * ctx, ggml_tensor * tensor) {
6594+
if (tensor->op == GGML_OP_TRANSPOSE) {
66086595
return;
66096596
}
66106597

@@ -6908,11 +6895,8 @@ static void ggml_vk_check_results_0(ggml_backend_vk_context * ctx, ggml_compute_
69086895
ggml_free(ggml_ctx);
69096896
}
69106897

6911-
static void ggml_vk_check_results_1(ggml_backend_vk_context * ctx, ggml_compute_params * params, ggml_tensor * tensor) {
6912-
if (params->ith != 0) {
6913-
return;
6914-
}
6915-
if (params->type == GGML_TASK_TYPE_INIT || params->type == GGML_TASK_TYPE_FINALIZE || tensor->op == GGML_OP_TRANSPOSE) {
6898+
static void ggml_vk_check_results_1(ggml_backend_vk_context * ctx, ggml_tensor * tensor) {
6899+
if (tensor->op == GGML_OP_TRANSPOSE) {
69166900
return;
69176901
}
69186902
if (!(vk_output_tensor > 0 && vk_output_tensor == check_counter) && check_counter <= vk_skip_checks) {

0 commit comments

Comments
 (0)