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

Function select_weight_buft

smallthinker/src/llama-model.cpp:297–308  ·  view source on GitHub ↗

find the first buffer type in the list that can use the tensor

Source from the content-addressed store, hash-verified

295
296// find the first buffer type in the list that can use the tensor
297static 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
311static buft_list_t make_cpu_buft_list(const std::vector<ggml_backend_dev_t> & devices) {

Callers 1

load_tensorsMethod · 0.85

Calls 2

weight_buft_supportedFunction · 0.85
emptyMethod · 0.45

Tested by

no test coverage detected