load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target")
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")

oncall("executorch")

# Exposed through __init__.py
fbcode_target(
    _kind = runtime.python_library,
    name = "quantization_config",
    srcs = ["quantization_config.py"],
    deps = [
        "//caffe2:torch",
        "//pytorch/ao:torchao",
    ],
)

fbcode_target(
    _kind = runtime.python_library,
    name = "arm_quantizer",
    srcs = ["arm_quantizer.py"],
    deps = [
        ":arm_quantizer_utils",
        ":quantization_annotator",
        ":quantizer_support",
        "//executorch/backends/arm:constants",
        "//executorch/backends/arm:ethosu",
        "//executorch/backends/arm:vgf",
        "//executorch/backends/cortex_m/quantizer:quantizer",
        "//executorch/backends/arm/tosa:specification",
        "//executorch/backends/arm:arm_compile_spec",
        "//caffe2:torch",
        "//executorch/exir:lib",
        "//pytorch/ao:torchao",
    ],
)

fbcode_target(
    _kind = runtime.python_library,
    name = "quantization_annotator",
    srcs = ["quantization_annotator.py"],
    deps = [
        ":arm_quantizer_utils",
        ":quantization_config",
        "//caffe2:torch",
        "//pytorch/ao:torchao",
    ],
)

fbcode_target(
    _kind = runtime.python_library,
    name = "arm_quantizer_utils",
    srcs = ["arm_quantizer_utils.py"],
    deps = [
        "//caffe2:torch",
        "//executorch/backends/arm:common",
        "//executorch/backends/arm:constants",
        ":quantization_config",
        "//pytorch/ao:torchao",
    ],
)

fbcode_target(
    _kind = runtime.python_library,
    name = "quantizer_support",
    srcs = ["quantizer_support.py"],
    deps = [
        ":quantization_annotator",
        "//caffe2:torch",
        "//executorch/backends/cortex_m/quantizer:quantizer",
    ],
)

fbcode_target(
    _kind = runtime.python_library,
    name = "lib",
    srcs = ["__init__.py"],
    deps = [
        ":arm_quantizer",
        ":quantization_config",
        ":arm_quantizer_utils",
    ]
)
