refactor: unify runner lifecycles and weight residency (#1940)

This commit is contained in:
leejet
2026-09-06 22:30:45 +08:00
committed by GitHub
parent 6c57cc3b38
commit 462d675018
78 changed files with 2963 additions and 2051 deletions
+1 -9
View File
@@ -32,13 +32,6 @@ void UpscalerGGML::set_max_graph_vram_bytes(size_t max_vram_bytes) {
}
}
void UpscalerGGML::set_stream_layers_enabled(bool enabled) {
stream_layers_enabled = enabled;
if (esrgan_upscaler) {
esrgan_upscaler->set_stream_layers_enabled(enabled);
}
}
bool UpscalerGGML::load_from_file(const std::string& esrgan_path,
int n_threads) {
ggml_log_set(ggml_log_callback_default, nullptr);
@@ -94,7 +87,6 @@ bool UpscalerGGML::load_from_file(const std::string& esrgan_path,
return false;
}
esrgan_upscaler->set_max_graph_vram_bytes(max_graph_vram_bytes);
esrgan_upscaler->set_stream_layers_enabled(stream_layers_enabled);
if (direct) {
esrgan_upscaler->set_conv2d_direct_enabled(true);
}
@@ -139,7 +131,7 @@ sd::Tensor<float> UpscalerGGML::upscale_tensor(const sd::Tensor<float>& input_te
false,
on_processing);
}
esrgan_upscaler->free_compute_buffer();
esrgan_upscaler->runner_end();
if (upscaled.empty()) {
LOG_ERROR("esrgan compute failed");
return {};