Skip to content

Commit

Permalink
Move qualcomm.passes to qualcomm._passes (pytorch#5920)
Browse files Browse the repository at this point in the history
Summary:
Changing qualcomm.passes to qualcomm._passes to indicate that these passes are not covered under the API stability guarantee.

Pull Request resolved: pytorch#5920

Reviewed By: helunwencser

Differential Revision: D63926845

fbshipit-source-id: f1e3187f3012f83b388d9635ca5a244fa36950d6
(cherry picked from commit 866b40c)
  • Loading branch information
tarun292 committed Oct 10, 2024
1 parent 14b594f commit 26f5e39
Show file tree
Hide file tree
Showing 30 changed files with 58 additions and 35 deletions.
2 changes: 1 addition & 1 deletion backends/qualcomm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ backends/qualcomm
| └── python # Python interface for using QNN libraries.
├── builders # Codes for lowering each operators (AoT Part).
├── partition # QNN Partitioner (AoT Part).
├── passes # Various passes helping lower models to QNN backend (AoT Part).
├── _passes # Various private passes helping lower models to QNN backend (AoT Part).
├── python # Places to put pybind artifacts for accessing QNN APIs, structures, etc (AoT Part).
├── quantizer # QNN Quantizer
├── runtime # Here is QNN runtime responsbile for compiling a model on x64.
Expand Down
18 changes: 18 additions & 0 deletions backends/qualcomm/_passes/TARGETS
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")

oncall("executorch")

runtime.python_library(
name = "passes",
srcs = glob([
"*.py",
]),
visibility = [
"@EXECUTORCH_CLIENTS",
],
deps = [
"//executorch/backends/transforms:addmm_mm_to_linear",
"//executorch/exir/backend:backend_details",
"//executorch/exir/backend:compile_spec_schema",
],
)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 7 additions & 7 deletions backends/qualcomm/qnn_preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
import executorch.backends.qualcomm.python.PyQnnManagerAdaptor as PyQnnManager

import torch # noqa: F401
from executorch.backends.qualcomm.builders.node_visitor import get_node_visitors
from executorch.backends.qualcomm.builders.qnn_constants import OpContextLoader
from executorch.backends.qualcomm.passes.convert_to_linear import ConvertToLinear
from executorch.backends.qualcomm.passes.fuse_consecutive_transpose import (
from executorch.backends.qualcomm._passes.convert_to_linear import ConvertToLinear
from executorch.backends.qualcomm._passes.fuse_consecutive_transpose import (
FuseConsecutiveTranspose,
)
from executorch.backends.qualcomm.passes.insert_io_qdq import InsertIOQDQ
from executorch.backends.qualcomm.passes.insert_requantize import InsertRequantize
from executorch.backends.qualcomm.passes.layout_transform import LayoutTransform
from executorch.backends.qualcomm._passes.insert_io_qdq import InsertIOQDQ
from executorch.backends.qualcomm._passes.insert_requantize import InsertRequantize
from executorch.backends.qualcomm._passes.layout_transform import LayoutTransform
from executorch.backends.qualcomm.builders.node_visitor import get_node_visitors
from executorch.backends.qualcomm.builders.qnn_constants import OpContextLoader
from executorch.backends.qualcomm.utils.utils import generate_qnn_executorch_option
from executorch.exir.backend.backend_details import (
BackendDetails,
Expand Down
8 changes: 4 additions & 4 deletions backends/qualcomm/quantizer/quantizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
from typing import Callable, Dict, Optional, Sequence, Set

import torch
from executorch.backends.qualcomm.passes.decompose_silu import DecomposeSilu
from executorch.backends.qualcomm.passes.recompose_pixel_unshuffle import (
from executorch.backends.qualcomm._passes.decompose_silu import DecomposeSilu
from executorch.backends.qualcomm._passes.recompose_pixel_unshuffle import (
RecomposePixelUnshuffle,
)
from executorch.backends.qualcomm.passes.reduce_dynamic_range import ReduceDynamicRange
from executorch.backends.qualcomm.passes.replace_inf_buffer import ReplaceInfBuffer
from executorch.backends.qualcomm._passes.reduce_dynamic_range import ReduceDynamicRange
from executorch.backends.qualcomm._passes.replace_inf_buffer import ReplaceInfBuffer
from executorch.backends.transforms.decompose_sdpa import (
DecomposeScaledDotProductAttention,
)
Expand Down
2 changes: 1 addition & 1 deletion backends/qualcomm/utils/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# Qualcomm specific key

# constants in backends/qualcomm/passes & backends/qualcomm/builders
# constants in backends/qualcomm/_passes & backends/qualcomm/builders
QCOM_AXIS = "axis"
QCOM_AXIS_ORDER = "axis_order"
QCOM_BITWIDTH = "bitwidth"
Expand Down
47 changes: 26 additions & 21 deletions backends/qualcomm/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,37 +14,42 @@
import executorch.exir as exir

import torch

from executorch.backends.qualcomm.builders.node_visitor import (
QNN_QUANT_TYPE_MAP,
QNN_TENSOR_TYPE_MAP,
)
from executorch.backends.qualcomm.builders.qnn_constants import OpContextLoader
from executorch.backends.qualcomm.passes.annotate_and_quant_scalar import (
from executorch.backends.qualcomm._passes.annotate_and_quant_scalar import (
AnnotateAndQuantScalar,
)
from executorch.backends.qualcomm.passes.annotate_decomposed import AnnotateDecomposed
from executorch.backends.qualcomm.passes.annotate_quant_attrs import AnnotateQuantAttrs
from executorch.backends.qualcomm.passes.convert_binary_op_with_scalar import (
from executorch.backends.qualcomm._passes.annotate_decomposed import AnnotateDecomposed
from executorch.backends.qualcomm._passes.annotate_quant_attrs import AnnotateQuantAttrs
from executorch.backends.qualcomm._passes.convert_binary_op_with_scalar import (
ConvertBinaryOpsWithScalar,
)
from executorch.backends.qualcomm.passes.convert_bmm_to_matmul import ConvertBmmToMatmul
from executorch.backends.qualcomm.passes.convert_interpolate_with_upsample2d import (
from executorch.backends.qualcomm._passes.convert_bmm_to_matmul import (
ConvertBmmToMatmul,
)
from executorch.backends.qualcomm._passes.convert_interpolate_with_upsample2d import (
ConvertInterpolateWithUpsample2D,
)
from executorch.backends.qualcomm.passes.convert_prelu import ConvertPReLU
from executorch.backends.qualcomm.passes.convert_to_linear import ConvertToLinear
from executorch.backends.qualcomm.passes.fold_qdq import FoldQDQ
from executorch.backends.qualcomm.passes.i64_to_i32 import I64toI32
from executorch.backends.qualcomm.passes.layout_transform import LayoutTransform
from executorch.backends.qualcomm.passes.recompose_pixel_unshuffle import (
from executorch.backends.qualcomm._passes.convert_prelu import ConvertPReLU
from executorch.backends.qualcomm._passes.convert_to_linear import ConvertToLinear
from executorch.backends.qualcomm._passes.fold_qdq import FoldQDQ
from executorch.backends.qualcomm._passes.i64_to_i32 import I64toI32
from executorch.backends.qualcomm._passes.layout_transform import LayoutTransform
from executorch.backends.qualcomm._passes.recompose_pixel_unshuffle import (
RecomposePixelUnshuffle,
)
from executorch.backends.qualcomm.passes.recompose_rms_norm import RecomposeRmsNorm
from executorch.backends.qualcomm.passes.remove_redundancy import RemoveRedundancy
from executorch.backends.qualcomm.passes.replace_index_put_input import (
from executorch.backends.qualcomm._passes.recompose_rms_norm import RecomposeRmsNorm
from executorch.backends.qualcomm._passes.remove_redundancy import RemoveRedundancy
from executorch.backends.qualcomm._passes.replace_index_put_input import (
ReplaceIndexPutInput,
)

from executorch.backends.qualcomm.builders.node_visitor import (
QNN_QUANT_TYPE_MAP,
QNN_TENSOR_TYPE_MAP,
)
from executorch.backends.qualcomm.builders.qnn_constants import OpContextLoader
from executorch.backends.qualcomm.passes.expand_broadcast_tensor_shape import (
ExpandBroadcastTensorShape,
)
from executorch.backends.qualcomm.serialization.qnn_compile_spec_schema import (
_soc_info_table,
QcomChipset,
Expand Down
2 changes: 1 addition & 1 deletion examples/qualcomm/oss_scripts/llama2/llama.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
from multiprocessing.connection import Client

import torch
from executorch.backends.qualcomm._passes.build_quant_io import BuildQuantIo

from executorch.backends.qualcomm.partition.qnn_partitioner import QnnPartitioner
from executorch.backends.qualcomm.passes.build_quant_io import BuildQuantIo

from executorch.backends.qualcomm.quantizer.quantizer import QuantDtype
from executorch.backends.qualcomm.serialization.qnn_compile_spec_schema import (
Expand Down

0 comments on commit 26f5e39

Please sign in to comment.