已合并
【社区任务】Ascend for PyTorch测试用例解耦(6) 交付件 #33
【社区任务】Ascend for PyTorch测试用例解耦(6) 交付件 #33
已合并
kevin_lee1231创建于 9月14日
共 5 个文件变更+358-0
@@ -0,0 +1,121 @@
1+{
2+ "started_at_utc": "2026-09-14T09:45:41.791886+00:00",
3+ "mode": "generic",
4+ "python": "/workspace/venvs/pytorch-npu/bin/python",
5+ "python_version": "3.12.13",
6+ "torch_version": "2.14.0a0+gitbe42873",
7+ "torch_file": "/workspace/PyTorch/torch/__init__.py",
8+ "torch_git_version": "be4287301021e31b9f7d76bef1633a39dba00319",
9+ "torch_npu_version": "2.14.0a0+gitc0ee704",
10+ "torch_npu_file": "/workspace/venvs/pytorch-npu/lib/python3.12/site-packages/torch_npu/__init__.py",
11+ "npu_available": true,
12+ "npu_count": 1,
13+ "quantized_engines": [
14+ "qnnpack",
15+ "x86",
16+ "fbgemm"
17+ ],
18+ "final_test_commit": "56ad40b9339e91b41d0e3bced0295841a4c059ca",
19+ "final_test_blob": "d1162cd2a65c96785f836a34df05038af6a6cf57",
20+ "runtime_commit": "be4287301021e31b9f7d76bef1633a39dba00319",
21+ "runtime_status": "",
22+ "weights_only_override": null
23+}
24+/workspace/venvs/pytorch-npu/lib/python3.12/site-packages/torch_npu/dynamo/__init__.py:182: UserWarning: Register eager implementation for the 'npu' backend of dynamo, as torch_npu was not compiled with torchair.
25+ warnings.warn(
26+test_qlinear_packed_params_fbgemm (test_qlinear_packed_params.TestQlinearPackedParams.test_qlinear_packed_params_fbgemm) ... /workspace/build_worktrees/pytorch-qlinear-delivery-56ad40b/test/ao/sparsity/test_qlinear_packed_params.py:48: UserWarning: torch.quantize_per_tensor, torch.quantize_per_channel and other quantized tensor creation functions that produce tensors with dtype torch.quint8, torch.qint8, and torch.qint32 are deprecated and will be removed in a future PyTorch release. Please see https://github.com/pytorch/pytorch/issues/184982 for more information. (Triggered internally at /workspace/PyTorch/aten/src/ATen/quantized/Quantizer.cpp:111.)
27+ torch.quantize_per_tensor(weight_fp32, scales[0], zero_points[0], dtype),
28+ERROR
29+test_qlinear_packed_params_fbgemm_qnnpack_cross_compatibility (test_qlinear_packed_params.TestQlinearPackedParams.test_qlinear_packed_params_fbgemm_qnnpack_cross_compatibility) ... ERROR
30+test_qlinear_packed_params_qnnpack (test_qlinear_packed_params.TestQlinearPackedParams.test_qlinear_packed_params_qnnpack) ... ERROR
31+ 
32+======================================================================
33+ERROR: test_qlinear_packed_params_fbgemm (test_qlinear_packed_params.TestQlinearPackedParams.test_qlinear_packed_params_fbgemm)
34+----------------------------------------------------------------------
35+Traceback (most recent call last):
36+ File "/workspace/PyTorch/torch/testing/_internal/common_utils.py", line 3810, in wrapper
37+ method(*args, **kwargs)
38+ File "/workspace/PyTorch/torch/testing/_internal/common_quantization.py", line 363, in wrapper
39+ fn(*args, **kwargs)
40+ File "/workspace/build_worktrees/pytorch-qlinear-delivery-56ad40b/test/ao/sparsity/test_qlinear_packed_params.py", line 182, in test_qlinear_packed_params_fbgemm
41+ self.qlinear_packed_params_test(allow_non_zero_zero_points=False)
42+ File "/workspace/build_worktrees/pytorch-qlinear-delivery-56ad40b/test/ao/sparsity/test_qlinear_packed_params.py", line 164, in qlinear_packed_params_test
43+ lin2 = torch.load(file_buff)
44+ ^^^^^^^^^^^^^^^^^^^^^
45+ File "/workspace/venvs/pytorch-npu/lib/python3.12/site-packages/torch_npu/utils/serialization.py", line 276, in load
46+ return _load(
47+ ^^^^^^
48+ File "/workspace/PyTorch/torch/serialization.py", line 2241, in _load
49+ result = unpickler.load()
50+ ^^^^^^^^^^^^^^^^
51+ File "/workspace/PyTorch/torch/_weights_only_unpickler.py", line 378, in load
52+ raise UnpicklingError(
53+_pickle.UnpicklingError: Unsupported global: GLOBAL torch.ao.nn.sparse.quantized.dynamic.linear.Linear was not an allowed global by default. Please use `torch.serialization.add_safe_globals([torch.ao.nn.sparse.quantized.dynamic.linear.Linear])` or the `torch.serialization.safe_globals([torch.ao.nn.sparse.quantized.dynamic.linear.Linear])` context manager to allowlist this global if you trust this class/function.
54+ 
55+To execute this test, run the following from the base repo dir:
56+ python test/ao/sparsity/test_qlinear_packed_params.py TestQlinearPackedParams.test_qlinear_packed_params_fbgemm
57+ 
58+This message can be suppressed by setting PYTORCH_PRINT_REPRO_ON_FAILURE=0
59+ 
60+======================================================================
61+ERROR: test_qlinear_packed_params_fbgemm_qnnpack_cross_compatibility (test_qlinear_packed_params.TestQlinearPackedParams.test_qlinear_packed_params_fbgemm_qnnpack_cross_compatibility)
62+----------------------------------------------------------------------
63+Traceback (most recent call last):
64+ File "/workspace/PyTorch/torch/testing/_internal/common_utils.py", line 3810, in wrapper
65+ method(*args, **kwargs)
66+ File "/workspace/build_worktrees/pytorch-qlinear-delivery-56ad40b/test/ao/sparsity/test_qlinear_packed_params.py", line 265, in test_qlinear_packed_params_fbgemm_qnnpack_cross_compatibility
67+ packed_params_data_1b = load_get_state_weight_bias(file_buff_1)
68+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
69+ File "/workspace/build_worktrees/pytorch-qlinear-delivery-56ad40b/test/ao/sparsity/test_qlinear_packed_params.py", line 238, in load_get_state_weight_bias
70+ lin2 = torch.load(f_b)
71+ ^^^^^^^^^^^^^^^
72+ File "/workspace/venvs/pytorch-npu/lib/python3.12/site-packages/torch_npu/utils/serialization.py", line 276, in load
73+ return _load(
74+ ^^^^^^
75+ File "/workspace/PyTorch/torch/serialization.py", line 2241, in _load
76+ result = unpickler.load()
77+ ^^^^^^^^^^^^^^^^
78+ File "/workspace/PyTorch/torch/_weights_only_unpickler.py", line 378, in load
79+ raise UnpicklingError(
80+_pickle.UnpicklingError: Unsupported global: GLOBAL torch.ao.nn.sparse.quantized.dynamic.linear.Linear was not an allowed global by default. Please use `torch.serialization.add_safe_globals([torch.ao.nn.sparse.quantized.dynamic.linear.Linear])` or the `torch.serialization.safe_globals([torch.ao.nn.sparse.quantized.dynamic.linear.Linear])` context manager to allowlist this global if you trust this class/function.
81+ 
82+To execute this test, run the following from the base repo dir:
83+ python test/ao/sparsity/test_qlinear_packed_params.py TestQlinearPackedParams.test_qlinear_packed_params_fbgemm_qnnpack_cross_compatibility
84+ 
85+This message can be suppressed by setting PYTORCH_PRINT_REPRO_ON_FAILURE=0
86+ 
87+======================================================================
88+ERROR: test_qlinear_packed_params_qnnpack (test_qlinear_packed_params.TestQlinearPackedParams.test_qlinear_packed_params_qnnpack)
89+----------------------------------------------------------------------
90+Traceback (most recent call last):
91+ File "/workspace/PyTorch/torch/testing/_internal/common_utils.py", line 3810, in wrapper
92+ method(*args, **kwargs)
93+ File "/workspace/PyTorch/torch/testing/_internal/common_quantization.py", line 381, in wrapper
94+ fn(*args, **kwargs)
95+ File "/workspace/build_worktrees/pytorch-qlinear-delivery-56ad40b/test/ao/sparsity/test_qlinear_packed_params.py", line 189, in test_qlinear_packed_params_qnnpack
96+ self.qlinear_packed_params_test(allow_non_zero_zero_points=True)
97+ File "/workspace/build_worktrees/pytorch-qlinear-delivery-56ad40b/test/ao/sparsity/test_qlinear_packed_params.py", line 164, in qlinear_packed_params_test
98+ lin2 = torch.load(file_buff)
99+ ^^^^^^^^^^^^^^^^^^^^^
100+ File "/workspace/venvs/pytorch-npu/lib/python3.12/site-packages/torch_npu/utils/serialization.py", line 276, in load
101+ return _load(
102+ ^^^^^^
103+ File "/workspace/PyTorch/torch/serialization.py", line 2241, in _load
104+ result = unpickler.load()
105+ ^^^^^^^^^^^^^^^^
106+ File "/workspace/PyTorch/torch/_weights_only_unpickler.py", line 378, in load
107+ raise UnpicklingError(
108+_pickle.UnpicklingError: Unsupported global: GLOBAL torch.ao.nn.sparse.quantized.dynamic.linear.Linear was not an allowed global by default. Please use `torch.serialization.add_safe_globals([torch.ao.nn.sparse.quantized.dynamic.linear.Linear])` or the `torch.serialization.safe_globals([torch.ao.nn.sparse.quantized.dynamic.linear.Linear])` context manager to allowlist this global if you trust this class/function.
109+ 
110+To execute this test, run the following from the base repo dir:
111+ python test/ao/sparsity/test_qlinear_packed_params.py TestQlinearPackedParams.test_qlinear_packed_params_qnnpack
112+ 
113+This message can be suppressed by setting PYTORCH_PRINT_REPRO_ON_FAILURE=0
114+ 
115+----------------------------------------------------------------------
116+Ran 3 tests in 0.095s
117+ 
118+FAILED (errors=3)
119+HW classification mode active (['GENERIC']): total=3, passed=3, unclassified=0, mismatched=0
120+RESULT_JSON=/workspace/build_logs/pytorch-stack/qlinear-delivery-193177-a2-20260914/generic.json
121+RESULT={"mode": "generic", "tests_run": 3, "passed": 0, "failures": 0, "errors": 3, "skipped": 0, "exit_code": 1}
@@ -0,0 +1,122 @@
1+{
2+ "started_at_utc": "2026-09-14T09:28:12.995299+00:00",
3+ "mode": "generic",
4+ "python": "/workspace/venvs/pytorch-npu/bin/python",
5+ "python_version": "3.12.13",
6+ "torch_version": "2.14.0a0+gitbe42873",
7+ "torch_file": "/workspace/PyTorch/torch/__init__.py",
8+ "torch_git_version": "be4287301021e31b9f7d76bef1633a39dba00319",
9+ "torch_npu_version": "2.14.0a0+gitc0ee704",
10+ "torch_npu_file": "/workspace/venvs/pytorch-npu/lib/python3.12/site-packages/torch_npu/__init__.py",
11+ "npu_available": true,
12+ "npu_count": 1,
13+ "quantized_engines": [
14+ "qnnpack",
15+ "onednn",
16+ "x86",
17+ "fbgemm"
18+ ],
19+ "final_test_commit": "56ad40b9339e91b41d0e3bced0295841a4c059ca",
20+ "final_test_blob": "d1162cd2a65c96785f836a34df05038af6a6cf57",
21+ "runtime_commit": "be4287301021e31b9f7d76bef1633a39dba00319",
22+ "runtime_status": "",
23+ "weights_only_override": null
24+}
25+/workspace/venvs/pytorch-npu/lib/python3.12/site-packages/torch_npu/dynamo/__init__.py:182: UserWarning: Register eager implementation for the 'npu' backend of dynamo, as torch_npu was not compiled with torchair.
26+ warnings.warn(
27+test_qlinear_packed_params_fbgemm (test_qlinear_packed_params.TestQlinearPackedParams.test_qlinear_packed_params_fbgemm) ... /workspace/build_worktrees/pytorch-qlinear-lint-56ad40b/test/ao/sparsity/test_qlinear_packed_params.py:48: UserWarning: torch.quantize_per_tensor, torch.quantize_per_channel and other quantized tensor creation functions that produce tensors with dtype torch.quint8, torch.qint8, and torch.qint32 are deprecated and will be removed in a future PyTorch release. Please see https://github.com/pytorch/pytorch/issues/184982 for more information. (Triggered internally at /workspace/PyTorch/aten/src/ATen/quantized/Quantizer.cpp:111.)
28+ torch.quantize_per_tensor(weight_fp32, scales[0], zero_points[0], dtype),
29+ERROR
30+test_qlinear_packed_params_fbgemm_qnnpack_cross_compatibility (test_qlinear_packed_params.TestQlinearPackedParams.test_qlinear_packed_params_fbgemm_qnnpack_cross_compatibility) ... ERROR
31+test_qlinear_packed_params_qnnpack (test_qlinear_packed_params.TestQlinearPackedParams.test_qlinear_packed_params_qnnpack) ... ERROR
32+ 
33+======================================================================
34+ERROR: test_qlinear_packed_params_fbgemm (test_qlinear_packed_params.TestQlinearPackedParams.test_qlinear_packed_params_fbgemm)
35+----------------------------------------------------------------------
36+Traceback (most recent call last):
37+ File "/workspace/PyTorch/torch/testing/_internal/common_utils.py", line 3810, in wrapper
38+ method(*args, **kwargs)
39+ File "/workspace/PyTorch/torch/testing/_internal/common_quantization.py", line 363, in wrapper
40+ fn(*args, **kwargs)
41+ File "/workspace/build_worktrees/pytorch-qlinear-lint-56ad40b/test/ao/sparsity/test_qlinear_packed_params.py", line 182, in test_qlinear_packed_params_fbgemm
42+ self.qlinear_packed_params_test(allow_non_zero_zero_points=False)
43+ File "/workspace/build_worktrees/pytorch-qlinear-lint-56ad40b/test/ao/sparsity/test_qlinear_packed_params.py", line 164, in qlinear_packed_params_test
44+ lin2 = torch.load(file_buff)
45+ ^^^^^^^^^^^^^^^^^^^^^
46+ File "/workspace/venvs/pytorch-npu/lib/python3.12/site-packages/torch_npu/utils/serialization.py", line 276, in load
47+ return _load(
48+ ^^^^^^
49+ File "/workspace/PyTorch/torch/serialization.py", line 2241, in _load
50+ result = unpickler.load()
51+ ^^^^^^^^^^^^^^^^
52+ File "/workspace/PyTorch/torch/_weights_only_unpickler.py", line 378, in load
53+ raise UnpicklingError(
54+_pickle.UnpicklingError: Unsupported global: GLOBAL torch.ao.nn.sparse.quantized.dynamic.linear.Linear was not an allowed global by default. Please use `torch.serialization.add_safe_globals([torch.ao.nn.sparse.quantized.dynamic.linear.Linear])` or the `torch.serialization.safe_globals([torch.ao.nn.sparse.quantized.dynamic.linear.Linear])` context manager to allowlist this global if you trust this class/function.
55+ 
56+To execute this test, run the following from the base repo dir:
57+ python test/ao/sparsity/test_qlinear_packed_params.py TestQlinearPackedParams.test_qlinear_packed_params_fbgemm
58+ 
59+This message can be suppressed by setting PYTORCH_PRINT_REPRO_ON_FAILURE=0
60+ 
61+======================================================================
62+ERROR: test_qlinear_packed_params_fbgemm_qnnpack_cross_compatibility (test_qlinear_packed_params.TestQlinearPackedParams.test_qlinear_packed_params_fbgemm_qnnpack_cross_compatibility)
63+----------------------------------------------------------------------
64+Traceback (most recent call last):
65+ File "/workspace/PyTorch/torch/testing/_internal/common_utils.py", line 3810, in wrapper
66+ method(*args, **kwargs)
67+ File "/workspace/build_worktrees/pytorch-qlinear-lint-56ad40b/test/ao/sparsity/test_qlinear_packed_params.py", line 265, in test_qlinear_packed_params_fbgemm_qnnpack_cross_compatibility
68+ packed_params_data_1b = load_get_state_weight_bias(file_buff_1)
69+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
70+ File "/workspace/build_worktrees/pytorch-qlinear-lint-56ad40b/test/ao/sparsity/test_qlinear_packed_params.py", line 238, in load_get_state_weight_bias
71+ lin2 = torch.load(f_b)
72+ ^^^^^^^^^^^^^^^
73+ File "/workspace/venvs/pytorch-npu/lib/python3.12/site-packages/torch_npu/utils/serialization.py", line 276, in load
74+ return _load(
75+ ^^^^^^
76+ File "/workspace/PyTorch/torch/serialization.py", line 2241, in _load
77+ result = unpickler.load()
78+ ^^^^^^^^^^^^^^^^
79+ File "/workspace/PyTorch/torch/_weights_only_unpickler.py", line 378, in load
80+ raise UnpicklingError(
81+_pickle.UnpicklingError: Unsupported global: GLOBAL torch.ao.nn.sparse.quantized.dynamic.linear.Linear was not an allowed global by default. Please use `torch.serialization.add_safe_globals([torch.ao.nn.sparse.quantized.dynamic.linear.Linear])` or the `torch.serialization.safe_globals([torch.ao.nn.sparse.quantized.dynamic.linear.Linear])` context manager to allowlist this global if you trust this class/function.
82+ 
83+To execute this test, run the following from the base repo dir:
84+ python test/ao/sparsity/test_qlinear_packed_params.py TestQlinearPackedParams.test_qlinear_packed_params_fbgemm_qnnpack_cross_compatibility
85+ 
86+This message can be suppressed by setting PYTORCH_PRINT_REPRO_ON_FAILURE=0
87+ 
88+======================================================================
89+ERROR: test_qlinear_packed_params_qnnpack (test_qlinear_packed_params.TestQlinearPackedParams.test_qlinear_packed_params_qnnpack)
90+----------------------------------------------------------------------
91+Traceback (most recent call last):
92+ File "/workspace/PyTorch/torch/testing/_internal/common_utils.py", line 3810, in wrapper
93+ method(*args, **kwargs)
94+ File "/workspace/PyTorch/torch/testing/_internal/common_quantization.py", line 381, in wrapper
95+ fn(*args, **kwargs)
96+ File "/workspace/build_worktrees/pytorch-qlinear-lint-56ad40b/test/ao/sparsity/test_qlinear_packed_params.py", line 189, in test_qlinear_packed_params_qnnpack
97+ self.qlinear_packed_params_test(allow_non_zero_zero_points=True)
98+ File "/workspace/build_worktrees/pytorch-qlinear-lint-56ad40b/test/ao/sparsity/test_qlinear_packed_params.py", line 164, in qlinear_packed_params_test
99+ lin2 = torch.load(file_buff)
100+ ^^^^^^^^^^^^^^^^^^^^^
101+ File "/workspace/venvs/pytorch-npu/lib/python3.12/site-packages/torch_npu/utils/serialization.py", line 276, in load
102+ return _load(
103+ ^^^^^^
104+ File "/workspace/PyTorch/torch/serialization.py", line 2241, in _load
105+ result = unpickler.load()
106+ ^^^^^^^^^^^^^^^^
107+ File "/workspace/PyTorch/torch/_weights_only_unpickler.py", line 378, in load
108+ raise UnpicklingError(
109+_pickle.UnpicklingError: Unsupported global: GLOBAL torch.ao.nn.sparse.quantized.dynamic.linear.Linear was not an allowed global by default. Please use `torch.serialization.add_safe_globals([torch.ao.nn.sparse.quantized.dynamic.linear.Linear])` or the `torch.serialization.safe_globals([torch.ao.nn.sparse.quantized.dynamic.linear.Linear])` context manager to allowlist this global if you trust this class/function.
110+ 
111+To execute this test, run the following from the base repo dir:
112+ python test/ao/sparsity/test_qlinear_packed_params.py TestQlinearPackedParams.test_qlinear_packed_params_qnnpack
113+ 
114+This message can be suppressed by setting PYTORCH_PRINT_REPRO_ON_FAILURE=0
115+ 
116+----------------------------------------------------------------------
117+Ran 3 tests in 0.024s
118+ 
119+FAILED (errors=3)
120+HW classification mode active (['GENERIC']): total=3, passed=3, unclassified=0, mismatched=0
121+RESULT_JSON=/workspace/build_logs/pytorch-stack/qlinear-delivery-193177-20260914/generic.json
122+RESULT={"mode": "generic", "tests_run": 3, "passed": 0, "failures": 0, "errors": 3, "skipped": 0, "exit_code": 1}
@@ -0,0 +1,115 @@
1+# test_qlinear_packed_params解耦交付报告
2+ 
3+开发者:GitHub `KevinLee1231` / GitCode `kevin_lee1231`。任务编号:6。整理日期:2026-09-22。
4+ 
5+本报告对应 PyTorch 上游 PR [#193177](https://github.com/pytorch/pytorch/pull/193177),按指导书场景四“无需解耦改造,NPU 测试失败”交付。上游分类变更已合入。A2(910B3)和 A5(950PR)的默认运行均出现 3 个反序列化错误,各自环境中的未修改测试也出现相同错误;设置诊断变量后均为 3/3 通过。错误归类为框架兼容性,详细说明见第 4 节。
6+ 
7+## 1. 背景
8+ 
9+目标文件为 `test/ao/sparsity/test_qlinear_packed_params.py`,涉及 `torch.ao` 稀疏动态量化线性层。`TestQlinearPackedParams` 验证参数打包、解包、序列化、反序列化及 FBGEMM/QNNPACK 之间的兼容性。
10+ 
11+该文件执行 CPU 量化后端逻辑,没有需要改写的 CUDA 绑定执行逻辑。本次补充 `HardwareClassification.GENERIC` 标签,供社区测试调度框架识别;保留原有 FBGEMM/QNNPACK 可用性守卫,不生成 NPU 设备变体。下文的 NPU 环境测试结果不代表 NPU 算子执行结果。
12+ 
13+## 2. 方案
14+ 
15+仅导入 `HardwareClassification` 并为测试类添加分类属性,上游差异为新增 3 行、删除 1 行:
16+ 
17+```python
18+from torch.testing._internal.common_utils import HardwareClassification, TestCase
19+ 
20+ 
21+class TestQlinearPackedParams(TestCase):
22+ hw_classification = HardwareClassification.GENERIC
23+```
24+ 
25+原有测试方法、输入、断言及执行逻辑保持不变,三个方法分别为:
26+ 
27+1. `test_qlinear_packed_params_fbgemm`
28+2. `test_qlinear_packed_params_fbgemm_qnnpack_cross_compatibility`
29+3. `test_qlinear_packed_params_qnnpack`
30+ 
31+本次仅增加分类元数据,不引入新的设备接口,`torch_npu` 无需同步变更,现有反序列化补丁保持原样。
32+ 
33+## 3. PR 与社区接纳情况
34+ 
35+PyTorch 上游 PR [#193177](https://github.com/pytorch/pytorch/pull/193177) 已于 2026-09-14 合入 `main`,合入提交为 [`4b5f5054e13d`](https://github.com/pytorch/pytorch/commit/4b5f5054e13dac100c314a150792fcc900459599)。最终 PR 提交为 `56ad40b9339e91b41d0e3bced0295841a4c059ca`,本次实测使用该提交的目标测试文件,其内容与合入版本一致。
36+ 
37+社区评审见 [xuyun44 的 Approved review](https://github.com/pytorch/pytorch/pull/193177#pullrequestreview-4947819231) 和 [fffrog 认可 GENERIC 的 Approved review](https://github.com/pytorch/pytorch/pull/193177#pullrequestreview-5099127653)。社区 CI 记录见 [PR Checks](https://github.com/pytorch/pytorch/pull/193177/checks) 与 [PyTorch HUD](https://hud.pytorch.org/pr/193177)。
38+ 
39+## 4. 验证结果与失败分析
40+ 
41+### 4.1 环境
42+ 
43+实际测试日期为 2026-09-14,各平台的环境与结果分别记录在以 A2、A5 命名的终端截图中。
44+ 
45+| 环境项 | A2 | A5 |
46+| --- | --- | --- |
47+| 设备 | Ascend 910B3 | Ascend 950PR |
48+| 服务器 | `openlibing-DevEnv-135008` | `openlibing-DevEnv-232234` |
49+| 主机架构 | `aarch64` | `x86_64` |
50+| CANN | `9.1.0-beta.3` | `9.1.0-beta.3` |
51+| Python | `3.12.13` | `3.12.13` |
52+| PyTorch 运行库 | `2.14.0a0+gitbe42873` | `2.14.0a0+gitbe42873` |
53+| torch_npu | `2.14.0a0+gitc0ee704` | `2.14.0a0+gitc0ee704` |
54+| `npu-smi` 状态 | `Alarm`,错误码 `812F8000` | `Health OK` |
55+ 
56+两平台使用各自现有的 PyTorch/torch_npu 运行库加载最终测试文件,未重新构建整个上游合入提交。A2 设备告警如实保留在截图中;现有证据未表明该告警与 CPU 量化后端的反序列化错误存在因果关系。
57+ 
58+### 4.2 收集与功能运行
59+ 
60+两平台均使用运行库自带的 `HardwareClassificationTestLoader`。默认发现与 `GENERIC` 筛选均选中原有 3 个方法,`CPU` 和 `ACCELERATOR` 筛选均选中 0 个方法。修改前后分别执行 `pytest --collect-only`,均收集到相同的 3 个测试节点;结果见各平台终端截图。
61+ 
62+| 运行方式 | A2 | A5 |
63+| --- | --- | --- |
64+| 最终版本,默认发现与默认加载设置 | 执行 3,通过 0,错误 3 | 执行 3,通过 0,错误 3 |
65+| 最终版本,`GENERIC` 筛选与默认加载设置 | 执行 3,通过 0,错误 3 | 执行 3,通过 0,错误 3 |
66+| 各自相同运行环境,未修改测试源码 | 执行 3,通过 0,错误 3 | 执行 3,通过 0,错误 3 |
67+| 最终版本,`GENERIC` 筛选,单独设置诊断变量 | 执行 3,通过 3,错误 0 | 执行 3,通过 3,错误 0 |
68+ 
69+各次运行均无跳过,`unittest` 的断言失败数 `failures=0`;表中错误指 `errors`。前三种运行方式均未设置 weights-only 兼容变量,进程退出码为 1。最后一行单独设置 `TORCH_FORCE_NO_WEIGHTS_ONLY_LOAD=1`,退出码为 0,其通过结果不计为默认功能测试通过。
70+ 
71+本次提交两份完整的 `GENERIC` 默认加载日志。默认发现、未修改源码及诊断运行的统计,以及分类和 pytest 收集结果,由各平台保留的终端截图展示。不同模式运行同一组测试,没有增减上游测试方法。
72+ 
73+### 4.3 失败分析
74+ 
75+三个测试都通过 `torch.save(lin, ...)` 保存完整的稀疏量化 `Linear` 模块,再用未显式指定 `weights_only` 的 `torch.load(...)` 读取。当前运行环境采用 weights-only 加载规则,该模块类型不在默认允许列表中,因此报错:
76+ 
77+```text
78+_pickle.UnpicklingError: Unsupported global: GLOBAL torch.ao.nn.sparse.quantized.dynamic.linear.Linear was not an allowed global by default.
79+```
80+ 
81+A5(950PR)的默认运行和 `GENERIC` 筛选运行均出现上述 3 个错误,未修改测试在同一环境下也出现相同错误;单独设置 `TORCH_FORCE_NO_WEIGHTS_ONLY_LOAD=1` 后,最终版本诊断运行 3/3 通过。A2 得到相同结果。这些证据支持将问题归为当前环境的默认加载规则与完整模块反序列化写法之间的兼容性问题,未发现错误由新增 `GENERIC` 标签引入的证据。
82+ 
83+诊断变量仅用于单独的测试进程,没有写入上游测试文件,也没有修改服务器全局配置。本次按场景四提交默认错误及其分析,保留社区原有测试语义。
84+ 
85+## 5. 交付目录与日志说明
86+ 
87+```text
88+task_6_test_qlinear_packed_params/
89+├── test_qlinear_packed_params解耦交付报告.md
90+├── log/
91+│ ├── A2-test_qlinear_packed_params.log
92+│ └── A5-test_qlinear_packed_params.log
93+└── screenshots/
94+ ├── A2-test_qlinear_packed_params.png
95+ └── A5-test_qlinear_packed_params.png
96+```
97+ 
98+| 文件 | 内容与用途 |
99+| --- | --- |
100+| [A2-test_qlinear_packed_params.log](log/A2-test_qlinear_packed_params.log) | A2(910B3)于 2026-09-14 09:45:41 UTC 开始的完整 `GENERIC` 运行日志,包含运行库与测试版本、默认加载设置、三个测试的错误堆栈、分类统计和最终结果。 |
101+| [A5-test_qlinear_packed_params.log](log/A5-test_qlinear_packed_params.log) | A5(950PR)于 2026-09-14 09:28:12 UTC 开始的完整 `GENERIC` 运行日志,内容类型与 A2 日志相同。 |
102+| [A2-test_qlinear_packed_params.png](screenshots/A2-test_qlinear_packed_params.png) | A2 终端截图,包含服务器与设备信息、环境版本、四种运行方式统计、错误详情、分类筛选及修改前后的 pytest 收集结果。 |
103+| [A5-test_qlinear_packed_params.png](screenshots/A5-test_qlinear_packed_params.png) | A5(950PR)终端截图,包含该平台的环境与上述各项运行结果。 |
104+ 
105+两份日志中的 `mode="generic"` 表示按 `GENERIC` 分类筛选;`weights_only_override=null` 表示未设置诊断变量。日志末尾分类统计的 `passed=3` 表示有 3 个测试符合分类条件;实际功能结果以 `RESULT` 中的 `tests_run=3, passed=0, failures=0, errors=3, skipped=0, exit_code=1` 为准。
106+ 
107+两张截图由开发者在相应服务器终端中查看已保存的真实运行记录时截取。截图与日志保持原始内容,两份日志统一放在 `log/`,两张截图统一放在 `screenshots/`,通过文件名中的 A2、A5 区分平台。本次提交仅保留报告、两份日志和两张截图,其余运行脚本、分项记录及元数据在本地留存。
108+ 
109+A2 终端截图:
110+ 
111+![A2 环境、默认错误、诊断通过与测试收集结果](screenshots/A2-test_qlinear_packed_params.png)
112+ 
113+A5(950PR)终端截图:
114+ 
115+![A5 环境、默认错误、诊断通过与测试收集结果](screenshots/A5-test_qlinear_packed_params.png)