perf: --eager-load to pre-load params at model-load time (#1687)

This commit is contained in:
fszontagh authored and GitHub committed 2026-06-22 22:10:09 +08:00
1 parent b12098f5d0
commit 787d229d84
6 files changed
+34 -1

No files matched your search

+11
View File
@@ -147,6 +147,17 @@ bool ModelManager::register_param_tensors(const std::string& desc,
return true;
}
bool ModelManager::load_all_params_eagerly() {
std::vector<TensorState*> all_states;
all_states.reserve(tensor_states_.size());
for (const auto& s : tensor_states_) {
if (s != nullptr) {
all_states.push_back(s.get());
}
}
return load_tensors_to_params_backend(all_states);
}
bool ModelManager::validate_registered_tensors() {
bool ok = true;
for (const auto& state : tensor_states_) {