From 3d6a9affb95421282e33c4657a0e0f085dbde343 Mon Sep 17 00:00:00 2001 From: Max Ren Date: Mon, 11 Aug 2025 16:00:39 -0700 Subject: [PATCH 1/2] Update [ghstack-poisoned] --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 08d14e13582..fbf5b4f5d40 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,7 @@ pip-out/ # Any exported models and profiling outputs *.bin *.model +*.etdump tokenizer.json *.pte *.ptd @@ -58,6 +59,7 @@ xcuserdata/ /include/ /share/ /version.py +*.csv # Android *.aar From bcb0f18567c494d75ce4b296cdc45fdc9bb504ec Mon Sep 17 00:00:00 2001 From: Max Ren Date: Mon, 11 Aug 2025 16:00:43 -0700 Subject: [PATCH 2/2] Update [ghstack-poisoned] --- devtools/scripts/generate_profiling_csv.py | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 devtools/scripts/generate_profiling_csv.py diff --git a/devtools/scripts/generate_profiling_csv.py b/devtools/scripts/generate_profiling_csv.py new file mode 100644 index 00000000000..a61d3ece69d --- /dev/null +++ b/devtools/scripts/generate_profiling_csv.py @@ -0,0 +1,47 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# Copyright 2024-25 Arm Limited and/or its affiliates. +# All rights reserved. +# +# This source code is licensed under the BSD-style license found in the +# LICENSE file in the root directory of this source tree. + +import argparse + +from executorch.devtools import Inspector + + +def generate_csv(etdump_path, output): + + inspector = Inspector(etdump_path) + df = inspector.to_dataframe() + df.to_csv(output) + + +def main(): + parser = argparse.ArgumentParser( + description="Generate profiling CSV from a model's etdump" + ) + parser.add_argument( + "--etdump_path", + type=str, + default="./model.etdump", + help="Path to the etdump file", + required=False, + ) + + parser.add_argument( + "--output", + type=str, + default="./model_profiling.csv", + help="Path to the output CSV file", + required=False, + ) + + args = parser.parse_args() + print(f"Generating CSV from {args.etdump_path}") + generate_csv(args.etdump_path, args.output) + print(f"Saved CSV to {args.output}") + + +if __name__ == "__main__": + main()