Skip to content

Commit

Permalink
fix: disable session save/load for vulkan
Browse files Browse the repository at this point in the history
  • Loading branch information
hans00 committed May 10, 2024
1 parent 5408c9d commit ac23d25
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/LlamaContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,12 @@ Napi::Value LlamaContext::SaveSession(const Napi::CallbackInfo &info) {
Napi::TypeError::New(env, "Context is disposed")
.ThrowAsJavaScriptException();
}
#ifdef GGML_USE_VULKAN
if (_sess->params().n_gpu_layers > 0) {
Napi::TypeError::New(env, "Vulkan cannot save session")
.ThrowAsJavaScriptException();
}
#endif
auto *worker = new SaveSessionWorker(info, _sess);
worker->Queue();
return worker->Promise();
Expand All @@ -183,6 +189,12 @@ Napi::Value LlamaContext::LoadSession(const Napi::CallbackInfo &info) {
Napi::TypeError::New(env, "Context is disposed")
.ThrowAsJavaScriptException();
}
#ifdef GGML_USE_VULKAN
if (_sess->params().n_gpu_layers > 0) {
Napi::TypeError::New(env, "Vulkan cannot load session")
.ThrowAsJavaScriptException();
}
#endif
auto *worker = new LoadSessionWorker(info, _sess);
worker->Queue();
return worker->Promise();
Expand Down

0 comments on commit ac23d25

Please sign in to comment.