MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / ggml_flash_ff

Function ggml_flash_ff

ggml.c:5616–5644  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5614// ggml_flash_ff
5615
5616struct ggml_tensor * ggml_flash_ff(
5617 struct ggml_context * ctx,
5618 struct ggml_tensor * a,
5619 struct ggml_tensor * b0,
5620 struct ggml_tensor * b1,
5621 struct ggml_tensor * c0,
5622 struct ggml_tensor * c1) {
5623 GGML_ASSERT(ggml_can_mul_mat(b0, a));
5624 // TODO: more checks
5625
5626 bool is_node = false;
5627
5628 if (a->grad || b0->grad || b1->grad || c0->grad || c1->grad) {
5629 is_node = true;
5630 }
5631
5632 //struct ggml_tensor * result = ggml_dup_tensor(ctx, a);
5633 struct ggml_tensor * result = ggml_new_tensor(ctx, GGML_TYPE_F32, a->n_dims, a->ne);
5634
5635 result->op = GGML_OP_FLASH_FF;
5636 result->grad = is_node ? ggml_dup_tensor(ctx, result) : NULL;
5637 result->src[0] = a;
5638 result->src[1] = b0;
5639 result->src[2] = b1;
5640 result->src[3] = c0;
5641 result->src[4] = c1;
5642
5643 return result;
5644}
5645
5646// ggml_flash_attn_back
5647

Callers

nothing calls this directly

Calls 3

ggml_can_mul_matFunction · 0.70
ggml_new_tensorFunction · 0.70
ggml_dup_tensorFunction · 0.70

Tested by

no test coverage detected