Skip to content

Commit 4179cc8

Browse files
JacobSzwejbkafacebook-github-bot
authored andcommitted
.ff -> .pte
Summary: .pte is the file extension for executorch binaries. We should stop using .ff and encourage partners and clients to use .pte. Pytorch/pytorch has never enforced extensions like .pt or .ptl so I'm comfortable not strictly enforcing .pte Reviewed By: dbort Differential Revision: D47967450 fbshipit-source-id: 13c5fc2b51d49ae2e63996d5814108b7808ce167
1 parent 2582b91 commit 4179cc8

26 files changed

+64
-55
lines changed

.github/workflows/pull.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ jobs:
3737
# Export a test model
3838
python3 -m examples.export.export_example --model_name="linear"
3939
# Run test model
40-
buck2 run //examples/executor_runner:executor_runner -- --model_path ./linear.ff
40+
buck2 run //examples/executor_runner:executor_runner -- --model_path ./linear.pte

backends/xnnpack/test/test_xnnpack_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def save_bundled_program(representative_inputs, program, ref_output, output_path
116116
bundled_program_buffer = serialize_from_bundled_program_to_flatbuffer(
117117
bundled_program
118118
)
119-
output_path_with_postfix = f"{output_path}_bundled.ff"
119+
output_path_with_postfix = f"{output_path}_bundled.pte"
120120
print(f"saving bundled program to {output_path}...")
121121

122122
with open(output_path_with_postfix, "wb") as file:
@@ -223,7 +223,7 @@ def forward(self, *args):
223223

224224
ref_output = delegated_program(*sample_inputs)
225225
if dump_ff:
226-
filename = f"/tmp/xnnpack_test_{randint(1, 99999)}.ff"
226+
filename = f"/tmp/xnnpack_test_{randint(1, 99999)}.pte"
227227
print(f"Writing flatbuffer to {filename} ...")
228228

229229
save_bundled_program(

codegen/tools/targets.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def define_common_targets(is_fbcode = False):
143143
srcs = ["test/test_gen_oplist_real_model.py"],
144144
base_module = "",
145145
resources = {
146-
"//executorch/test/models:exported_programs[ModuleLinear.ff]": "test/ModuleLinear.ff",
146+
"//executorch/test/models:exported_programs[ModuleLinear.pte]": "test/ModuleLinear.pte",
147147
},
148148
visibility = [
149149
"//executorch/...",

codegen/tools/test/test_gen_oplist.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def test_get_custom_build_selector_with_both_allowlist_and_yaml(
132132
) -> None:
133133
op_list = ["aten::add", "aten::mul"]
134134
filename = os.path.join(self.temp_dir.name, "selected_operators.yaml")
135-
gen_oplist._dump_yaml(op_list, filename, "model.ff")
135+
gen_oplist._dump_yaml(op_list, filename, "model.pte")
136136
self.assertTrue(os.path.isfile(filename))
137137
with open(filename) as f:
138138
es = yaml.safe_load(f)

codegen/tools/test/test_gen_oplist_real_model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
from libfb.py import parutil
1717

18-
MODEL_PATH: Final[str] = parutil.get_file_path("ModuleLinear.ff", pkg=__package__)
18+
MODEL_PATH: Final[str] = parutil.get_file_path("ModuleLinear.pte", pkg=__package__)
1919

2020

2121
class TestGenOplistRealModel(unittest.TestCase):

docs/website/docs/tutorials/00_setting_up_executorch.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ pip install .
5151

5252
Via python script:
5353
```bash
54-
# Creates the file `add.ff`
54+
# Creates the file `add.pte`
5555
python3 -m examples.export.export_example --model_name="add"
5656

57-
# Creates the delegated program `composite_model.ff`, other options are "whole" and "partition"
57+
# Creates the delegated program `composite_model.pte`, other options are "whole" and "partition"
5858
python3 -m examples.export.export_and_delegate --option "composite"
5959
```
6060

@@ -65,7 +65,7 @@ $ python3
6565
>>> from executorch.exir.tests.models import Mul
6666
>>> m = Mul()
6767
>>> print(exir.capture(m, m.get_random_inputs()).to_edge())
68-
>>> open("add.ff", "wb").write(exir.capture(m, m.get_random_inputs()).to_edge().to_executorch().buffer)
68+
>>> open("add.pte", "wb").write(exir.capture(m, m.get_random_inputs()).to_edge().to_executorch().buffer)
6969
```
7070

7171
## Runtime Setup
@@ -119,17 +119,17 @@ conda install -c conda-forge lld
119119
### Step 3: Run a binary
120120

121121
```bash
122-
# add.ff is the program generated from export_example.py during AOT Setup Step 3
123-
/tmp/buck2 run //examples/executor_runner:executor_runner -- --model_path add.ff
122+
# add.pte is the program generated from export_example.py during AOT Setup Step 3
123+
/tmp/buck2 run //examples/executor_runner:executor_runner -- --model_path add.pte
124124

125125
# To run a delegated model
126-
/tmp/buck2 run //examples/executor_runner:executor_runner -- --model_path composite_model.ff
126+
/tmp/buck2 run //examples/executor_runner:executor_runner -- --model_path composite_model.pte
127127
```
128128

129129
or execute the binary directly from the `--show-output` path shown when building.
130130

131131
```bash
132-
./buck-out/.../executor_runner --model_path add.ff
132+
./buck-out/.../executor_runner --model_path add.pte
133133
```
134134

135135
## More examples

docs/website/docs/tutorials/backend_delegate.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ model_inputs = (torch.ones(1), )
202202
exec_prog = exir.capture(composite_model, model_inputs).to_edge().to_executorch()
203203

204204
# Save the flatbuffer to a local file
205-
save_path = "delegate.fft"
205+
save_path = "delegate.pte"
206206
with open(save_path, "wb") as f:
207207
f.write(exec_prog.buffer)
208208
```
@@ -257,7 +257,7 @@ exec_prog = to_backend(gm, AddMulPartitionerDemo).to_executorch(
257257
)
258258

259259
# Save the flatbuffer to a local file
260-
save_path = "delegate.fft"
260+
save_path = "delegate.pte"
261261
with open(save_path, "wb") as f:
262262
f.write(exec_prog.buffer)
263263
```

docs/website/docs/tutorials/exporting_to_executorch.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ executorch_program = edge_dialect.to_executorch(executorch_backend_config)
196196
buffer = executorch_program.buffer
197197

198198
# Save it to a file and load it in the Executorch runtime
199-
with open("model.ff", "wb") as file:
199+
with open("model.pte", "wb") as file:
200200
file.write(buffer)
201201

202202
# Or you can run the Executorch runtime in python to try it out

docs/website/docs/tutorials/profiling.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Here is an example of what a ExecuTorch run + profile + post-procesing workflow
5656
This runs the sample program with profiling enabled
5757
```bash
5858
cd executorch
59-
buck2 run -c executorch.prof_enabled=true examples/executor_runner:executor_runner -- --model_path add.ff
59+
buck2 run -c executorch.prof_enabled=true examples/executor_runner:executor_runner -- --model_path add.pte
6060
```
6161
Run the post-processing CLI tool that calls into the same API's listed above and prints out the profiling results in a tabulated format in the terminal.
6262

docs/website/docs/tutorials/selective_build.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ load("@fbsource//xplat/executorch/codegen:codegen.bzl", "et_operator_library")
3232

3333
fb_native.export_file(
3434
name = "model_1",
35-
src = "model_1.ff", # checked in model
35+
src = "model_1.pte", # checked in model
3636
)
3737

3838
et_operator_library(

examples/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ bash examples/install_requirements.sh
3636

3737
python3 -m examples.export.export_example --model_name="mv2" # for MobileNetv2
3838

39-
# This should generate ./mv2.ff file, if successful.
39+
# This should generate ./mv2.pte file, if successful.
4040
```
4141

4242
3. Once we have the model binary (ff) file, then let's run it with Executorch runtime using the `executor_runner`.
4343

4444
```bash
45-
buck2 run examples/executor_runner:executor_runner -- --model_path mv2.ff
45+
buck2 run examples/executor_runner:executor_runner -- --model_path mv2.pte
4646
```
4747

4848
For MobileNetv3, change the model name and the corrosponding binary filename from "mv2" to "mv3".

examples/executor_runner/executor_runner.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@
3232
static constexpr size_t kRuntimeMemorySize = 4 * 1024U * 1024U; // 4 MB
3333
static uint8_t runtime_pool[kRuntimeMemorySize];
3434

35-
DEFINE_string(model_path, "model.ff", "Model serialized in flatbuffer format.");
35+
DEFINE_string(
36+
model_path,
37+
"model.pte",
38+
"Model serialized in flatbuffer format.");
3639
DEFINE_string(
3740
prof_result_path,
3841
"prof_result.bin",

examples/export/export_and_delegate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def forward(self, *args):
8484
buffer = exec_prog.buffer
8585

8686
model_name = "composite_model"
87-
filename = f"{model_name}.ff"
87+
filename = f"{model_name}.pte"
8888
print(f"Saving exported program to {filename}")
8989
with open(filename, "wb") as file:
9090
file.write(buffer)
@@ -134,7 +134,7 @@ def get_example_inputs(self):
134134
buffer = exec_prog.buffer
135135

136136
model_name = "partition_lowered_model"
137-
filename = f"{model_name}.ff"
137+
filename = f"{model_name}.pte"
138138
print(f"Saving exported program to {filename}")
139139
with open(filename, "wb") as file:
140140
file.write(buffer)

examples/export/export_example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def export_to_ff(model_name, model, example_inputs):
2626

2727
buffer = exec_prog.buffer
2828

29-
filename = f"{model_name}.ff"
29+
filename = f"{model_name}.pte"
3030
print(f"Saving exported program to {filename}")
3131
with open(filename, "wb") as file:
3232
file.write(buffer)

exir/scripts/serialize.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ def test() -> None:
2424
with open("boop.pkl", "wb") as f:
2525
pickle.dump(program, f)
2626

27-
save_serialized_model("boop.pkl", "moop.ff")
27+
save_serialized_model("boop.pkl", "moop.pte")
2828

29-
with open("moop.ff", "rb") as f:
29+
with open("moop.pte", "rb") as f:
3030
serialized_flatbuffer_loaded = f.read()
3131

3232
assert serialized_flatbuffer_og == serialized_flatbuffer_loaded

exir/serialize/_flatbuffer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ def _program_json_to_flatbuffer(
265265
)
266266
file_stem = "data"
267267
json_path = os.path.join(temp_dir, file_stem + ".json")
268-
output_path = os.path.join(temp_dir, file_stem + ".extorch")
268+
output_path = os.path.join(temp_dir, file_stem + ".pte")
269269

270270
with open(json_path, "wb") as json_file:
271271
json_file.write(program_json.encode("ascii"))

runtime/executor/test/targets.bzl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ def define_common_targets(is_fbcode = False):
7878
# The tests use this var to find the program file to load. This uses
7979
# an fbcode target path because the authoring/export tools
8080
# intentionally don't work in xplat (since they're host-only tools).
81-
"ET_MODULE_ADD_PATH": "$(location fbcode//executorch/test/models:exported_programs[ModuleAdd.ff])",
82-
"ET_MODULE_MULTI_ENTRY_PATH": "$(location fbcode//executorch/test/models:exported_programs[ModuleMultipleEntry.ff])",
81+
"ET_MODULE_ADD_PATH": "$(location fbcode//executorch/test/models:exported_programs[ModuleAdd.pte])",
82+
"ET_MODULE_MULTI_ENTRY_PATH": "$(location fbcode//executorch/test/models:exported_programs[ModuleMultipleEntry.pte])",
8383
}
8484

8585
runtime.cxx_test(
@@ -173,8 +173,8 @@ def define_common_targets(is_fbcode = False):
173173
# Uses an fbcode target path because the authoring/export tools
174174
# intentionally don't work in xplat (since they're host-only
175175
# tools).
176-
"ET_MODULE_ADD_MUL_NOSEGMENTS_DA1024_PATH": "$(location fbcode//executorch/test/models:exported_delegated_programs[ModuleAddMul-nosegments-da1024.ff])",
177-
"ET_MODULE_ADD_MUL_NOSEGMENTS_PATH": "$(location fbcode//executorch/test/models:exported_delegated_programs[ModuleAddMul-nosegments.ff])",
178-
"ET_MODULE_ADD_MUL_PATH": "$(location fbcode//executorch/test/models:exported_delegated_programs[ModuleAddMul.ff])",
176+
"ET_MODULE_ADD_MUL_NOSEGMENTS_DA1024_PATH": "$(location fbcode//executorch/test/models:exported_delegated_programs[ModuleAddMul-nosegments-da1024.pte])",
177+
"ET_MODULE_ADD_MUL_NOSEGMENTS_PATH": "$(location fbcode//executorch/test/models:exported_delegated_programs[ModuleAddMul-nosegments.pte])",
178+
"ET_MODULE_ADD_MUL_PATH": "$(location fbcode//executorch/test/models:exported_delegated_programs[ModuleAddMul.pte])",
179179
},
180180
)

schema/schema.fbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace executorch_flatbuffer;
1111
// Identifier of a valid executor schema.
1212
file_identifier "ET12";
1313
// Extension of written files.
14-
file_extension "extorch";
14+
file_extension "pte";
1515

1616
// Table that contains the metadata about how
1717
// to unflatten the flattened input/output from compiler

scripts/test_executorch_jarvis.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77

88
buck run @fbcode//on_device_ai/Assistant/Jarvis/mode/Harmony_HiFi4_Opus_Tie_5/dev-eh \
99
fbcode//on_device_ai/Assistant/Jarvis/min_runtime:min_runtime_size_test -- \
10-
fbcode/executorch/test/models/linear_out.ff
10+
fbcode/executorch/test/models/linear_out.pte

sdk/runners/executor_runner.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,10 @@ DEFINE_bool(print_output, false, "Prints output of the model.");
6969

7070
DEFINE_int32(num_iters, 1, "Number of inference iterations to run.");
7171

72-
DEFINE_string(model_path, "model.ff", "Model serialized in flatbuffer format.");
72+
DEFINE_string(
73+
model_path,
74+
"model.pte",
75+
"Model serialized in flatbuffer format.");
7376

7477
DEFINE_int32(num_threads, 1, "Number of threads to use.");
7578

test/models/export_delegated_program.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
from executorch.backends.test.backend_with_compiler_demo import BackendWithCompilerDemo
1919
from torch import nn
2020

21-
"""Traces and exports delegated nn.Modules to Executorch .ff program files.
21+
"""Traces and exports delegated nn.Modules to Executorch .pte program files.
2222
2323
Creates two versions of each file:
24-
- <module-name>.ff: Delegate data stored in segments outside of the flatbuffer data.
25-
- <module-name>-nosegments.ff: Delegate data is stored directly in the flatbuffer data.
24+
- <module-name>.pte: Delegate data stored in segments outside of the flatbuffer data.
25+
- <module-name>-nosegments.pte: Delegate data is stored directly in the flatbuffer data.
2626
2727
This tool mainly exists to export programs for C++ tests, but can also
2828
be used to export models manually.
@@ -131,7 +131,7 @@ def main() -> None:
131131
# when possible.
132132
parser = argparse.ArgumentParser(
133133
prog="export_delegated_program",
134-
description="Exports delegated nn.Module models to Executorch .ff files",
134+
description="Exports delegated nn.Module models to Executorch .pte files",
135135
)
136136
parser.add_argument(
137137
"--modules",
@@ -150,7 +150,7 @@ def main() -> None:
150150
"--outdir",
151151
type=str,
152152
required=True,
153-
help="Path to the directory to write <classname>[-<suffix>[...]].ff "
153+
help="Path to the directory to write <classname>[-<suffix>[...]].pte "
154154
+ "files to.",
155155
)
156156
args = parser.parse_args()
@@ -174,7 +174,7 @@ def main() -> None:
174174
# the data to accidentally be aligned to it in the default case.
175175
for delegate_alignment in (None, 1024):
176176
suffix += f"-da{delegate_alignment}" if delegate_alignment else ""
177-
outfile = os.path.join(args.outdir, f"{module_name}{suffix}.ff")
177+
outfile = os.path.join(args.outdir, f"{module_name}{suffix}.pte")
178178
with open(outfile, "wb") as fp:
179179
fp.write(
180180
export_module_to_program(

test/models/export_program.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from executorch.test.end2end.exported_module import ExportedModule
1515
from torch import nn
1616

17-
"""Traces and exports nn.Modules to Executorch .ff program files.
17+
"""Traces and exports nn.Modules to Executorch .pte program files.
1818
1919
This tool mainly exists to export programs for C++ tests, but can also
2020
be used to export models manually.
@@ -130,7 +130,7 @@ def main() -> None:
130130
# when possible.
131131
parser = argparse.ArgumentParser(
132132
prog="export_program",
133-
description="Exports nn.Module models to Executorch .ff files",
133+
description="Exports nn.Module models to Executorch .pte files",
134134
)
135135
parser.add_argument(
136136
"--modules",
@@ -142,7 +142,7 @@ def main() -> None:
142142
"--outdir",
143143
type=str,
144144
required=True,
145-
help="Path to the directory to write <classname>.ff files to",
145+
help="Path to the directory to write <classname>.pte files to",
146146
)
147147
args = parser.parse_args()
148148

@@ -158,7 +158,7 @@ def main() -> None:
158158
# Export and write to the output files.
159159
os.makedirs(args.outdir, exist_ok=True)
160160
for module_name, module_class in module_names_to_classes.items():
161-
outfile = os.path.join(args.outdir, f"{module_name}.ff")
161+
outfile = os.path.join(args.outdir, f"{module_name}.pte")
162162
with open(outfile, "wb") as fp:
163163
fp.write(export_module_to_program(module_class))
164164
print(f"Exported {module_name} and wrote program data to {outfile}")

test/models/generate_linear_out_bundled_program.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def main() -> None:
101101
subprocess.run(["hg", "root"], stdout=subprocess.PIPE).stdout.decode().strip()
102102
)
103103
with open(
104-
f"{fbsource_base_path}/fbcode/executorch/test/models/linear_out_bundled_program.ff",
104+
f"{fbsource_base_path}/fbcode/executorch/test/models/linear_out_bundled_program.pte",
105105
"wb",
106106
) as file:
107107
file.write(bundled_program_flatbuffer)

test/models/targets.bzl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@ def define_common_targets():
6565
"ModuleMultipleEntry",
6666
]
6767

68-
# Generates Executorch .ff program files for various modules at build time.
69-
# To use one, depend on a target like ":exported_programs[ModuleAdd.ff]".
68+
# Generates Executorch .pte program files for various modules at build time.
69+
# To use one, depend on a target like ":exported_programs[ModuleAdd.pte]".
7070
runtime.genrule(
7171
name = "exported_programs",
7272
cmd = "$(exe :export_program) --modules " + ",".join(MODULES_TO_EXPORT) + " --outdir $OUT",
73-
outs = {fname + ".ff": [fname + ".ff"] for fname in MODULES_TO_EXPORT},
73+
outs = {fname + ".pte": [fname + ".pte"] for fname in MODULES_TO_EXPORT},
7474
default_outs = ["."],
7575
visibility = [
7676
"//executorch/...",
@@ -121,10 +121,10 @@ def define_common_targets():
121121
# Name of the backend to use when exporting delegated programs.
122122
BACKEND_ID = "StubBackend"
123123

124-
# Generates Executorch .ff program files for various modules at build time.
124+
# Generates Executorch .pte program files for various modules at build time.
125125
# To use one, depend on a target like
126-
# ":exported_delegated_programs[ModuleAdd.ff]" or
127-
# ":exported_delegated_programs[ModuleAdd-nosegments.ff]" (which does not
126+
# ":exported_delegated_programs[ModuleAdd.pte]" or
127+
# ":exported_delegated_programs[ModuleAdd-nosegments.pte]" (which does not
128128
# extract the delegate data blobs into segments).
129129
runtime.genrule(
130130
name = "exported_delegated_programs",
@@ -133,7 +133,7 @@ def define_common_targets():
133133
" --backend_id " + BACKEND_ID +
134134
" --outdir $OUT",
135135
outs = {
136-
fname + seg_suffix + da_suffix + ".ff": [fname + seg_suffix + da_suffix + ".ff"]
136+
fname + seg_suffix + da_suffix + ".pte": [fname + seg_suffix + da_suffix + ".pte"]
137137
for fname in DELEGATED_MODULES_TO_EXPORT
138138
for seg_suffix in ["", "-nosegments"]
139139
# "da" = delegate alignment

0 commit comments

Comments
 (0)