Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
b4fdc22
[Executorch] Make module constructors uniform across
kimishpatel Nov 11, 2025
2a5e4a4
Update on "[Executorch] Make module constructors uniform across"
kimishpatel Nov 14, 2025
46dafd9
Update on "[Executorch] Make module constructors uniform across"
kimishpatel Nov 20, 2025
eca4306
Update on "[Executorch] Make module constructors uniform across"
kimishpatel Nov 20, 2025
5755ed2
Update on "[Executorch] Make module constructors uniform across"
kimishpatel Nov 20, 2025
1a7132f
Update on "[Executorch] Make module constructors uniform across"
kimishpatel Nov 21, 2025
75117ef
Update on "[Executorch] Make module constructors uniform across"
kimishpatel Nov 22, 2025
0c0af03
Update on "[Executorch] Make module constructors uniform across"
kimishpatel Nov 23, 2025
e41ea89
Update on "[Executorch] Make module constructors uniform across"
kimishpatel Nov 23, 2025
d2b0a2d
Update on "[Executorch] Make module constructors uniform across"
kimishpatel Nov 23, 2025
879c001
Update on "[Executorch] Make module constructors uniform across"
kimishpatel Nov 24, 2025
7d06eeb
Update on "[Executorch] Make module constructors uniform across"
kimishpatel Nov 24, 2025
b3f5f83
Update on "[Executorch] Make module constructors uniform across"
kimishpatel Nov 25, 2025
5656687
Update on "[Executorch] Make module constructors uniform across"
kimishpatel Dec 4, 2025
65cba8c
Update on "[Executorch] Make module constructors uniform across"
kimishpatel Dec 4, 2025
a108c06
Update on "[Executorch] Make module constructors uniform across"
kimishpatel Dec 4, 2025
955b819
Update on "[Executorch] Make module constructors uniform across"
kimishpatel Dec 4, 2025
7ba8bc0
Update on "[Executorch] Make module constructors uniform across"
kimishpatel Dec 4, 2025
8e99aa7
Update on "[Executorch] Make module constructors uniform across"
kimishpatel Dec 4, 2025
e25c01f
Update on "[Executorch] Make module constructors uniform across"
kimishpatel Dec 4, 2025
9e43372
Update on "[Executorch] Make module constructors uniform across"
kimishpatel Dec 4, 2025
5a5755f
Update on "[Executorch] Make module constructors uniform across"
kimishpatel Dec 5, 2025
3ee8054
Update on "[Executorch] Make module constructors uniform across"
kimishpatel Dec 5, 2025
cda3108
Update on "[Executorch] Make module constructors uniform across"
kimishpatel Dec 5, 2025
7f68947
Update on "[Executorch] Make module constructors uniform across"
kimishpatel Dec 5, 2025
5d30170
Update on "[Executorch] Make module constructors uniform across"
kimishpatel Dec 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 27 additions & 9 deletions extension/module/module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,17 @@ runtime::Result<std::unique_ptr<runtime::DataLoader>> make_data_loader(
Module::Module(
const std::string& file_path,
const LoadMode load_mode,
std::unique_ptr<runtime::EventTracer> event_tracer)
std::unique_ptr<runtime::EventTracer> event_tracer,
std::unique_ptr<runtime::MemoryAllocator> memory_allocator,
std::unique_ptr<runtime::MemoryAllocator> temp_allocator)
: file_path_(file_path),
load_mode_(load_mode),
memory_allocator_(std::make_unique<MallocMemoryAllocator>()),
temp_allocator_(std::make_unique<MallocMemoryAllocator>()),
memory_allocator_(
memory_allocator ? std::move(memory_allocator)
: std::make_unique<MallocMemoryAllocator>()),
temp_allocator_(
temp_allocator ? std::move(temp_allocator)
: std::make_unique<MallocMemoryAllocator>()),
event_tracer_(std::move(event_tracer)) {
runtime::runtime_init();
}
Expand All @@ -91,11 +97,17 @@ Module::Module(
const std::string& file_path,
const std::string& data_map_path,
const LoadMode load_mode,
std::unique_ptr<runtime::EventTracer> event_tracer)
std::unique_ptr<runtime::EventTracer> event_tracer,
std::unique_ptr<runtime::MemoryAllocator> memory_allocator,
std::unique_ptr<runtime::MemoryAllocator> temp_allocator)
: file_path_(file_path),
load_mode_(load_mode),
memory_allocator_(std::make_unique<MallocMemoryAllocator>()),
temp_allocator_(std::make_unique<MallocMemoryAllocator>()),
memory_allocator_(
memory_allocator ? std::move(memory_allocator)
: std::make_unique<MallocMemoryAllocator>()),
temp_allocator_(
temp_allocator ? std::move(temp_allocator)
: std::make_unique<MallocMemoryAllocator>()),
event_tracer_(std::move(event_tracer)) {
if (!data_map_path.empty()) {
data_files_.push_back(data_map_path);
Expand All @@ -107,12 +119,18 @@ Module::Module(
const std::string& file_path,
std::vector<std::string> data_files,
const LoadMode load_mode,
std::unique_ptr<runtime::EventTracer> event_tracer)
std::unique_ptr<runtime::EventTracer> event_tracer,
std::unique_ptr<runtime::MemoryAllocator> memory_allocator,
std::unique_ptr<runtime::MemoryAllocator> temp_allocator)
: file_path_(file_path),
data_files_(std::move(data_files)),
load_mode_(load_mode),
memory_allocator_(std::make_unique<MallocMemoryAllocator>()),
temp_allocator_(std::make_unique<MallocMemoryAllocator>()),
memory_allocator_(
memory_allocator ? std::move(memory_allocator)
: std::make_unique<MallocMemoryAllocator>()),
temp_allocator_(
temp_allocator ? std::move(temp_allocator)
: std::make_unique<MallocMemoryAllocator>()),
event_tracer_(std::move(event_tracer)) {
runtime::runtime_init();
}
Expand Down
12 changes: 9 additions & 3 deletions extension/module/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ class Module {
explicit Module(
const std::string& file_path,
const LoadMode load_mode = LoadMode::File,
std::unique_ptr<runtime::EventTracer> event_tracer = nullptr);
std::unique_ptr<runtime::EventTracer> event_tracer = nullptr,
std::unique_ptr<runtime::MemoryAllocator> memory_allocator = nullptr,
std::unique_ptr<runtime::MemoryAllocator> temp_allocator = nullptr);

/**
* Constructs an instance by loading a program from a file with specified
Expand All @@ -78,7 +80,9 @@ class Module {
const std::string& file_path,
const std::string& data_map_path,
const LoadMode load_mode = LoadMode::File,
std::unique_ptr<runtime::EventTracer> event_tracer = nullptr);
std::unique_ptr<runtime::EventTracer> event_tracer = nullptr,
std::unique_ptr<runtime::MemoryAllocator> memory_allocator = nullptr,
std::unique_ptr<runtime::MemoryAllocator> temp_allocator = nullptr);

/**
* Constructs an instance by loading a program from a file with specified
Expand All @@ -93,7 +97,9 @@ class Module {
const std::string& file_path,
std::vector<std::string> data_files,
const LoadMode load_mode = LoadMode::File,
std::unique_ptr<runtime::EventTracer> event_tracer = nullptr);
std::unique_ptr<runtime::EventTracer> event_tracer = nullptr,
std::unique_ptr<runtime::MemoryAllocator> memory_allocator = nullptr,
std::unique_ptr<runtime::MemoryAllocator> temp_allocator = nullptr);

/**
* Constructs an instance with the provided data loader and memory allocator.
Expand Down
Loading