Skip to content

Commit e14146c

Browse files
committed
hacky support .so file seperation by hardcoding file path
1 parent a2e2135 commit e14146c

File tree

2 files changed

+2
-18
lines changed

2 files changed

+2
-18
lines changed

backends/aoti/aoti_backend.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,4 @@ def preprocess(
4343
shell=True,
4444
)
4545

46-
# with open(so_path, "rb") as f:
47-
# data = f.read()
48-
4946
return PreprocessResult(so_path.encode("utf-8"))

backends/aoti/runtime/AotiBackend.cpp

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -427,21 +427,6 @@ class AOTIBackend final : public ::executorch::runtime::BackendInterface {
427427
FreeableBuffer* processed, // This will be the buffer from aoti_backend
428428
ArrayRef<CompileSpec> compile_specs // This will be my empty list
429429
) const override {
430-
// We could load the .so content directly. But I don't want to deal with
431-
// relocation. So dumping a file and using dlopen
432-
433-
// // Create a temporary file
434-
// std::ofstream outfile("/tmp/test.so", std::ios::binary);
435-
436-
// // Write the ELF buffer to the temporary file
437-
// outfile.write((char*)processed->data(), sizeof(void*) * processed->size());
438-
439-
// // Finish writing the file to disk
440-
// outfile.close();
441-
442-
// // Free the in-memory buffer
443-
// processed->Free();
444-
445430
const char* so_path = static_cast<const char*>(processed->data());
446431

447432
printf("so path: %s\n", so_path);
@@ -453,6 +438,8 @@ class AOTIBackend final : public ::executorch::runtime::BackendInterface {
453438
return Error::AccessFailed;
454439
}
455440

441+
processed->Free();
442+
456443
AOTInductorModelContainerCreateWithDevice =
457444
reinterpret_cast<AOTInductorModelContainerCreateWithDeviceFunc>(
458445
dlsym(so_handle, "AOTInductorModelContainerCreateWithDevice"));

0 commit comments

Comments
 (0)