find the first buffer type in the list that can use the tensor
| 295 | |
| 296 | // find the first buffer type in the list that can use the tensor |
| 297 | 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) { |
| 298 | GGML_ASSERT(!buft_list.empty()); |
| 299 | for (const auto & cur : buft_list) { |
| 300 | ggml_backend_dev_t cur_dev = cur.first; |
| 301 | ggml_backend_buffer_type_t cur_buft = cur.second; |
| 302 | if (weight_buft_supported(hparams, tensor, op, cur_buft, cur_dev)) { |
| 303 | return cur_buft; |
| 304 | } |
| 305 | } |
| 306 | |
| 307 | return nullptr; |
| 308 | } |
| 309 | |
| 310 | // CPU: ACCEL -> GPU host -> CPU extra -> CPU |
| 311 | static buft_list_t make_cpu_buft_list(const std::vector<ggml_backend_dev_t> & devices) { |
no test coverage detected