| 2174 | } |
| 2175 | |
| 2176 | static std::unique_ptr<llm_graph_input_rs> build_rs_inp_impl( |
| 2177 | ggml_context * ctx0, |
| 2178 | const llama_ubatch & ubatch, |
| 2179 | const llama_memory_recurrent_context * mctx_cur) { |
| 2180 | |
| 2181 | auto inp = std::make_unique<llm_graph_input_rs>(mctx_cur); |
| 2182 | |
| 2183 | const int64_t n_rs = mctx_cur->get_n_rs(); |
| 2184 | const int64_t n_seqs = ubatch.n_seqs; |
| 2185 | |
| 2186 | inp->s_copy = ggml_new_tensor_1d(ctx0, GGML_TYPE_I32, n_rs); |
| 2187 | ggml_set_input(inp->s_copy); |
| 2188 | |
| 2189 | inp->s_copy_main = ggml_view_1d(ctx0, inp->s_copy, n_seqs, 0); |
| 2190 | inp->s_copy_extra = ggml_view_1d(ctx0, inp->s_copy, n_rs - n_seqs, n_seqs * inp->s_copy->nb[0]); |
| 2191 | |
| 2192 | inp->head = mctx_cur->get_head(); |
| 2193 | inp->rs_z = mctx_cur->get_rs_z(); |
| 2194 | |
| 2195 | return inp; |
| 2196 | } |
| 2197 | |
| 2198 | llm_graph_input_rs * llm_graph_context::build_rs_inp() const { |
| 2199 | const auto * mctx_cur = static_cast<const llama_memory_recurrent_context *>(mctx); |
no test coverage detected