Skip to content

Commit 440a3ac

Browse files
authored
[cadece][g3][facto] enable facto generation on G3 operators
Differential Revision: D69156210 Pull Request resolved: #8202
1 parent 9020fd2 commit 440a3ac

File tree

8 files changed

+37
-16
lines changed

8 files changed

+37
-16
lines changed

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,6 @@
6464
[submodule "third-party/ao"]
6565
path = third-party/ao
6666
url = https://github.com/pytorch/ao.git
67+
[submodule "backends/cadence/utils/FACTO"]
68+
path = backends/cadence/utils/FACTO
69+
url = https://github.com/pytorch-labs/FACTO.git

backends/cadence/install_requirements.sh

+6-1
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ EXECUTORCH_ROOT_PATH=$(realpath "$SCRIPT_DIR_PATH/../../")
1212
CADENCE_DIR_PATH="$EXECUTORCH_ROOT_PATH/backends/cadence"
1313
HIFI_DIR_PATH="$CADENCE_DIR_PATH/hifi/third-party/nnlib/nnlib-hifi4"
1414
FUSION_DIR_PATH="$CADENCE_DIR_PATH/fusion_g3/third-party/nnlib/nnlib-FusionG3"
15+
FACTO_DIR_PATH="$CADENCE_DIR_PATH/utils/FACTO"
1516

1617
cd "$EXECUTORCH_ROOT_PATH"
1718

18-
## HiFi
19+
## HiFi
1920

2021
rm -rf "$HIFI_DIR_PATH"
2122
mkdir -p "$HIFI_DIR_PATH"
@@ -47,3 +48,7 @@ if [ $STATUS -ne 0 ]; then
4748
fi
4849

4950
git checkout 11230f47b587b074ba0881deb28beb85db566ac2
51+
52+
53+
## FACTO
54+
pip install -e $FACTO_DIR_PATH

backends/cadence/utils/FACTO

Submodule FACTO added at 1db37fc

backends/cadence/utils/TARGETS

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
load("targets.bzl", "define_common_targets")
2+
3+
oncall("odai_jarvis")
4+
5+
define_common_targets()
File renamed without changes.

backends/cadence/utils/targets.bzl

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright (c) Meta Platforms, Inc. and affiliates.
2+
# All rights reserved.
3+
#
4+
# This source code is licensed under the BSD-style license found in the
5+
# LICENSE file in the root directory of this source tree.
6+
load("@fbcode_macros//build_defs:python_library.bzl", "python_library")
7+
8+
9+
def define_common_targets():
10+
python_library(
11+
name = "facto_util",
12+
srcs = [
13+
"facto_util.py",
14+
],
15+
typing = True,
16+
deps = [
17+
"fbcode//caffe2:torch",
18+
"fbcode//pytorch/facto:facto",
19+
],
20+
)

examples/cadence/operators/targets.bzl

+1-14
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,6 @@ def define_common_targets():
1818
for op in TESTS_LIST:
1919
_define_test_target(op)
2020

21-
python_library(
22-
name = "facto_util",
23-
srcs = [
24-
"facto_util.py",
25-
],
26-
typing = True,
27-
deps = [
28-
"fbcode//caffe2:torch",
29-
"fbcode//pytorch/facto:facto",
30-
],
31-
)
32-
33-
3421
def _define_test_target(test_name):
3522
file_name = "test_{}".format(test_name)
3623
python_unittest(
@@ -46,6 +33,6 @@ def _define_test_target(test_name):
4633
"fbcode//executorch/backends/cadence/aot:ops_registrations",
4734
"fbcode//executorch/backends/cadence/aot:export_example",
4835
"fbcode//executorch/backends/cadence/aot:compiler",
49-
"fbcode//executorch/examples/cadence/operators:facto_util",
36+
"fbcode//executorch/backends/cadence/utils:facto_util",
5037
],
5138
)

examples/cadence/operators/test_g3_ops.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import unittest
22
from typing import Any, cast, List, OrderedDict, Tuple
33

4-
from executorch.examples.cadence.operators import facto_util
4+
from executorch.backends.cadence.utils import facto_util
55

66
from parameterized import parameterized
77

0 commit comments

Comments
 (0)