Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .lintrunner.toml
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ exclude_patterns = [
'**/*.gif',
'extension/llm/tokenizers',
'extension/llm/tokenizers/**',
'backends/cadence/utils/FACTO',
'examples/cuda',
'kernels/portable',
# File contains @generated
Expand Down
1 change: 1 addition & 0 deletions backends/cadence/aot/export_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,5 @@ def export_and_run_model(
working_dir=working_dir,
eps_error=eps_error,
eps_warn=eps_warn,
file_name=file_name,
)
5 changes: 4 additions & 1 deletion backends/cadence/aot/tests/test_pass_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ def setUp(self) -> None:

def tearDown(self) -> None:
# Restore _all_passes to original state before test.
pass_utils.ALL_CADENCE_PASSES = self._all_passes_original
# Use clear()+update() instead of rebinding to keep the same dict object
# that the module-level ALL_CADENCE_PASSES import references.
pass_utils.ALL_CADENCE_PASSES.clear()
pass_utils.ALL_CADENCE_PASSES.update(self._all_passes_original)

def get_filtered_passes(
self, filter_: Callable[[Type[PassBase]], bool]
Expand Down
3 changes: 2 additions & 1 deletion backends/cadence/runtime/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,12 @@ class Executor:
def __init__(
self,
working_dir: str = "",
file_name: str = "CadenceDemoModel",
):
self.working_dir = working_dir
self.executor_builder = "./backends/cadence/build_cadence_runner.sh"
self.execute_runner = "./cmake-out/backends/cadence/cadence_runner"
self.bundled_program_path: str = "CadenceDemoModel.bpte"
self.bundled_program_path: str = f"{file_name}.bpte"

def __call__(self) -> None:
# build executor
Expand Down
8 changes: 6 additions & 2 deletions backends/cadence/runtime/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def run(
inputs: Any,
ref_outputs: Optional[Sequence[torch.Tensor]] = None,
working_dir: Optional[str] = None,
file_name: str = "CadenceDemoModel",
) -> Any:
# Get the Program
program = executorch_prog.executorch_program
Expand All @@ -69,7 +70,7 @@ def run(
working_dir = tempfile.mkdtemp(dir="/tmp")

# initialize e2e Executor with executorch_cfg.
executor = Executor(working_dir)
executor = Executor(working_dir, file_name=file_name)

# run Executor
executor()
Expand Down Expand Up @@ -136,8 +137,11 @@ def run_and_compare(
working_dir: Optional[str] = None,
eps_error: float = 1e-1,
eps_warn: float = 1e-5,
file_name: str = "CadenceDemoModel",
) -> Any:
outputs = run(executorch_prog, inputs, ref_outputs, working_dir)
outputs = run(
executorch_prog, inputs, ref_outputs, working_dir, file_name=file_name
)
compare(outputs, ref_outputs, eps_error=eps_error, eps_warn=eps_warn)


Expand Down
2 changes: 1 addition & 1 deletion backends/cadence/utils/FACTO
Submodule FACTO updated from 1db37f to 3b8c77
4 changes: 1 addition & 3 deletions examples/cadence/operators/test_g3_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
class ATenOpTestCases(unittest.TestCase):
def run_and_verify(self, model: nn.Module, inputs: Tuple[Any, ...]) -> None:
model.eval()
export_and_run_model(
model, inputs, file_name=self._testMethodName, run_and_compare=False
)
export_and_run_model(model, inputs, file_name=self._testMethodName)

# pyre-ignore[16]: Module `parameterized.parameterized` has no attribute `expand`.
@parameterized.expand([*facto_util.facto_testcase_gen("add.Tensor")])
Expand Down
Loading