Skip to content

Commit 4ee204f

Browse files
dbortfacebook-github-bot
authored andcommitted
Program::Load -> Program::load for all of //executorch (#385)
Summary: Pull Request resolved: #385 Use the new name throughout the tree. ghstack-source-id: 200971698 exported-using-ghexport Reviewed By: cccclai Differential Revision: D49345073 fbshipit-source-id: 63ec0afcfaf932f6af0d76af1ed7824ddf98fa44
1 parent 8a5f3e8 commit 4ee204f

File tree

15 files changed

+19
-19
lines changed

15 files changed

+19
-19
lines changed

examples/bundled_executor_runner/bundled_executor_runner.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ int main(int argc, char** argv) {
107107

108108
// Parse the program file. This is immutable, and can also be reused
109109
// between multiple execution invocations across multiple threads.
110-
Result<Program> program = Program::Load(&buffer_data_loader);
110+
Result<Program> program = Program::load(&buffer_data_loader);
111111
if (!program.ok()) {
112112
ET_LOG(Error, "Failed to parse model file %s", model_path);
113113
return 1;

examples/executor_runner/executor_runner.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ int main(int argc, char** argv) {
6767

6868
// Parse the program file. This is immutable, and can also be reused between
6969
// multiple execution invocations across multiple threads.
70-
Result<Program> program = Program::Load(&loader.get());
70+
Result<Program> program = Program::load(&loader.get());
7171
if (!program.ok()) {
7272
ET_LOG(Error, "Failed to parse model file %s", model_path);
7373
return 1;

exir/backend/test/demos/rpc/ExecutorBackend.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class ExecutorBackend final : public PyTorchBackendInterface {
5656
// Can't free `processed` because the program will point into that memory.
5757

5858
// Try loading the program.
59-
Result<Program> program_result = Program::Load(loader);
59+
Result<Program> program_result = Program::load(loader);
6060
if (!program_result.ok()) {
6161
return program_result.error();
6262
}

extension/pybindings/pybindings.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class Module final {
6868
explicit Module(std::unique_ptr<DataLoader> loader)
6969
: loader_(std::move(loader)) {
7070
runtime_init();
71-
Result<Program> program = Program::Load(
71+
Result<Program> program = Program::load(
7272
loader_.get(), Program::Verification::InternalConsistency);
7373
THROW_IF_ERROR(
7474
program.error(),

runtime/executor/test/allocation_failure_stress_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class AllocationFailureStressTest : public ::testing::Test {
4646
loader_ = std::make_unique<FileDataLoader>(std::move(loader.get()));
4747

4848
// Use it to load the program.
49-
Result<Program> program = Program::Load(
49+
Result<Program> program = Program::load(
5050
loader_.get(), Program::Verification::InternalConsistency);
5151
ASSERT_EQ(program.error(), Error::Ok);
5252
program_ = std::make_unique<Program>(std::move(program.get()));

runtime/executor/test/backend_integration_test.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ TEST_P(BackendIntegrationTest, BasicInitSucceeds) {
295295
Result<FileDataLoader> loader = FileDataLoader::From(program_path());
296296
ASSERT_EQ(loader.error(), Error::Ok);
297297

298-
Result<Program> program = Program::Load(&loader.get());
298+
Result<Program> program = Program::load(&loader.get());
299299
ASSERT_EQ(program.error(), Error::Ok);
300300

301301
ManagedMemoryManager mmm(kDefaultNonConstMemBytes, kDefaultRuntimeMemBytes);
@@ -326,7 +326,7 @@ TEST_P(BackendIntegrationTest, FreeingProcessedBufferSucceeds) {
326326
DataLoaderSpy spy_loader(&loader.get());
327327

328328
// Load the program.
329-
Result<Program> program = Program::Load(&spy_loader);
329+
Result<Program> program = Program::load(&spy_loader);
330330
ASSERT_EQ(program.error(), Error::Ok);
331331
ManagedMemoryManager mmm(kDefaultNonConstMemBytes, kDefaultRuntimeMemBytes);
332332
Result<Method> method_res = program->load_method("forward", &mmm.get());
@@ -390,7 +390,7 @@ TEST_P(BackendIntegrationTest, EndToEndTestWithProcessedAsHandle) {
390390
DataLoaderSpy spy_loader(&loader.get());
391391

392392
// Load the program.
393-
Result<Program> program = Program::Load(&spy_loader);
393+
Result<Program> program = Program::load(&spy_loader);
394394
ASSERT_EQ(program.error(), Error::Ok);
395395

396396
// Hold onto the address of the processed buffer so we can compare against
@@ -538,7 +538,7 @@ TEST_P(DelegateDataAlignmentTest, ExpectedDataAlignment) {
538538
DataLoaderSpy spy_loader(&loader.get());
539539

540540
// Load the program.
541-
Result<Program> program = Program::Load(&spy_loader);
541+
Result<Program> program = Program::load(&spy_loader);
542542
ASSERT_EQ(program.error(), Error::Ok);
543543
ManagedMemoryManager mmm(kDefaultNonConstMemBytes, kDefaultRuntimeMemBytes);
544544
Result<Method> method = program->load_method("forward", &mmm.get());

runtime/executor/test/execution_plan_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class ExecutionPlanTest : public ::testing::Test {
4242
loader_ = std::make_unique<FileDataLoader>(std::move(loader.get()));
4343

4444
// Use it to load the program.
45-
Result<Program> program = Program::Load(
45+
Result<Program> program = Program::load(
4646
loader_.get(), Program::Verification::InternalConsistency);
4747
ASSERT_EQ(program.error(), Error::Ok);
4848
program_ = std::make_unique<Program>(std::move(program.get()));

runtime/executor/test/kernel_integration_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ class KernelIntegrationTest : public ::testing::Test {
143143
loader_ = std::make_unique<FileDataLoader>(std::move(loader.get()));
144144

145145
// Use it to load the program.
146-
Result<Program> program = Program::Load(
146+
Result<Program> program = Program::load(
147147
loader_.get(), Program::Verification::InternalConsistency);
148148
ASSERT_EQ(program.error(), Error::Ok);
149149
program_ = std::make_unique<Program>(std::move(program.get()));

runtime/executor/test/kernel_resolution_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class KernelResolutionTest : public ::testing::Test {
5757
loader_ = std::make_unique<FileDataLoader>(std::move(loader.get()));
5858

5959
// Use it to load the program.
60-
Result<Program> program = Program::Load(
60+
Result<Program> program = Program::load(
6161
loader_.get(), Program::Verification::InternalConsistency);
6262
ASSERT_EQ(program.error(), Error::Ok);
6363
program_ = std::make_unique<Program>(std::move(program.get()));

runtime/executor/test/method_meta_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class MethodMetaTest : public ::testing::Test {
3434
loader_ = std::make_unique<FileDataLoader>(std::move(loader.get()));
3535

3636
// Use it to load the program.
37-
Result<Program> program = Program::Load(
37+
Result<Program> program = Program::load(
3838
loader_.get(), Program::Verification::InternalConsistency);
3939
ASSERT_EQ(program.error(), Error::Ok);
4040
program_ = std::make_unique<Program>(std::move(program.get()));

runtime/executor/test/method_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class MethodTest : public ::testing::Test {
4242
std::make_unique<FileDataLoader>(std::move(loader.get()))});
4343

4444
// Use it to load the program.
45-
Result<Program> program = Program::Load(
45+
Result<Program> program = Program::load(
4646
loaders_[module_name].get(),
4747
Program::Verification::InternalConsistency);
4848
ASSERT_EQ(program.error(), Error::Ok);

sdk/runners/executor_runner.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ int main(int argc, char** argv) {
218218
// multiple execution invocations across multiple threads.
219219
uint32_t prof_tok = EXECUTORCH_BEGIN_PROF("de-serialize model");
220220
Result<Program> program =
221-
torch::executor::Program::Load(program_data.program_loader());
221+
torch::executor::Program::load(program_data.program_loader());
222222
EXECUTORCH_END_PROF(prof_tok);
223223
if (!program.ok()) {
224224
ET_LOG(Error, "Failed to parse model file %s", FLAGS_model_path.c_str());

test/multi_runner.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class PreparedModel final {
115115

116116
private:
117117
static Program load_program_or_die(DataLoader& loader) {
118-
Result<Program> program = Program::Load(&loader);
118+
Result<Program> program = Program::load(&loader);
119119
ET_CHECK(program.ok());
120120
return std::move(program.get());
121121
}

test/relocatable_runner.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ Program* load_program(
6767
new (loader) util::BufferDataLoader(file_data, file_data_len);
6868

6969
// Load the program.
70-
Result<Program> program_result = Program::Load(loader);
70+
Result<Program> program_result = Program::load(loader);
7171
ET_CHECK(program_result.ok());
7272

7373
// Move the Program into worker memory.

test/size_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ int main(int argc, char** argv) {
5757
loader.ok(), "FileDataLoader::From() failed: 0x%" PRIx32, loader.error());
5858

5959
uint32_t prof_tok = EXECUTORCH_BEGIN_PROF("de-serialize model");
60-
const auto program = Program::Load(&loader.get());
60+
const auto program = Program::load(&loader.get());
6161
EXECUTORCH_END_PROF(prof_tok);
6262
ET_CHECK_MSG(
63-
program.ok(), "Program::Load() failed: 0x%" PRIx32, program.error());
63+
program.ok(), "Program::load() failed: 0x%" PRIx32, program.error());
6464
ET_LOG(Info, "Program file %s loaded.", argv[1]);
6565

6666
// Use the first method in the program.

0 commit comments

Comments
 (0)