Open
[feat] add ci flow #194
culechanAdd on 2 days ago
[feat] add ci flow #194
Open
culechanAdd on 2 days ago
Total: 15 files changed+875-0
@@ -0,0 +1,52 @@
1+# syntax=docker/dockerfile:1
2+# SPDX-License-Identifier: Apache-2.0
3+#
4+# Two-stage image, one stage per test target. Common provisioning lives in
5+# ci/provision-image.sh so the cpu and a5 stages differ only in their base
6+# image, environment and extra packages.
7+ARG CPU_BASE_IMAGE=python:3.12-slim-bookworm
8+ARG A5_BASE_IMAGE=ascendai/9.2.1-950-ubuntu22.04-py3.12
9+ARG ASCEND_REPO=https://gitcode.com/Ascend/torchao-ascend.git
10+ARG ASCEND_BRANCH=main
11+ 
12+FROM ${CPU_BASE_IMAGE} AS cpu
13+ARG MAX_JOBS=32
14+ARG CORPORATE_CA=
15+ARG CI_PIP_INDEX=https://mirrors.huaweicloud.com/repository/pypi/simple
16+ARG ASCEND_REPO
17+ARG ASCEND_BRANCH
18+ENV VIRTUAL_ENV=/opt/venv \
19+ PATH=/opt/venv/bin:${PATH} \
20+ CI_DEVICE=cpu \
21+ CI_PIP_INDEX=${CI_PIP_INDEX} \
22+ PYTHONUNBUFFERED=1
23+COPY ci/ /opt/ci/
24+RUN CORPORATE_CA="$CORPORATE_CA" bash /opt/ci/provision-image.sh cpu
25+RUN git clone --depth=1 --branch "$ASCEND_BRANCH" \
26+ "$ASCEND_REPO" /opt/torchao-ascend
27+RUN MAX_JOBS="$MAX_JOBS" bash /opt/torchao-ascend/ci/install.sh cpu
28+WORKDIR /opt/torchao-ascend
29+ENTRYPOINT ["bash", "/opt/torchao-ascend/ci/entrypoint.sh"]
30+CMD ["bash"]
31+ 
32+FROM ${A5_BASE_IMAGE} AS a5
33+ARG MAX_JOBS=32
34+ARG CORPORATE_CA=
35+ARG CI_PIP_INDEX=https://mirrors.huaweicloud.com/repository/pypi/simple
36+ARG ASCEND_REPO
37+ARG ASCEND_BRANCH
38+ENV VIRTUAL_ENV=/opt/venv \
39+ PATH=/opt/venv/bin:/usr/lib/llvm-15/bin:${PATH} \
40+ CI_DEVICE=a5 \
41+ CI_PIP_INDEX=${CI_PIP_INDEX} \
42+ TORCH_DEVICE_BACKEND_AUTOLOAD=1 \
43+ TORCH_NPU_DEVICE_CAPABILITY=8.0 \
44+ PYTHONUNBUFFERED=1
45+COPY ci/ /opt/ci/
46+RUN CORPORATE_CA="$CORPORATE_CA" bash /opt/ci/provision-image.sh a5
47+RUN git clone --depth=1 --branch "$ASCEND_BRANCH" \
48+ "$ASCEND_REPO" /opt/torchao-ascend
49+RUN MAX_JOBS="$MAX_JOBS" bash /opt/torchao-ascend/ci/install.sh a5
50+WORKDIR /opt/torchao-ascend
51+ENTRYPOINT ["bash", "/opt/torchao-ascend/ci/entrypoint.sh"]
52+CMD ["bash"]
@@ -0,0 +1,129 @@
1+# TorchAO-Ascend CI Images and Test Lists
2+ 
3+[English](OVERVIEW.md) | [简体中文](OVERVIEW.zh.md)
4+ 
5+This document covers the `ci/` image build and the list-driven test harness. The pre-existing `ci/build.sh` remains the **wheel build entry point**; do not confuse it with `ci/build-image.sh`.
6+ 
7+## Image Information
8+ 
9+| Target | Image Name | Base Image |
10+| ------ | ------ | ------ |
11+| CPU | `torchao-ascend-ci:cpu` | `python:3.12-slim-bookworm` |
12+| A5 NPU | `torchao-ascend-ci:a5` | `ascendai/9.2.1-950-ubuntu22.04-py3.12` |
13+ 
14+- Build entry point: `ci/build-image.sh`; Dockerfile: `ci/Dockerfile`; default platform `linux/arm64`.
15+- The system layer is shared through `ci/provision-image.sh`; the cpu and a5 stages differ only in base image, environment and extra packages.
16+- The image clones this repository to `/opt/torchao-ascend` as the baseline and installs `main`'s dependencies into `/opt/venv`. `/opt/torchao-ascend` is also the default working directory.
17+- Pinned versions: Python 3.12, torch `2.11.0+cpu`, torch_npu `2.11.0.*` (a5 only), torchao `0.18.0`, pytest `8.4.2`.
18+ 
19+Routine code/test changes do not require a rebuild. Rebuild when dependencies or system packages change; append `--no-cache` for a full rebuild.
20+ 
21+## Build Images
22+ 
23+Run from the repository root on an aarch64 build machine:
24+ 
25+| Build Variable | Purpose | Default |
26+| ------ | ------ | ------ |
27+| `ASCEND_REPO` | Clone URL for this repository | `https://gitcode.com/Ascend/torchao-ascend.git` |
28+| `ASCEND_BRANCH` | Branch to clone | `main` |
29+| `MAX_JOBS` | Build parallelism | `32` |
30+| `CI_PIP_INDEX` | pip/uv index inside the image | Huawei Cloud PyPI mirror |
31+| `CORPORATE_CA_FILE` | PEM CA for the corporate gateway | Auto-detect |
32+ 
33+```bash
34+bash ci/build-image.sh cpu
35+bash ci/build-image.sh a5
36+```
37+ 
38+## Run Tests
39+ 
40+Run inside the container with this checkout as the working tree:
41+ 
42+| Target | Test List | Launcher |
43+| ------ | ------ | ------ |
44+| CPU | `ci/testlists/cpu.txt` | single-process pytest |
45+| A5 single card | `ci/testlists/a5-1card.txt` | single-process pytest |
46+| A5 two cards | `ci/testlists/a5-2card.txt` | `torchrun --nproc_per_node 2` |
47+ 
48+```bash
49+# From the checkout root inside the container
50+bash ci/run-testlist.sh cpu
51+bash ci/run-testlist.sh a5-1card
52+bash ci/run-testlist.sh a5-2card
53+```
54+ 
55+- `run-testlist.sh` defaults `WORKDIR` to the invoking checkout, so a PR's code and `test/` run instead of the image baseline's.
56+- Every run relinks the checkout with `pip install -e` and calls `install-test-deps.sh`, so all targets behave identically.
57+- The `a5-2card` list must contain only rank-aware (`world_size=2`) tests that initialize their own process group.
58+- There are no 8-card tests today, so `a5-8card.txt` is not provided. Copy `a5-2card.txt` when such tests appear.
59+ 
60+Arguments and results:
61+ 
62+| Argument | Meaning | Default |
63+| ------ | ------ | ------ |
64+| `BATCH` | Entries per batch, positive integer | `150` |
65+| `WORKDIR` | Test working directory | Invoking checkout |
66+| `REPORT_DIR` | JUnit XML output directory | `/tmp/torchao-ascend-ci-reports` |
67+| Remaining arguments | Passed to pytest, e.g. `--collect-only` | None |
68+ 
69+A failed batch does not stop later batches; the final summary lists failed batches and pytest messages. Exit codes: `0` all done, `1` failures, `2` invalid arguments or missing/empty list. Check pytest's `skipped` summary; skipped tests do not establish success.
70+ 
71+`REPORT_DIR` always gets a `summary.txt`; single-process targets also produce one JUnit XML per batch. `a5-2card` runs multiple ranks at once, so automatic JUnit files would overwrite each other and only `summary.txt` is kept; use per-rank file names inside a plugin or test if structured reports are required.
72+ 
73+### Test List Drift Check
74+ 
75+Entries silently become uncollectable when a test file is renamed or deleted. Run this in the target image before submitting:
76+ 
77+```bash
78+bash ci/check-testlists.sh cpu
79+bash ci/check-testlists.sh a5-1card
80+# With no argument, checks every list under testlists/
81+```
82+ 
83+It runs `--collect-only` for each list and returns non-zero on any uncollectable entry.
84+ 
85+### Local Validation
86+ 
87+```bash
88+# CPU
89+docker run --rm torchao-ascend-ci:cpu \
90+ bash /opt/torchao-ascend/ci/run-testlist.sh cpu
91+ 
92+# A5 single card (host needs the Ascend driver, device 0)
93+docker run --rm --network host --ipc host \
94+ --device=/dev/davinci0 \
95+ --device=/dev/davinci_manager --device=/dev/devmm_svm --device=/dev/hisi_hdc \
96+ -v /usr/local/Ascend:/usr/local/Ascend:ro \
97+ torchao-ascend-ci:a5 \
98+ bash /opt/torchao-ascend/ci/run-testlist.sh a5-1card
99+```
100+ 
101+## Add Tests
102+ 
103+1. Put the test file under `test/` following existing directories (CPU tests in `test/unit/`, NPU tests in `test/npu/` or the matching path).
104+2. Add its node ID (or file path) to the matching `ci/testlists/*.txt`, one per line, grouped by test file with a comment. Keep the full `[parameter]` suffix for parameterized cases and no shell quotes. New dependencies also require an update to `ci/requirements.txt`.
105+3. Assign by device requirement: single card to `a5-1card.txt`, `world_size=2` to `a5-2card.txt`; register each entry only once.
106+4. Verify collection with `--collect-only` in the target image, run the full list, then report the commit, image, command and pass/fail/skip results in the PR.
107+ 
108+## PR Pipeline Integration
109+ 
110+`.gitcode/workflows/_ut_testlists.yml` is a reusable template (it never triggers by itself). Add one job per target in the PR pipeline and `uses: .gitcode/workflows/_ut_testlists.yml`, passing `MERGE_REF`, `TARGET`, `RUNNER_SPEC`, `DOCKER_IMAGE`, `CONTAINER_OPTIONS` and `REPORT_NAME`. The template uploads JUnit reports as artifacts.
111+ 
112+## Items You Must Confirm or Change
113+ 
114+These could not be inferred when porting from torchtitan-ascend:
115+ 
116+1. **A5 base image and CANN version**: `A5_BASE_IMAGE` defaults to `ascendai/9.2.1-950-ubuntu22.04-py3.12`. Confirm the internal registry has the tag and that CANN satisfies torch_npu `2.11.0`.
117+2. **Registry and tags**: `build-image.sh` only tags `torchao-ascend-ci:<target>` locally. The workflow template expects `<registry>/torchao-ascend-ci:cpu-latest` / `:a5-latest`; build, push and replace `DOCKER_IMAGE` in your image pipeline.
118+3. **PyPI index**: `CI_PIP_INDEX` defaults to the Huawei Cloud mirror. Override it at build time or change the Dockerfile default for an internal index.
119+4. **torchao version policy**: the image installs the `torchao==0.18.0` wheel and applies this repository's patches at runtime. If you need a source-level pin, change `install.sh` to check out a fixed commit and update the version table here.
120+5. **torch / torch_npu / Python versions**: torch and torch_npu come from the repository `requirements.txt` (`2.11.0` / `2.11.0.*`) through the existing `.gitcode/scripts/install_pytorch_from_requirements.py`. The base image pins Python 3.12; to match the existing pipeline's 3.10, change both base image tags and the helper will select the `cp310` artifacts automatically. Validate the script and image when upgrading.
121+6. **Test list contents**: `ci/testlists/*.txt` are **file-level baselines**. Narrow them to node IDs after the first hardware run and drop unstable cases. The CPU list already excludes five torch_npu-dependent files (noted in the file).
122+7. **Card-count lists**: only `cpu`, `a5-1card` and `a5-2card` exist. Add `ci/testlists/a5-8card.txt` if needed; `run-testlist.sh` derives the `torchrun` process count from the filename.
123+8. **Runner labels**: `_ut_testlists.yml` defaults to `runs-on: [self-hosted, default, "<RUNNER_SPEC>"]` with values such as `cpu=16`, `npu=1`, `npu=2`. Align these with your runners.
124+9. **NPU container mounts**: the template only passes `--user root` by default. NPU jobs must supply `/usr/local/Ascend`, `/dev/davinci*` and related mounts through `CONTAINER_OPTIONS`; see the template header.
125+10. **Corporate CA**: if the build machine's certificate is not in the `build-image.sh` probe list, pass `CORPORATE_CA_FILE` explicitly.
126+ 
127+## License
128+ 
129+This repository is released under Apache License 2.0. See [LICENSE](../LICENSE). Third-party licenses are listed in [Third_Party_Open_Source_Software_Notice](../Third_Party_Open_Source_Software_Notice).
@@ -0,0 +1,129 @@
1+# TorchAO-Ascend CI 镜像与用例清单
2+ 
3+[English](OVERVIEW.md) | [简体中文](OVERVIEW.zh.md)
4+ 
5+本文说明 `ci/` 下的镜像构建与按清单执行测试的方式。仓库原有的 `ci/build.sh` 仍然是 **wheel 构建入口**,不要与本文的 `ci/build-image.sh` 混淆。
6+ 
7+## 镜像信息
8+ 
9+| Target | 镜像名 | 基础镜像 |
10+| ------ | ------ | ------ |
11+| CPU | `torchao-ascend-ci:cpu` | `python:3.12-slim-bookworm` |
12+| A5 NPU | `torchao-ascend-ci:a5` | `ascendai/9.2.1-950-ubuntu22.04-py3.12` |
13+ 
14+- 构建入口:`ci/build-image.sh`;Dockerfile:`ci/Dockerfile`;默认架构 `linux/arm64`。
15+- 系统层由 `ci/provision-image.sh` 统一准备,cpu/a5 只在基础镜像、环境变量和额外系统包上不同。
16+- 镜像把本仓 clone 到 `/opt/torchao-ascend` 作为基线,并把当前 `main` 的依赖装进 `/opt/venv`;`/opt/torchao-ascend` 同时是默认工作目录。
17+- 依赖版本:Python 3.12、torch `2.11.0+cpu`、torch_npu `2.11.0.*`(仅 a5)、torchao `0.18.0`、pytest `8.4.2`。
18+ 
19+日常只改代码和用例时不需要重建镜像;依赖或系统包变化时再重建,必要时追加 `--no-cache`。
20+ 
21+## 构建镜像
22+ 
23+在 aarch64 构建机、仓库根目录执行:
24+ 
25+| 构建变量 | 用途 | 默认值 |
26+| ------ | ------ | ------ |
27+| `ASCEND_REPO` | 本仓 clone 地址 | `https://gitcode.com/Ascend/torchao-ascend.git` |
28+| `ASCEND_BRANCH` | clone 分支 | `main` |
29+| `MAX_JOBS` | 编译并行度 | `32` |
30+| `CI_PIP_INDEX` | 镜像内 pip/uv 索引 | 华为云 PyPI 镜像 |
31+| `CORPORATE_CA_FILE` | 企业网关 PEM 证书 | 自动探测 |
32+ 
33+```bash
34+bash ci/build-image.sh cpu
35+bash ci/build-image.sh a5
36+```
37+ 
38+## 运行测试
39+ 
40+在容器内、以本次检出的仓库为工作目录执行:
41+ 
42+| Target | 用例清单 | 启动方式 |
43+| ------ | ------ | ------ |
44+| CPU | `ci/testlists/cpu.txt` | 单进程 pytest |
45+| A5 单卡 | `ci/testlists/a5-1card.txt` | 单进程 pytest |
46+| A5 双卡 | `ci/testlists/a5-2card.txt` | `torchrun --nproc_per_node 2` |
47+ 
48+```bash
49+# 在容器内,仓库 checkout 根目录
50+bash ci/run-testlist.sh cpu
51+bash ci/run-testlist.sh a5-1card
52+bash ci/run-testlist.sh a5-2card
53+```
54+ 
55+- `run-testlist.sh` 默认把当前 checkout 作为 `WORKDIR`,因此跑的是 PR 里的代码和 `test/`,不是镜像里的 `main` 基线。
56+- 每次运行都会 `pip install -e` 当前 checkout,并调用 `install-test-deps.sh` 校准测试依赖;所有 target 行为一致。
57+- `a5-2card` 的清单只允许放自行初始化进程组的 `world_size=2` 用例。
58+- 目前没有 8 卡用例,因此未提供 `a5-8card.txt`;出现 8 卡用例时复制 `a5-2card.txt` 改名并补充即可。
59+ 
60+参数与结果:
61+ 
62+| 参数 | 含义 | 默认 |
63+| ------ | ------ | ------ |
64+| `BATCH` | 每批用例数,正整数 | `150` |
65+| `WORKDIR` | 测试工作目录 | 本次 checkout 根目录 |
66+| `REPORT_DIR` | JUnit XML 输出目录 | `/tmp/torchao-ascend-ci-reports` |
67+| 其余参数 | 原样传给 pytest,如 `--collect-only` | 无 |
68+ 
69+单批失败不会中断后续批次;结束时汇总失败批次和 pytest 摘要。退出码:`0` 全部完成、`1` 有失败、`2` 参数错误或清单缺失/为空。跳过用例请查看 pytest 的 `skipped` 汇总,`skipped` 不等于通过。
70+ 
71+`REPORT_DIR` 下始终会写 `summary.txt`;单进程 target 还会按批次生成 JUnit XML。`a5-2card` 由多个 rank 同时运行,自动 JUnit 会互相覆盖,因此只保留 `summary.txt`,需要结构化报告时请在用例内或 pytest 插件中按 rank 区分文件名。
72+ 
73+### 清单漂移检查
74+ 
75+用例文件被删除或改名后,清单条目会变成不可收集。提交前在目标镜像中执行:
76+ 
77+```bash
78+bash ci/check-testlists.sh cpu
79+bash ci/check-testlists.sh a5-1card
80+# 不带参数时检查 testlists/ 下所有清单
81+```
82+ 
83+该脚本对每个清单跑 `--collect-only`,任何不可收集条目都会返回非 0。
84+ 
85+### 本地验证
86+ 
87+```bash
88+# CPU
89+docker run --rm torchao-ascend-ci:cpu \
90+ bash /opt/torchao-ascend/ci/run-testlist.sh cpu
91+ 
92+# A5 单卡(宿主机需装 Ascend 驱动,设备号 0)
93+docker run --rm --network host --ipc host \
94+ --device=/dev/davinci0 \
95+ --device=/dev/davinci_manager --device=/dev/devmm_svm --device=/dev/hisi_hdc \
96+ -v /usr/local/Ascend:/usr/local/Ascend:ro \
97+ torchao-ascend-ci:a5 \
98+ bash /opt/torchao-ascend/ci/run-testlist.sh a5-1card
99+```
100+ 
101+## 新增用例
102+ 
103+1. 在 `test/` 下按现有目录放置测试文件(CPU 用例放 `test/unit/`,NPU 用例放 `test/npu/` 或对应目录)。
104+2. 把 node ID(或文件路径)加入对应 `ci/testlists/*.txt`,一行一条,按测试文件分组加注释。参数化用例保留完整 `[参数]` 后缀,不要写 shell 引号。新增依赖同时修改 `ci/requirements.txt`。
105+3. 按实际设备需求归组:单卡进 `a5-1card.txt`,`world_size=2` 进 `a5-2card.txt`,同一用例只登记一次。
106+4. 在目标镜像里先 `--collect-only` 确认可收集,再跑完整清单,然后在 PR 中报告 commit、镜像、命令和 pass/fail/skip。
107+ 
108+## 接入 PR 流水线
109+ 
110+`.gitcode/workflows/_ut_testlists.yml` 是可复用模板(不会被单独触发)。在 PR 流水线里为每个 target 增加一个 job,并 `uses: .gitcode/workflows/_ut_testlists.yml`,传入 `MERGE_REF`、`TARGET`、`RUNNER_SPEC`、`DOCKER_IMAGE`、`CONTAINER_OPTIONS`、`REPORT_NAME`。模板会把 JUnit 报告作为 artifact 上传。
111+ 
112+## 需要你确认或修改的地方
113+ 
114+以下内容是从 torchtitan-ascend 迁移时无法自动确定的,请按实际环境填写:
115+ 
116+1. **A5 基础镜像与 CANN 版本**:`ci/Dockerfile` 中 `A5_BASE_IMAGE` 默认 `ascendai/9.2.1-950-ubuntu22.04-py3.12`。请确认内网镜像仓有该 tag,且 CANN 版本满足 torch_npu `2.11.0` 的要求。
117+2. **镜像仓与 tag**:`build-image.sh` 只打本地 `torchao-ascend-ci:<target>`。流水线模板需要 `<registry>/torchao-ascend-ci:cpu-latest` / `:a5-latest`,请在镜像发布流程里 build、push 并替换 `DOCKER_IMAGE`。
118+3. **PyPI 源**:`CI_PIP_INDEX` 默认华为云镜像。若内网使用其它源,在构建时覆盖,或修改 Dockerfile 默认值。
119+4. **torchao 版本策略**:当前安装 `torchao==0.18.0` wheel,运行期由本仓 patch 生效。若要求源码级固定,请把 `install.sh` 改为 checkout 固定 commit 后安装,并同步 `ci/OVERVIEW` 的版本表。
120+5. **torch / torch_npu / Python 版本**:torch 与 torch_npu 取自仓库根目录 `requirements.txt`(`2.11.0` / `2.11.0.*`),通过现有 `.gitcode/scripts/install_pytorch_from_requirements.py` 安装。基础镜像的 Python 固定为 3.12;若要与现有流水线的 3.10 对齐,改两个基础镜像 tag 即可,该脚本会按解释器自动选择 `cp310` 产物。升级时需同步验证脚本与镜像。
121+6. **用例清单内容**:`ci/testlists/*.txt` 目前是**文件级基线**,需在真机跑通后收敛到 node ID,并删除不稳定的用例;CPU 清单已排除 5 个依赖 torch_npu 的文件(清单内有注释说明)。
122+7. **A5 卡数清单**:只有 `cpu`、`a5-1card`、`a5-2card`。若需要 8 卡或其它卡数,新增 `ci/testlists/a5-8card.txt`,`run-testlist.sh` 会按文件名自动推导 `torchrun` 进程数。
123+8. **调度标签**:`_ut_testlists.yml` 默认 `runs-on: [self-hosted, default, "<RUNNER_SPEC>"]`,`RUNNER_SPEC` 例如 `cpu=16`、`npu=1`、`npu=2`。请与你们的 runner 标签对齐。
124+9. **NPU 容器挂载**:模板默认只带 `--user root`,NPU job 需要通过 `CONTAINER_OPTIONS` 传入 `/usr/local/Ascend`、`/dev/davinci*` 等挂载,示例见模板头部注释。
125+10. **企业 CA**:如构建机证书路径不在 `build-image.sh` 的探测列表里,用 `CORPORATE_CA_FILE` 显式指定。
126+ 
127+## License
128+ 
129+本仓库使用 Apache License 2.0,见 [LICENSE](../LICENSE)。第三方许可见 [Third_Party_Open_Source_Software_Notice](../Third_Party_Open_Source_Software_Notice)。
@@ -0,0 +1,77 @@
1+#!/usr/bin/env bash
2+# SPDX-License-Identifier: Apache-2.0
3+# Build the CI test images. The wheel build entry point stays ci/build.sh.
4+set -euo pipefail
5+ 
6+usage() {
7+ echo "Usage: $0 <cpu|a5> [image:tag] [docker build options...]"
8+ echo 'Environment: PLATFORM (default linux/arm64), MAX_JOBS (default 32),'
9+ echo ' CORPORATE_CA_FILE (PEM to trust inside the image),'
10+ echo ' ASCEND_REPO (default https://gitcode.com/Ascend/torchao-ascend.git),'
11+ echo ' ASCEND_BRANCH (default main),'
12+ echo ' CI_PIP_INDEX (default Huawei Cloud PyPI mirror)'
13+}
14+if [[ "${1:-}" == --help || "${1:-}" == -h ]]; then
15+ usage
16+ exit 0
17+fi
18+if [[ $# -eq 0 ]]; then
19+ usage >&2
20+ exit 2
21+fi
22+ 
23+target="$1"
24+shift
25+case "$target" in
26+ cpu|a5) ;;
27+ *) usage >&2; exit 2 ;;
28+esac
29+ 
30+image="torchao-ascend-ci:$target"
31+if [[ $# -gt 0 && "$1" != -* ]]; then
32+ image="$1"
33+ shift
34+fi
35+ 
36+platform="${PLATFORM:-linux/arm64}"
37+if [[ "$target" == a5 && "$platform" != linux/arm64 ]]; then
38+ echo 'The A5 target requires PLATFORM=linux/arm64.' >&2
39+ exit 2
40+fi
41+ 
42+ascend_repo="${ASCEND_REPO:-https://gitcode.com/Ascend/torchao-ascend.git}"
43+ascend_branch="${ASCEND_BRANCH:-main}"
44+pip_index="${CI_PIP_INDEX:-https://mirrors.huaweicloud.com/repository/pypi/simple}"
45+ 
46+build_args=(
47+ --build-arg "ASCEND_REPO=$ascend_repo"
48+ --build-arg "ASCEND_BRANCH=$ascend_branch"
49+ --build-arg "CI_PIP_INDEX=$pip_index"
50+)
51+ 
52+ca_file="${CORPORATE_CA_FILE:-}"
53+if [[ -z "$ca_file" ]]; then
54+ for candidate in \
55+ /etc/pki/ca-trust/source/anchors/huawei-web-secure-gateway-ca-v2.pem \
56+ /etc/pki/ca-trust/source/anchors/huawei-bpit-root.pem \
57+ /usr/local/share/ca-certificates/huawei-web-secure-gateway-ca-v2.crt
58+ do
59+ if [[ -f "$candidate" ]]; then
60+ ca_file="$candidate"
61+ break
62+ fi
63+ done
64+fi
65+ 
66+if [[ -n "$ca_file" ]]; then
67+ echo "Using corporate CA: $ca_file" >&2
68+ build_args+=(--build-arg "CORPORATE_CA=$(cat "$ca_file")")
69+else
70+ echo "No corporate CA found; the image will not trust a TLS-inspecting proxy." >&2
71+fi
72+ 
73+repo_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
74+exec docker build --platform "$platform" --target "$target" \
75+ --build-arg "MAX_JOBS=${MAX_JOBS:-32}" \
76+ -f "$repo_dir/ci/Dockerfile" -t "$image" "$@" \
77+ "${build_args[@]}" "$repo_dir"
@@ -0,0 +1,40 @@
1+#!/usr/bin/env bash
2+# SPDX-License-Identifier: Apache-2.0
3+# Guard against testlist drift: every entry must still be collectable.
4+# Run inside the target image, e.g. in CI right after checkout:
5+# bash ci/check-testlists.sh cpu
6+# With no arguments, checks every testlist that exists.
7+set -euo pipefail
8+ 
9+HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
10+ 
11+if [[ "${1:-}" == --help || "${1:-}" == -h ]]; then
12+ echo "Usage: $0 [cpu|a5-Ncard ...] (no arguments: check every testlist)"
13+ exit 0
14+fi
15+ 
16+targets=("$@")
17+if [[ ${#targets[@]} -eq 0 ]]; then
18+ for list in "$HERE"/testlists/*.txt; do
19+ [[ -e "$list" ]] || continue
20+ name="$(basename "$list" .txt)"
21+ targets+=("$name")
22+ done
23+fi
24+ 
25+status=0
26+for target in "${targets[@]}"; do
27+ echo "[check-testlists] collecting $target"
28+ report_dir="$(mktemp -d)"
29+ if ! BATCH=1000000 REPORT_DIR="$report_dir" \
30+ bash "$HERE/run-testlist.sh" "$target" --collect-only; then
31+ echo "[check-testlists] FAILED: $target" >&2
32+ status=1
33+ fi
34+ rm -rf "$report_dir"
35+done
36+ 
37+if [[ "$status" -ne 0 ]]; then
38+ echo '[check-testlists] at least one list has uncollectable entries' >&2
39+fi
40+exit "$status"
@@ -0,0 +1,12 @@
1+#!/usr/bin/env bash
2+# SPDX-License-Identifier: Apache-2.0
3+set -euo pipefail
4+ 
5+if [[ "${CI_DEVICE:-}" == a5 ]]; then
6+ # shellcheck source=ci/npu-env.sh
7+ source "$(dirname "${BASH_SOURCE[0]}")/npu-env.sh"
8+ # An explicit check also catches startup-hook failures, which Python can log and ignore.
9+ python -c 'import torch, torch_npu; assert torch.npu.is_available(), "No visible Ascend NPU"'
10+fi
11+cd /opt/torchao-ascend
12+exec "$@"
@@ -0,0 +1,49 @@
1+#!/usr/bin/env bash
2+# SPDX-License-Identifier: Apache-2.0
3+# Install/refresh the Python packages that only the tests need.
4+# Idempotent: run-testlist.sh calls this on every target before running.
5+set -euo pipefail
6+ 
7+target="${1:?Usage: install-test-deps.sh cpu|a5}"
8+case "$target" in
9+ cpu|a5) ;;
10+ *) echo "Unknown target: $target" >&2; exit 2 ;;
11+esac
12+ 
13+pip_index="${CI_PIP_INDEX:-https://mirrors.huaweicloud.com/repository/pypi/simple}"
14+python_bin="$(command -v python)"
15+requirements_file="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/requirements.txt"
16+ 
17+requirements=()
18+while IFS= read -r line; do
19+ line="${line%%#*}"
20+ line="${line//[[:space:]]/}"
21+ [[ -z "$line" ]] && continue
22+ if [[ "$line" != *"=="* ]]; then
23+ echo "ERROR: ci/requirements.txt entries must be pinned as name==version: $line" >&2
24+ exit 2
25+ fi
26+ package="${line%%==*}"
27+ version="${line##*==}"
28+ if ! python - "$package" "$version" <<'PY'
29+from importlib.metadata import PackageNotFoundError, version
30+import sys
31+ 
32+try:
33+ installed = version(sys.argv[1])
34+except PackageNotFoundError:
35+ installed = None
36+sys.exit(installed != sys.argv[2])
37+PY
38+ then
39+ requirements+=("${package}==${version}")
40+ fi
41+done < "$requirements_file"
42+ 
43+if [[ ${#requirements[@]} -eq 0 ]]; then
44+ echo "[test-deps] $target: required versions already installed"
45+ exit 0
46+fi
47+ 
48+echo "[test-deps] $target: installing ${requirements[*]}"
49+uv pip install --python "$python_bin" --index-url "$pip_index" "${requirements[@]}"
@@ -0,0 +1,63 @@
1+#!/usr/bin/env bash
2+# SPDX-License-Identifier: Apache-2.0
3+# Install the pinned runtime/test environment inside the image build.
4+set -euo pipefail
5+ 
6+target="${1:?Usage: install.sh cpu|a5}"
7+case "$target" in
8+ cpu|a5) ;;
9+ *) echo "Unknown target: $target" >&2; exit 2 ;;
10+esac
11+ 
12+source_dir=/opt/torchao-ascend
13+# Backend loading is enabled by the A5 entrypoint after installation is done.
14+export TORCH_DEVICE_BACKEND_AUTOLOAD=0
15+export MAX_JOBS="${MAX_JOBS:-32}"
16+export UV_SYSTEM_CERTS=1
17+pip_index="${CI_PIP_INDEX:-https://mirrors.huaweicloud.com/repository/pypi/simple}"
18+python_bin="$(command -v python)"
19+ 
20+# torch and torch-npu versions are pinned in the repository requirements.txt.
21+# Reuse the pipeline helper so the Huawei mirror layout stays in one place.
22+arch="$(uname -m)"
23+python_tag="$("$python_bin" -c 'import sys; print(f"cp{sys.version_info.major}{sys.version_info.minor}")')"
24+"$python_bin" "$source_dir/.gitcode/scripts/install_pytorch_from_requirements.py" \
25+ --arch "$arch" --python-tag "$python_tag" --python-exe "$python_bin"
26+ 
27+uv pip install --python "$python_bin" --index-url "$pip_index" numpy
28+# torchao has no hard runtime dependency; --no-deps avoids re-resolving torch.
29+uv pip install --python "$python_bin" --index-url "$pip_index" --no-deps \
30+ 'torchao==0.18.0'
31+ 
32+if [[ "$target" == a5 ]]; then
33+ [[ "$arch" == aarch64 ]] || { echo 'A5 requires aarch64.' >&2; exit 2; }
34+ set +u
35+ # shellcheck source=/dev/null
36+ source /usr/local/Ascend/ascend-toolkit/set_env.sh
37+ set -u
38+ uv pip install --python "$python_bin" --index-url "$pip_index" \
39+ 'torch-npu==2.11.0.*'
40+fi
41+ 
42+# --no-deps keeps the repository's broad torchao range from re-resolving torch.
43+uv pip install --python "$python_bin" --index-url "$pip_index" --no-deps \
44+ -e "$source_dir"
45+ 
46+bash "$source_dir/ci/install-test-deps.sh" "$target"
47+ 
48+python - "$target" <<'PY'
49+import importlib.metadata as metadata
50+import sys
51+ 
52+import torch
53+import torchao
54+import torchao_ascend # noqa: F401
55+ 
56+assert torch.__version__.split("+")[0] == "2.11.0", torch.__version__
57+assert metadata.version("torchao") == "0.18.0", metadata.version("torchao")
58+if sys.argv[1] == "a5":
59+ import torch_npu
60+ 
61+ print("torch_npu:", torch_npu.__version__)
62+print("core packages OK:", metadata.version("torchao-ascend"))
63+PY
@@ -0,0 +1,29 @@
1+#!/usr/bin/env bash
2+# SPDX-License-Identifier: Apache-2.0
3+# Source this file in the shell that launches NPU processes.
4+toolkit_env=/usr/local/Ascend/ascend-toolkit/set_env.sh
5+if [[ ! -f "$toolkit_env" ]]; then
6+ echo "ERROR: $toolkit_env not found; run this inside the A5 image" >&2
7+ return 1 2>/dev/null || exit 2
8+fi
9+ 
10+set +u
11+# shellcheck source=/dev/null
12+source "$toolkit_env"
13+# Preserve the CANN base image's compiler and NNAL initialization. The IR path
14+# carries the CANN version, so discover it instead of hard-coding one release.
15+for ir_env in /usr/local/Ascend/cann-*/share/info/ascendnpu-ir/bin/set_env.sh; do
16+ if [[ -f "$ir_env" ]]; then
17+ # shellcheck source=/dev/null
18+ source "$ir_env"
19+ break
20+ fi
21+done
22+# shellcheck source=/dev/null
23+source /usr/local/Ascend/nnal/atb/set_env.sh --cxx_abi="${ATB_CXX_ABI:-1}"
24+set -u
25+# Build-only stubs must not shadow the mounted driver's runtime libraries.
26+export LD_LIBRARY_PATH
27+LD_LIBRARY_PATH=$(printf '%s' "${LD_LIBRARY_PATH:-}" | tr ':' '\n' | sed '/devlib/d' | paste -sd: -)
28+export TORCH_DEVICE_BACKEND_AUTOLOAD=1
29+export TORCH_NPU_DEVICE_CAPABILITY="${TORCH_NPU_DEVICE_CAPABILITY:-8.0}"
@@ -0,0 +1,56 @@
1+#!/usr/bin/env bash
2+# SPDX-License-Identifier: Apache-2.0
3+# Prepare the system layer shared by the cpu and a5 image stages.
4+# Called by ci/Dockerfile from /opt/ci, before the repository is cloned.
5+set -euo pipefail
6+ 
7+target="${1:?Usage: provision-image.sh cpu|a5}"
8+case "$target" in
9+ cpu|a5) ;;
10+ *) echo "Unknown target: $target" >&2; exit 2 ;;
11+esac
12+ 
13+common_packages=(
14+ git build-essential ca-certificates curl wget vim less jq procps
15+ iproute2 iputils-ping netcat-openbsd rsync unzip
16+)
17+target_packages=()
18+if [[ "$target" == cpu ]]; then
19+ target_packages+=(libnuma1)
20+else
21+ # gawk/clang/lld are required by AscendC builds; zlib/libzstd match CANN.
22+ target_packages+=(gawk clang-15 lld-15 zlib1g-dev libzstd-dev libnuma-dev)
23+fi
24+ 
25+apt-get update
26+DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
27+ "${common_packages[@]}" "${target_packages[@]}"
28+rm -rf /var/lib/apt/lists/*
29+printf '%s\n' "alias ll='ls -alF'" >> /etc/bash.bashrc
30+ 
31+python -m venv /opt/venv
32+/opt/venv/bin/pip install --no-cache-dir \
33+ --index-url "${CI_PIP_INDEX:-https://pypi.org/simple}" uv
34+ 
35+# The corporate gateway inspects TLS, so pip/uv need its root CA. Only applied
36+# when the build passes CORPORATE_CA, keeping the image buildable off-network.
37+if [[ -n "${CORPORATE_CA:-}" ]]; then
38+ ca_path=/usr/local/share/ca-certificates/torchao-ci-gateway.crt
39+ printf '%s\n' "$CORPORATE_CA" > "$ca_path"
40+ update-ca-certificates
41+ /opt/venv/bin/pip install --no-cache-dir certifi
42+ /opt/venv/bin/python - "$ca_path" <<'PY'
43+import pathlib
44+import sys
45+ 
46+import certifi
47+ 
48+ca = pathlib.Path(sys.argv[1]).read_text()
49+bundle = pathlib.Path(certifi.where())
50+bundle.write_text(bundle.read_text() + "\n" + ca)
51+PY
52+fi
53+ 
54+python --version
55+/opt/venv/bin/python --version
56+/opt/venv/bin/uv --version
@@ -0,0 +1,7 @@
1+# Test-only dependencies for ci/run-testlist.sh.
2+# Runtime dependencies (torch / torch-npu / torchao) live in ../requirements.txt.
3+pytest==8.4.2
4+pytest-timeout==2.4.0
5+safetensors==0.8.0
6+fire==0.7.1
7+termcolor==3.3.0
@@ -0,0 +1,143 @@
1+#!/usr/bin/env bash
2+# SPDX-License-Identifier: Apache-2.0
3+# Run only the entries listed in ci/testlists/<target>.txt.
4+set -euo pipefail
5+ 
6+usage() {
7+ echo "Usage: $0 [cpu|a5-Ncard] [extra pytest arguments...]"
8+ echo 'Environment: WORKDIR (default: this checkout), BATCH (default 150),'
9+ echo ' REPORT_DIR (default /tmp/torchao-ascend-ci-reports),'
10+ echo ' TESTLIST (default ci/testlists/<target>.txt)'
11+}
12+if [[ "${1:-}" == --help || "${1:-}" == -h ]]; then
13+ usage
14+ exit 0
15+fi
16+ 
17+TARGET="${1:-cpu}"
18+if [[ $# -gt 0 ]]; then
19+ shift
20+fi
21+case "$TARGET" in
22+ cpu) NPROC=1 ;;
23+ a5-[0-9]*card)
24+ NPROC="${TARGET#a5-}"
25+ NPROC="${NPROC%card}"
26+ [[ "$NPROC" =~ ^[1-9][0-9]*$ ]] || { usage >&2; exit 2; }
27+ ;;
28+ *) usage >&2; exit 2 ;;
29+esac
30+ 
31+BATCH="${BATCH:-150}"
32+if [[ ! "$BATCH" =~ ^[1-9][0-9]*$ ]]; then
33+ echo 'ERROR: BATCH must be a positive integer' >&2
34+ exit 2
35+fi
36+ 
37+HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
38+source_dir="$(cd "$HERE/.." && pwd)"
39+ 
40+if [[ "$TARGET" == a5-* ]]; then
41+ # docker exec does not inherit environment changes made by the entrypoint.
42+ # shellcheck source=ci/npu-env.sh
43+ source "$HERE/npu-env.sh"
44+fi
45+ 
46+LIST="${TESTLIST:-$HERE/testlists/$TARGET.txt}"
47+if [[ ! -f "$LIST" ]]; then
48+ echo "ERROR: test list not found: $LIST" >&2
49+ exit 2
50+fi
51+ 
52+CASES="$(mktemp)"
53+PARTS_DIR="$(mktemp -d)"
54+trap 'rm -rf "$CASES" "$PARTS_DIR"' EXIT
55+sed '/^[[:space:]]*#/d; /^[[:space:]]*$/d' "$LIST" > "$CASES"
56+COUNT=$(wc -l < "$CASES")
57+if [[ "$COUNT" -eq 0 ]]; then
58+ echo "ERROR: no test cases in $LIST" >&2
59+ exit 2
60+fi
61+echo "[run-testlist] target=$TARGET entries=$COUNT nproc=$NPROC"
62+ 
63+# Default to the invoking checkout so a PR's tests, not the image baseline's,
64+# are collected and run.
65+WORKDIR="${WORKDIR:-$source_dir}"
66+cd "$WORKDIR" || { echo "ERROR: workdir $WORKDIR not found" >&2; exit 2; }
67+ 
68+# Suppress backend autoload while relinking the checkout.
69+PYTHONPATH= TORCH_DEVICE_BACKEND_AUTOLOAD=0 python -m pip install --no-deps -e "$source_dir"
70+# Every target refreshes test deps: cheap when versions already match, and it
71+# avoids the old cpu/a5-2card-only asymmetry.
72+PYTHONPATH= TORCH_DEVICE_BACKEND_AUTOLOAD=0 bash "$HERE/install-test-deps.sh" "${TARGET%%-*}"
73+ 
74+REPORT_DIR="${REPORT_DIR:-/tmp/torchao-ascend-ci-reports}"
75+mkdir -p "$REPORT_DIR"
76+ 
77+failure_summary="$PARTS_DIR/failures.log"
78+batch_log="$PARTS_DIR/batch.log"
79+num_batches=0
80+: > "$failure_summary"
81+split -l "$BATCH" "$CASES" "$PARTS_DIR/part."
82+ 
83+has_junit_arg() {
84+ [[ " $* " == *" --junitxml"* ]]
85+}
86+ 
87+run_batch() {
88+ local junit_args=()
89+ if [[ "$NPROC" -eq 1 ]] && ! has_junit_arg "$@"; then
90+ junit_args+=("--junitxml=$REPORT_DIR/batch-${num_batches}.xml")
91+ fi
92+ if [[ "$NPROC" -gt 1 ]]; then
93+ torchrun --standalone --nproc_per_node "$NPROC" \
94+ python -m pytest "$@" "${junit_args[@]}"
95+ else
96+ python -m pytest "$@" "${junit_args[@]}"
97+ fi
98+}
99+ 
100+for part in "$PARTS_DIR"/part.*; do
101+ num_batches=$((num_batches + 1))
102+ batch=()
103+ while IFS= read -r one; do
104+ batch+=("$one")
105+ done < "$part"
106+ echo "[run-testlist] batch $num_batches: running ${#batch[@]} entries"
107+ if run_batch "$@" -vv -rfEs --color=no "${batch[@]}" 2>&1 | tee "$batch_log"; then
108+ continue
109+ fi
110+ batch_status=${PIPESTATUS[0]}
111+ printf '\nBatch %s (%s entries), exit code %s\n' \
112+ "$num_batches" "${#batch[@]}" "$batch_status" >> "$failure_summary"
113+ # Pytest can print a usage error on the same line as its collection status.
114+ awk -v status="$batch_status" '
115+ { sub(/^collecting \.\.\. /, "") }
116+ /^ERROR: / { print }
117+ /^ERROR: (not found:|file or directory not found:)/ { missing_entry = 1 }
118+ /^=+ short test summary info =+$/ { in_summary = 1; next }
119+ /^=+/ { in_summary = 0 }
120+ in_summary && /^(FAILED|ERROR) / { print }
121+ END {
122+ if (status == 4 && missing_entry)
123+ print "Batch not executed because a listed test could not be found."
124+ }
125+ ' "$batch_log" >> "$failure_summary"
126+done
127+ 
128+{
129+ echo "target=$TARGET"
130+ echo "entries=$COUNT"
131+ echo "nproc=$NPROC"
132+ echo "batches=$num_batches"
133+ echo "failed=$(grep -c '^Batch ' "$failure_summary" || true)"
134+} > "$REPORT_DIR/summary.txt"
135+echo "[run-testlist] reports: $REPORT_DIR"
136+if [[ -s "$failure_summary" ]]; then
137+ echo
138+ echo '[run-testlist] ===== failed batches (full pytest output above) ====='
139+ cat "$failure_summary"
140+ exit 1
141+fi
142+ 
143+echo "[run-testlist] completed $COUNT list entries without pytest failures; check pytest summaries for skips"
@@ -0,0 +1,49 @@
1+# A5 single-card test list — run with: bash ci/run-testlist.sh a5-1card
2+#
3+# Entries are paths/node IDs relative to the checkout root. File-level entries
4+# are the initial baseline; after validating on hardware, narrow them to node
5+# IDs so a partially supported file can be split.
6+#
7+# world_size=2 tests belong in a5-2card.txt, not here.
8+ 
9+# --- test/npu/ (top level) ---
10+test/npu/test_blockwise_fp8_inference_npu.py
11+test/npu/test_blockwise_fp8_training_npu.py
12+test/npu/test_float8_fsdp_npu.py
13+test/npu/test_float8_inference_npu.py
14+test/npu/test_float8_scaling_utils_npu.py
15+test/npu/test_float8_training_npu.py
16+test/npu/test_hifloat8_config_npu.py
17+test/npu/test_hifloat8_gmm_npu.py
18+test/npu/test_hifloat8_linear_npu.py
19+test/npu/test_import_transfer_to_npu.py
20+test/npu/test_int4_plain_int32_tensor_npu.py
21+test/npu/test_int8_int8_inference_npu.py
22+test/npu/test_intx_w4a16_inference_npu.py
23+test/npu/test_mxfp4_inference_npu.py
24+test/npu/test_mxfp4_scaling_utils_npu.py
25+test/npu/test_mxfp8_gmm_patch_npu.py
26+test/npu/test_mxfp8_inference_npu.py
27+test/npu/test_mxfp8_scaling_utils_npu.py
28+test/npu/test_mxfp8_training_npu.py
29+test/npu/test_mx_ops_npu.py
30+test/npu/test_w4a16_qat_npu.py
31+test/npu/test_w4a8_950_validation.py
32+test/npu/test_w4a8_qat_npu.py
33+test/npu/test_w8a16_qat_npu.py
34+test/npu/test_w8a8_mxfp8_qat_npu.py
35+test/npu/test_w8a8_qat_npu.py
36+ 
37+# --- test/npu/prototype/moe_training/ (single card) ---
38+test/npu/prototype/moe_training/test_fp8_grouped_mm.py
39+test/npu/prototype/moe_training/test_mxfp8_grouped_mm.py
40+test/npu/prototype/moe_training/ep/test_permute_unpermute_npu.py
41+ 
42+# --- NPU-only tests outside test/npu/ ---
43+test/unit/test_lightning_indexer_api.py
44+test/unit/test_lightning_indexer_runtime.py
45+test/unit/test_mx_dequant.py
46+test/unit/test_mxfp8_ep_chain.py
47+test/unit/test_ops_kernel_preference.py
48+test/prototype/test_prototype_float8_tensor.py
49+test/upstream/quantization/test_qat.py
@@ -0,0 +1,9 @@
1+# A5 two-card test list — run with: bash ci/run-testlist.sh a5-2card
2+#
3+# run-testlist.sh launches this list with
4+# torchrun --standalone --nproc_per_node 2 -m pytest ...
5+# so every entry must be rank-aware (world_size=2) and self-initialize its
6+# process group. Single-rank NPU tests belong in a5-1card.txt.
7+ 
8+# --- test/npu/prototype/moe_training/ep/ (world_size=2, hccl) ---
9+test/npu/prototype/moe_training/ep/test_a2a_dispatch_combine_npu.py
@@ -0,0 +1,31 @@
1+# CPU test list — run with: bash ci/run-testlist.sh cpu
2+#
3+# Entries are paths/node IDs relative to the checkout root. File-level entries
4+# are the initial baseline; after validating on the CPU image, narrow them to
5+# node IDs (file::Class::test) so a partially supported file can be split.
6+#
7+# Deliberately excluded: files that import torch_npu unconditionally or use
8+# torch.device("npu"). They live in a5-1card.txt instead:
9+# test/unit/test_lightning_indexer_api.py
10+# test/unit/test_lightning_indexer_runtime.py
11+# test/unit/test_mx_dequant.py
12+# test/unit/test_mxfp8_ep_chain.py (importorskip torch_npu)
13+# test/unit/test_ops_kernel_preference.py
14+ 
15+# --- test/unit/ (CPU-runnable) ---
16+test/unit/test_autoload.py
17+test/unit/test_float8_config_contract.py
18+test/unit/test_hifloat8_filters.py
19+test/unit/test_hifloat8_gmm_cpu.py
20+test/unit/test_mx_addmm_dispatch.py
21+test/unit/test_mx_convert.py
22+test/unit/test_mxfp8_qat.py
23+test/unit/test_mxfp8_recompute.py
24+test/unit/test_mx_gmm_quant.py
25+test/unit/test_mx_ops.py
26+test/unit/test_ops_registry.py
27+test/unit/test_qat_config_contract.py
28+test/unit/test_recompute_phase.py
29+test/unit/test_safetensors_export.py
30+test/unit/test_torchao_namespace.py
31+test/unit/test_w4a16_convert.py