Skip to content

Commit 8770ffa

Browse files
committed
rebuild buft list on every call
1 parent 538f609 commit 8770ffa

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

common/arg.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1485,13 +1485,15 @@ common_params_context common_params_parser_init(common_params & params, llama_ex
14851485
add_opt(common_arg(
14861486
{"--override-tensor", "-ot"}, "<tensor name pattern>=<buffer type>,...",
14871487
"override tensor buffer type", [](common_params & params, const std::string & value) {
1488-
static std::map<std::string, ggml_backend_buffer_type_t> buft_list;
1488+
/* static */ std::map<std::string, ggml_backend_buffer_type_t> buft_list;
14891489
if (buft_list.empty()) {
14901490
// enumerate all the devices and add their buffer types to the list
14911491
for (size_t i = 0; i < ggml_backend_dev_count(); ++i) {
14921492
auto * dev = ggml_backend_dev_get(i);
14931493
auto * buft = ggml_backend_dev_buffer_type(dev);
1494-
buft_list[ggml_backend_buft_name(buft)] = buft;
1494+
if (buft) {
1495+
buft_list[ggml_backend_buft_name(buft)] = buft;
1496+
}
14951497
}
14961498
}
14971499

0 commit comments

Comments
 (0)