Skip to content

Commit 6abe901

Browse files
authored
Arm backend: Shorten input names passed to the FVP (pytorch#15412)
Modify the backends/arm/test/runner_utils.py so that we pass relative paths to the FVP. This is to allow us get around the 256 char limit on the FVP and enables testing of the slice operator for 16x8. Solves internal ticket MLETORCH-1403.
1 parent c85ece4 commit 6abe901

File tree

3 files changed

+20
-30
lines changed

3 files changed

+20
-30
lines changed

backends/arm/test/ops/test_slice.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,7 @@ def test_slice_tensor_tosa_INT_nhwc(test_data: torch.Tensor):
7676
pipeline.run()
7777

7878

79-
x_fails = {
80-
"ones_slice_3": "MLETORCH-1402: Compiler limitation when passing more than 255 char as argument to FVP.",
81-
"ones_slice_4": "MLETORCH-1402: Compiler limitation when passing more than 255 char as argument to FVP.",
82-
}
83-
84-
85-
@common.parametrize("test_data", test_data_suite, x_fails)
79+
@common.parametrize("test_data", test_data_suite)
8680
@common.XfailIfNoCorstone300
8781
def test_slice_tensor_u55_INT(test_data: torch.Tensor):
8882
pipeline = EthosU55PipelineINT[input_t1](
@@ -94,7 +88,7 @@ def test_slice_tensor_u55_INT(test_data: torch.Tensor):
9488
pipeline.run()
9589

9690

97-
@common.parametrize("test_data", test_data_suite, x_fails)
91+
@common.parametrize("test_data", test_data_suite)
9892
@common.XfailIfNoCorstone320
9993
def test_slice_tensor_u85_INT(test_data: torch.Tensor):
10094
pipeline = EthosU85PipelineINT[input_t1](
@@ -175,7 +169,7 @@ def test_slice_tensor_16a8w_tosa_INT(test_data: torch.Tensor):
175169
pipeline.run()
176170

177171

178-
@common.parametrize("test_data", test_data_suite, x_fails)
172+
@common.parametrize("test_data", test_data_suite)
179173
@common.XfailIfNoCorstone300
180174
def test_slice_tensor_16a8w_u55_INT16(test_data: torch.Tensor):
181175
"""Test slice operation with 16A8W quantization on U55 (16-bit activations, 8-bit weights)"""
@@ -199,7 +193,7 @@ def test_slice_tensor_16a8w_u55_INT16(test_data: torch.Tensor):
199193
pipeline.run()
200194

201195

202-
@common.parametrize("test_data", test_data_suite, x_fails)
196+
@common.parametrize("test_data", test_data_suite)
203197
@common.XfailIfNoCorstone320
204198
def test_slice_tensor_16a8w_u85_INT16(test_data: torch.Tensor):
205199
"""Test slice operation with 16A8W quantization on U85 (16-bit activations, 8-bit weights)"""

backends/arm/test/ops/test_split.py

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -139,17 +139,7 @@ def test_split_with_sizes_tosa_INT(test_data: input_t1):
139139
pipeline.run()
140140

141141

142-
x_fails = {
143-
"split_3d_2_sizes_dim": "MLETORCH-1403: Split operator is running out of memory when reading input file",
144-
"split_4d_2_sizes_dim_neg": "MLETORCH-1403: Split operator is running out of memory when reading input file",
145-
}
146-
147-
148-
@common.parametrize(
149-
"test_data",
150-
(Split.test_data | Split.test_data_list),
151-
x_fails,
152-
)
142+
@common.parametrize("test_data", (Split.test_data | Split.test_data_list))
153143
@common.XfailIfNoCorstone300
154144
def test_split_with_sizes_u55_INT(test_data: input_t1):
155145
pipeline = EthosU55PipelineINT[input_t1](
@@ -161,11 +151,7 @@ def test_split_with_sizes_u55_INT(test_data: input_t1):
161151
pipeline.run()
162152

163153

164-
@common.parametrize(
165-
"test_data",
166-
(Split.test_data | Split.test_data_list),
167-
x_fails,
168-
)
154+
@common.parametrize("test_data", (Split.test_data | Split.test_data_list))
169155
@common.XfailIfNoCorstone320
170156
def test_split_with_sizes_u85_INT(test_data: input_t1):
171157
pipeline = EthosU85PipelineINT[input_t1](

backends/arm/test/runner_utils.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,6 @@ def run_corstone(
384384
to figure out the shape and dtype of the buffer that was
385385
output from the FVP.
386386
"""
387-
388387
exported_program = executorch_program_manager.exported_program()
389388
intermediate_path = Path(intermediate_path)
390389
intermediate_path.mkdir(exist_ok=True)
@@ -400,11 +399,18 @@ def run_corstone(
400399
input_paths = save_inputs_to_file(exported_program, inputs, intermediate_path)
401400

402401
output_base_name = "out"
403-
out_path = os.path.join(intermediate_path, output_base_name)
404402

405-
cmd_line = f"executor_runner -m {pte_path} -o {out_path}"
403+
cmd_line = "executor_runner -m program.pte -o out"
406404
for input_path in input_paths:
407-
cmd_line += f" -i {input_path}"
405+
relative_path = os.path.relpath(
406+
Path(input_path).resolve(), start=intermediate_path
407+
)
408+
cmd_line += f" -i {relative_path}"
409+
410+
if len(cmd_line) > 256:
411+
raise ValueError(
412+
"The argument passed to the FVP should be less than 256 characters long, otherwise it gets truncated"
413+
)
408414

409415
ethos_u_extra_args = ""
410416
if is_option_enabled("fast_fvp"):
@@ -431,6 +437,8 @@ def run_corstone(
431437
"-C",
432438
"cpu0.semihosting-heap_limit=0",
433439
"-C",
440+
f"cpu0.semihosting-cwd={intermediate_path}",
441+
"-C",
434442
f"cpu0.semihosting-cmd_line='{cmd_line}'",
435443
"-a",
436444
str(elf_path),
@@ -461,6 +469,8 @@ def run_corstone(
461469
"-C",
462470
"mps4_board.subsystem.cpu0.semihosting-heap_limit=0",
463471
"-C",
472+
f"mps4_board.subsystem.cpu0.semihosting-cwd={intermediate_path}",
473+
"-C",
464474
f"mps4_board.subsystem.ethosu.extra_args='{ethos_u_extra_args}'",
465475
"-C",
466476
f"mps4_board.subsystem.cpu0.semihosting-cmd_line='{cmd_line}'",

0 commit comments

Comments
 (0)