Skip to content

Commit 9f552af

Browse files
Varun Purifacebook-github-bot
authored andcommitted
Add support for event tracer in module constructor (#2360)
Summary: Pull Request resolved: #2360 As titled, default to nullptr bypass-github-export-checks bypass-github-pytorch-ci-checks bypass-github-executorch-ci-checks Reviewed By: Jack-Khuu Differential Revision: D54764501 fbshipit-source-id: 1a9475507826a94bc477e01bebf27e2e7979f2f9
1 parent 07eb609 commit 9f552af

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

extension/module/module.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,12 @@ namespace torch::executor {
3636

3737
Module::Module(
3838
const std::string& file_path,
39-
const Module::MlockConfig mlock_config)
39+
const Module::MlockConfig mlock_config,
40+
std::unique_ptr<EventTracer> event_tracer)
4041
: file_path_(file_path),
4142
mlock_config_(mlock_config),
42-
memory_allocator_(std::make_unique<util::MallocMemoryAllocator>()) {
43+
memory_allocator_(std::make_unique<util::MallocMemoryAllocator>()),
44+
event_tracer_(std::move(event_tracer)) {
4345
runtime_init();
4446
}
4547

extension/module/module.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ class Module final {
4444
*/
4545
explicit Module(
4646
const std::string& file_path,
47-
const MlockConfig mlock_config = MlockConfig::UseMlock);
47+
const MlockConfig mlock_config = MlockConfig::UseMlock,
48+
std::unique_ptr<EventTracer> event_tracer = nullptr);
4849

4950
/**
5051
* Constructs an instance with the provided data loader and memory allocator.

0 commit comments

Comments
 (0)