Skip to content

[cadece][g3][facto] enable facto generation on G3 operators #8202

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
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
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,6 @@
[submodule "third-party/ao"]
path = third-party/ao
url = https://github.com/pytorch/ao.git
[submodule "backends/cadence/utils/FACTO"]
path = backends/cadence/utils/FACTO
url = https://github.com/pytorch-labs/FACTO.git
7 changes: 6 additions & 1 deletion backends/cadence/install_requirements.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ EXECUTORCH_ROOT_PATH=$(realpath "$SCRIPT_DIR_PATH/../../")
CADENCE_DIR_PATH="$EXECUTORCH_ROOT_PATH/backends/cadence"
HIFI_DIR_PATH="$CADENCE_DIR_PATH/hifi/third-party/nnlib/nnlib-hifi4"
FUSION_DIR_PATH="$CADENCE_DIR_PATH/fusion_g3/third-party/nnlib/nnlib-FusionG3"
FACTO_DIR_PATH="$CADENCE_DIR_PATH/utils/FACTO"

cd "$EXECUTORCH_ROOT_PATH"

## HiFi
## HiFi

rm -rf "$HIFI_DIR_PATH"
mkdir -p "$HIFI_DIR_PATH"
Expand Down Expand Up @@ -47,3 +48,7 @@ if [ $STATUS -ne 0 ]; then
fi

git checkout 11230f47b587b074ba0881deb28beb85db566ac2


## FACTO
pip install -e $FACTO_DIR_PATH
1 change: 1 addition & 0 deletions backends/cadence/utils/FACTO
Submodule FACTO added at 1db37f
5 changes: 5 additions & 0 deletions backends/cadence/utils/TARGETS
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
load("targets.bzl", "define_common_targets")

oncall("odai_jarvis")

define_common_targets()
20 changes: 20 additions & 0 deletions backends/cadence/utils/targets.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright (c) Meta Platforms, Inc. and 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.
load("@fbcode_macros//build_defs:python_library.bzl", "python_library")


def define_common_targets():
python_library(
name = "facto_util",
srcs = [
"facto_util.py",
],
typing = True,
deps = [
"fbcode//caffe2:torch",
"fbcode//pytorch/facto:facto",
],
)
15 changes: 1 addition & 14 deletions examples/cadence/operators/targets.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,6 @@ def define_common_targets():
for op in TESTS_LIST:
_define_test_target(op)

python_library(
name = "facto_util",
srcs = [
"facto_util.py",
],
typing = True,
deps = [
"fbcode//caffe2:torch",
"fbcode//pytorch/facto:facto",
],
)


def _define_test_target(test_name):
file_name = "test_{}".format(test_name)
python_unittest(
Expand All @@ -46,6 +33,6 @@ def _define_test_target(test_name):
"fbcode//executorch/backends/cadence/aot:ops_registrations",
"fbcode//executorch/backends/cadence/aot:export_example",
"fbcode//executorch/backends/cadence/aot:compiler",
"fbcode//executorch/examples/cadence/operators:facto_util",
"fbcode//executorch/backends/cadence/utils:facto_util",
],
)
2 changes: 1 addition & 1 deletion examples/cadence/operators/test_g3_ops.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import unittest
from typing import Any, cast, List, OrderedDict, Tuple

from executorch.examples.cadence.operators import facto_util
from executorch.backends.cadence.utils import facto_util

from parameterized import parameterized

Expand Down
Loading