Skip to content
Merged
Changes from all commits
Commits
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
8 changes: 8 additions & 0 deletions examples/portable/executor_runner/executor_runner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
#if defined(ET_USE_THREADPOOL)
#include <executorch/extension/threadpool/cpuinfo_utils.h>
#include <executorch/extension/threadpool/threadpool.h>
#include <executorch/extension/threadpool/threadpool_guard.h>

#include <optional>
#endif

static uint8_t method_allocator_pool[4 * 1024U * 1024U]; // 4 MB
Expand Down Expand Up @@ -163,6 +166,11 @@ int main(int argc, char** argv) {
::executorch::extension::threadpool::get_threadpool()
->_unsafe_reset_threadpool(num_performant_cores);
}
std::optional<::executorch::extension::threadpool::NoThreadPoolGuard>
opt_guard;
if (cpu_threads == 1) {
opt_guard.emplace();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After this, does the perf look same as ET_USE_THREADPOOL not defined? Curious if there is anything else...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It won't look the same, because we still wrap the function in a runtime::FunctionRef so there's an extra layer of function call.

}
#endif // ET_USE_THREADPOOL
// Create a loader to get the data of the program file. There are other
// DataLoaders that use mmap() or point to data that's already in memory, and
Expand Down
Loading