| 1722 | } |
| 1723 | |
| 1724 | llm_graph_input_attn_no_cache * llm_graph_context::build_attn_inp_no_cache() const { |
| 1725 | auto inp = std::make_unique<llm_graph_input_attn_no_cache>(hparams, cparams); |
| 1726 | |
| 1727 | // note: there is no KV cache, so the number of KV values is equal to the number of tokens in the batch |
| 1728 | inp->self_kq_mask = ggml_new_tensor_4d(ctx0, GGML_TYPE_F32, n_tokens, n_tokens, 1, 1); |
| 1729 | ggml_set_input(inp->self_kq_mask); |
| 1730 | |
| 1731 | inp->self_kq_mask_cnv = cparams.flash_attn ? ggml_cast(ctx0, inp->self_kq_mask, GGML_TYPE_F16) : inp->self_kq_mask; |
| 1732 | |
| 1733 | if (hparams.swa_type != LLAMA_SWA_TYPE_NONE) { |
| 1734 | inp->self_kq_mask_swa = ggml_new_tensor_4d(ctx0, GGML_TYPE_F32, n_tokens, n_tokens, 1, 1); |
| 1735 | ggml_set_input(inp->self_kq_mask_swa); |
| 1736 | |
| 1737 | inp->self_kq_mask_swa_cnv = cparams.flash_attn ? ggml_cast(ctx0, inp->self_kq_mask_swa, GGML_TYPE_F16) : inp->self_kq_mask_swa; |
| 1738 | } else { |
| 1739 | inp->self_kq_mask_swa = nullptr; |
| 1740 | inp->self_kq_mask_swa_cnv = nullptr; |
| 1741 | } |
| 1742 | |
| 1743 | return (llm_graph_input_attn_no_cache *) res->add_input(std::move(inp)); |
| 1744 | } |
| 1745 | |
| 1746 | ggml_tensor * llm_graph_context::build_attn( |
| 1747 | llm_graph_input_attn_no_cache * inp, |
nothing calls this directly
no test coverage detected