Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit 3eef24d

Browse files
committed
add dylib for windows
1 parent eb96ed4 commit 3eef24d

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

engine/services/engine_service.cc

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,6 @@ cpp::result<bool, std::string> EngineService::DownloadCuda(
467467
auto engine_path = file_manager_utils::GetCudaToolkitPath(engine);
468468
archive_utils::ExtractArchive(finishedTask.items[0].localPath.string(),
469469
engine_path.string());
470-
471470
try {
472471
std::filesystem::remove(finishedTask.items[0].localPath);
473472
} catch (std::exception& e) {
@@ -758,6 +757,15 @@ cpp::result<void, std::string> EngineService::LoadEngine(
758757
} else {
759758
LOG_WARN << "Could not add dll directory: " << p;
760759
}
760+
761+
auto cuda_path = file_manager_utils::GetCudaToolkitPath(e_type);
762+
if (auto cuda_cookie = AddDllDirectory(cuda_path.string());
763+
cuda_cookie != 0) {
764+
LOG_INFO << "Added cuda dll directory: " << p;
765+
engines_[e_type].cuda_cookie = cuda_cookie;
766+
} else {
767+
LOG_WARN << "Could not add cuda dll directory: " << p;
768+
}
761769
};
762770

763771
if (bool should_use_dll_search_path = !(getenv("ENGINE_PATH"));
@@ -770,6 +778,11 @@ cpp::result<void, std::string> EngineService::LoadEngine(
770778
} else {
771779
LOG_INFO << "Removed dll directory: " << kLlamaRepo;
772780
}
781+
if (!RemoveDllDirectory(engines_[kLlamaRepo].cuda_cookie)) {
782+
LOG_WARN << "Could not remove cuda dll directory: " << kLlamaRepo;
783+
} else {
784+
LOG_INFO << "Removed cuda dll directory: " << kLlamaRepo;
785+
}
773786

774787
add_dll(ne, engine_dir_path.string());
775788
} else if (IsEngineLoaded(kTrtLlmRepo) && ne == kLlamaRepo) {
@@ -821,6 +834,11 @@ cpp::result<void, std::string> EngineService::UnloadEngine(
821834
} else {
822835
LOG_INFO << "Removed dll directory: " << ne;
823836
}
837+
if (!RemoveDllDirectory(engines_[ne].cuda_cookie)) {
838+
LOG_WARN << "Could not remove cuda dll directory: " << ne;
839+
} else {
840+
LOG_INFO << "Removed cuda dll directory: " << ne;
841+
}
824842
#endif
825843
engines_.erase(ne);
826844
LOG_INFO << "Unloaded engine " + ne;

engine/services/engine_service.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ class EngineService {
7676
EngineV engine;
7777
#if defined(_WIN32)
7878
DLL_DIRECTORY_COOKIE cookie;
79+
DLL_DIRECTORY_COOKIE cuda_cookie;
7980
#endif
8081
};
8182

0 commit comments

Comments
 (0)