Skip to content

Commit d52ebdc

Browse files
mcr229facebook-github-bot
authored andcommitted
Revert D54763963: Add etdump generation to llama_runner
Differential Revision: D54763963 Original commit changeset: 2e0bcaf0451d Original Phabricator Diff: D54763963 fbshipit-source-id: c51e943773fc5bf73e82b7517b17b69013494298
1 parent e7748f8 commit d52ebdc

File tree

4 files changed

+5
-40
lines changed

4 files changed

+5
-40
lines changed

examples/models/llama2/main.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,6 @@ DEFINE_int32(
3939
-1,
4040
"Number of CPU threads for inference. Defaults to -1, which implies we'll use a heuristic to derive the # of performant cores for a specific device.");
4141

42-
DEFINE_string(
43-
etdump_path,
44-
"llama_etdump.etdp",
45-
"Where to write the llama etdump.");
46-
4742
int32_t main(int32_t argc, char** argv) {
4843
gflags::ParseCommandLineFlags(&argc, &argv, true);
4944

@@ -79,8 +74,5 @@ int32_t main(int32_t argc, char** argv) {
7974
// generate
8075
runner.generate(prompt, seq_len);
8176

82-
// dump etdump profiling data
83-
runner.dump_etdump(FLAGS_etdump_path);
84-
8577
return 0;
8678
}

examples/models/llama2/runner/runner.cpp

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#include <executorch/runtime/core/exec_aten/exec_aten.h>
2525
#include <executorch/runtime/core/exec_aten/util/scalar_type_util.h>
2626
#include <executorch/runtime/platform/log.h>
27-
#include <executorch/sdk/etdump/etdump_flatcc.h>
2827

2928
namespace torch::executor {
3029
namespace {
@@ -35,14 +34,11 @@ Runner::Runner(
3534
const std::string& model_path,
3635
const std::string& tokenizer_path,
3736
const float temperature)
38-
: tokenizer_path_(tokenizer_path), temperature_(temperature) {
39-
std::unique_ptr<torch::executor::ETDumpGen> etdump_gen_ =
40-
std::make_unique<torch::executor::ETDumpGen>();
41-
42-
module_ = std::make_unique<Module>(
43-
model_path,
44-
Module::MlockConfig::UseMlockIgnoreErrors,
45-
std::move(etdump_gen_));
37+
: module_(std::make_unique<Module>(
38+
model_path,
39+
Module::MlockConfig::UseMlockIgnoreErrors)),
40+
tokenizer_path_(tokenizer_path),
41+
temperature_(temperature) {
4642
ET_LOG(
4743
Info,
4844
"Creating LLaMa runner: model_path=%s, tokenizer_path=%s",
@@ -390,25 +386,6 @@ Error Runner::generate(
390386
return Error::Ok;
391387
}
392388

393-
Error Runner::dump_etdump(std::string etdump_path) {
394-
#ifdef ET_EVENT_TRACER_ENABLED
395-
torch::executor::ETDumpGen* etdump_gen =
396-
static_cast<torch::executor::ETDumpGen*>(module_->event_tracer());
397-
398-
ET_LOG(Info, "ETDump size: %zu blocks", etdump_gen->get_num_blocks());
399-
etdump_result result = etdump_gen->get_etdump_data();
400-
if (result.buf != nullptr && result.size > 0) {
401-
// On a device with a file system users can just write it out
402-
// to the file-system.
403-
FILE* f = fopen(etdump_path.c_str(), "w+");
404-
fwrite((uint8_t*)result.buf, 1, result.size, f);
405-
fclose(f);
406-
free(result.buf);
407-
}
408-
#endif
409-
return Error::Ok;
410-
}
411-
412389
void Runner::TimeStamps::printReport(
413390
const int64_t& num_prompt_tokens,
414391
const int64_t& num_generated_tokens) {

examples/models/llama2/runner/runner.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include <executorch/examples/models/llama2/sampler/sampler.h>
2121
#include <executorch/examples/models/llama2/tokenizer/tokenizer.h>
2222
#include <executorch/extension/module/module.h>
23-
#include <executorch/sdk/etdump/etdump_flatcc.h>
2423

2524
namespace torch::executor {
2625

@@ -38,7 +37,6 @@ class Runner {
3837
int32_t seq_len = 128,
3938
std::function<void(const std::string&)> callback = {});
4039
void stop();
41-
Error dump_etdump(std::string etdump_path);
4240

4341
private:
4442
// metadata
@@ -94,7 +92,6 @@ class Runner {
9492
const int64_t& num_prompt_tokens,
9593
const int64_t& num_generated_tokens);
9694
};
97-
9895
TimeStamps timers_;
9996
};
10097

examples/models/llama2/runner/targets.bzl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ def define_common_targets():
3636
"//executorch/extension/module:module" + aten_suffix,
3737
"//executorch/kernels/quantized:generated_lib" + aten_suffix,
3838
"//executorch/runtime/core/exec_aten:lib" + aten_suffix,
39-
"//executorch/sdk/etdump:etdump_flatcc",
4039
] + (_get_operator_lib(aten)) + ([
4140
# Vulkan API currently cannot build on some platforms (e.g. Apple, FBCODE)
4241
# Therefore enable it explicitly for now to avoid failing tests

0 commit comments

Comments
 (0)