Skip to content
Closed
Show file tree
Hide file tree
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
17 changes: 8 additions & 9 deletions test/size_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@
* LICENSE file in the root directory of this source tree.
*/

#include <executorch/extension/data_loader/file_data_loader.h>
#include <executorch/extension/data_loader/buffer_data_loader.h>
#include <executorch/runtime/executor/method.h>
#include <executorch/runtime/executor/program.h>
#include <executorch/runtime/platform/log.h>
#include <executorch/runtime/platform/profiler.h>
#include <executorch/runtime/platform/runtime.h>
#include <stdio.h>
#include <fstream>

using namespace torch::executor;
using torch::executor::util::FileDataLoader;
using torch::executor::util::BufferDataLoader;

static uint8_t method_allocator_pool[1024];
static uint8_t activation_pool[512];
Expand All @@ -34,15 +35,13 @@ int main(int argc, char** argv) {
HierarchicalAllocator planned_memory({memory_planned_buffers, 1});

MemoryManager memory_manager(&method_allocator, &planned_memory);

Result<FileDataLoader> loader = FileDataLoader::from(argv[1]);
ET_CHECK_MSG(
loader.ok(),
"FileDataLoader::from() failed: 0x%" PRIx32,
static_cast<uint32_t>(loader.error()));
std::ifstream in(argv[1]);
std::string contents(
(std::istreambuf_iterator<char>(in)), std::istreambuf_iterator<char>());
BufferDataLoader loader(contents.data(), contents.size());

uint32_t prof_tok = EXECUTORCH_BEGIN_PROF("de-serialize model");
const auto program = Program::load(&loader.get());
const auto program = Program::load(&loader);
EXECUTORCH_END_PROF(prof_tok);
ET_CHECK_MSG(
program.ok(),
Expand Down
2 changes: 1 addition & 1 deletion test/targets.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ SIZE_TEST_SOURCES = [

SIZE_TEST_DEPS = [
"//executorch/runtime/executor:program",
"//executorch/extension/data_loader:file_data_loader",
"//executorch/extension/data_loader:buffer_data_loader",
]

def define_common_targets():
Expand Down
Loading