Skip to content

Commit 8610ba3

Browse files
committed
more path iteration
1 parent 2469b44 commit 8610ba3

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

backends/cuda/runtime/cuda_backend.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ class ET_EXPERIMENTAL CudaBackend final
126126
temp_dir / (so_blob_key + to_string(get_process_id()) + ".so");
127127

128128
// Create a temporary file
129-
ofstream outfile(so_path.c_str(), ios::binary);
129+
ofstream outfile(so_path, ios::binary);
130130

131131
// Write the ELF buffer to the temporary file
132132
ET_LOG(
@@ -146,7 +146,7 @@ class ET_EXPERIMENTAL CudaBackend final
146146
outfile.close();
147147

148148
// Load the lib
149-
Result<void*> lib_handle_res = load_library(so_path.c_str());
149+
Result<void*> lib_handle_res = load_library(so_path);
150150
if (!lib_handle_res.ok()) {
151151
return lib_handle_res.error();
152152
}

backends/cuda/runtime/platform/platform.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,20 @@ namespace executorch {
2424
namespace backends {
2525
namespace cuda {
2626

27-
executorch::runtime::Result<void*> load_library(const char* path) {
27+
executorch::runtime::Result<void*> load_library(
28+
const std::filesystem::path& path) {
2829
#ifdef _WIN32
29-
auto lib_handle = LoadLibrary(path);
30+
std::string utf8 = p.u8string();
31+
auto lib_handle = LoadLibrary(utf8.c_str());
3032
if (lib_handle == NULL) {
31-
ET_LOG(Error, "Failed to load %s with error: %lu", path, GetLastError());
33+
ET_LOG(Error, "Failed to load %s with error: %lu", utf8, GetLastError());
3234
return executorch::runtime::Error::AccessFailed;
3335
}
3436

3537
#else
3638
void* lib_handle = dlopen(path, RTLD_LAZY | RTLD_LOCAL);
3739
if (lib_handle == nullptr) {
38-
ET_LOG(Error, "Failed to load %s with error: %s", path, dlerror());
40+
ET_LOG(Error, "Failed to load %s with error: %s", path.c_str(), dlerror());
3941
return executorch::runtime::Error::AccessFailed;
4042
}
4143
#endif

backends/cuda/runtime/shims/memory.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include <executorch/backends/aoti/common_shims.h>
1010
#include <executorch/backends/aoti/utils.h>
11+
#include <executorch/backends/cuda/runtime/platform/platform.h>
1112
#include <executorch/backends/cuda/runtime/shims/memory.h>
1213
#include <executorch/backends/cuda/runtime/shims/tensor_attribute.h>
1314
#include <executorch/backends/cuda/runtime/utils.h>

0 commit comments

Comments
 (0)