Skip to content

Commit dafa082

Browse files
authored
Add missing Buck build targets and module exports for the cortex_m quantizer package (pytorch#16370)
Summary: This diff adds missing Buck build targets and module exports for the cortex_m quantizer package ## Rationale The recent diff-train commit D89549367 added softmax support to the cortex_m backend, which introduced new quantizer files (operator_configs.py, quantization_configs.py, quantizer.py). However, the following were missing: 1. **TARGETS files**: No Buck build targets existed for the quantizer package, making it impossible to depend on these modules from other targets 2. **__init__.py files**: No module exports existed, preventing proper Python package imports 3. **Dependency in ops/TARGETS**: The ops target was missing the quantization_configs dependency needed for the operators module ## Changes - Add `quantizer` and `quantization_configs` Buck targets - Add `__init__.py` with proper exports for quantizer classes and config constants - Add missing `quantization_configs` dependency to `ops/TARGETS` - Use appropriate build macros: `runtime.python_library` for xplat, `python_library` Reviewed By: digantdesai Differential Revision: D89688088
1 parent 92a8ba9 commit dafa082

3 files changed

Lines changed: 56 additions & 0 deletions

File tree

‎backends/cortex_m/ops/TARGETS‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ runtime.python_library(
1717
deps = [
1818
"fbcode//caffe2:torch",
1919
"//executorch/backends/cortex_m/passes:passes_utils",
20+
"//executorch/backends/cortex_m/quantizer:quantization_configs",
2021
],
2122
)
2223

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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+
7+
load("@fbcode_macros//build_defs:python_library.bzl", "python_library")
8+
9+
oncall("executorch")
10+
11+
python_library(
12+
name = "quantizer",
13+
srcs = [
14+
"__init__.py",
15+
"operator_configs.py",
16+
"quantization_configs.py",
17+
"quantizer.py",
18+
],
19+
deps = [
20+
"//caffe2:torch",
21+
"//executorch/backends/arm/quantizer:quantization_config",
22+
"//pytorch/ao:torchao",
23+
],
24+
)
25+
26+
python_library(
27+
name = "quantization_configs",
28+
srcs = [
29+
"quantization_configs.py",
30+
],
31+
deps = [
32+
"//caffe2:torch",
33+
"//executorch/backends/arm/quantizer:quantization_config",
34+
"//pytorch/ao:torchao",
35+
],
36+
)
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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+
7+
from .quantization_configs import ( # noqa
8+
CMSIS_SOFTMAX_SCALE,
9+
CMSIS_SOFTMAX_ZERO_POINT,
10+
INT8_ACTIVATION_PER_CHANNEL_QSPEC,
11+
INT8_ACTIVATION_PER_TENSOR_QSPEC,
12+
INT8_PER_CHANNEL_CONFIG,
13+
INT8_PER_TENSOR_CONFIG,
14+
INT8_WEIGHT_PER_CHANNEL_QSPEC,
15+
INT8_WEIGHT_PER_TENSOR_QSPEC,
16+
SOFTMAX_OUTPUT_FIXED_QSPEC,
17+
SOFTMAX_PER_TENSOR_CONFIG,
18+
)
19+
from .quantizer import CortexMQuantizer, SharedQspecQuantizer # noqa

0 commit comments

Comments
 (0)