find the first buffer type in the list that can use the tensor
| 311 | |
| 312 | // find the first buffer type in the list that can use the tensor |
| 313 | static ggml_backend_buffer_type_t select_weight_buft(const llama_hparams & hparams, ggml_tensor * tensor, ggml_op op, const buft_list_t & buft_list) { |
| 314 | GGML_ASSERT(!buft_list.empty()); |
| 315 | for (const auto & cur : buft_list) { |
| 316 | ggml_backend_dev_t cur_dev = cur.first; |
| 317 | ggml_backend_buffer_type_t cur_buft = cur.second; |
| 318 | if (weight_buft_supported(hparams, tensor, op, cur_buft, cur_dev)) { |
| 319 | return cur_buft; |
| 320 | } |
| 321 | } |
| 322 | |
| 323 | return nullptr; |
| 324 | } |
| 325 | |
| 326 | // CPU: ACCEL -> GPU host -> CPU extra -> CPU |
| 327 | static buft_list_t make_cpu_buft_list(const std::vector<ggml_backend_dev_t> & devices, bool use_extra_bufts, bool no_host) { |
no test coverage detected