Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf : study batched decoding bottleneck #3726

Closed
wants to merge 3 commits into from
Closed
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
4 changes: 4 additions & 0 deletions ggml.c
Original file line number Diff line number Diff line change
Expand Up @@ -16602,6 +16602,10 @@ static void ggml_compute_forward_cross_entropy_loss_back(
static void ggml_compute_forward(struct ggml_compute_params * params, struct ggml_tensor * tensor) {
GGML_ASSERT(params);

if (tensor->op == GGML_OP_NONE) {
return;
}

#ifdef GGML_USE_CUBLAS
bool skip_cpu = ggml_cuda_compute_forward(params, tensor);
if (skip_cpu) {
Expand Down
27 changes: 27 additions & 0 deletions llama.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5815,6 +5815,33 @@ static struct ggml_cgraph * llama_build_graph(
GGML_ASSERT(false);
}

#if 1
for (int i = 0; i < result->n_nodes; ++i) {
struct ggml_tensor * node = result->nodes[i];
if (getenv("SKIP_KQ_ALL")) {
if (
strcmp(node->name, "KQ") == 0 ||
strcmp(node->name, "KQ_scaled") == 0 ||
strcmp(node->name, "KQ_masked") == 0 ||
strcmp(node->name, "KQ_soft_max") == 0 ||
strcmp(node->name, "KQV") == 0 ||
false) {
//printf("skipping %s\n", dst->name);
node->op = GGML_OP_NONE;
}
}
if (getenv("SKIP_KQ_KQV")) {
if (
strcmp(node->name, "KQ") == 0 ||
strcmp(node->name, "KQV") == 0 ||
false) {
//printf("skipping %s\n", dst->name);
node->op = GGML_OP_NONE;
}
}
}
#endif

return result;
}

Expand Down