torch 夜版 2.15 中的 MPS: 缺少 linalg_eig、clamp_min 进程中止、uint16 比较、linalg.qr 卡死以及内核运行速度慢于 M1 CPU(对 PyTorch MPS 团队的发现)
作者: ducha-aiki创建于 2026年9月14日更新于 2026年9月28日
| # | aten op | MPS nightly | CPU | 如何 kornia 到达它 |
|---|---|---|---|---|
| 1 | aten::linalg_eig, aten::_linalg_eigvals |
NotImplementedError: The operator 'aten::linalg_eig' is not currently implemented for the MPS device |
fine | find_essential (5-point Nistér, non-symmetric (B,10,10) companion matrix, complex eigenvalues), RANSAC(model_type="essential")。整个套件中唯一一个缺失的操作。 |
| 2 | aten::clamp_min (以及 clamp/clamp_max),在 float32 范围之外的 Python 类型浮点数上,在 float32 向量上 |
libc++abi: terminating due to uncaught exception of type std::runtime_error: value cannot be converted to type float without overflow → SIGABRT, 进程死亡 |
会引发捕获的 RuntimeError,内容相同 |
任何 float64 衍生的边界,例如 torch.finfo(torch.float64).min 与 float32 向量匹配。 torch.full_like(x_f32, 1.8e308) 在两个设备上都可以清晰地执行,因此抛出只来自 clamp 内核的标量转换。 |
| 3 | uint16 比较:aten::eq, aten::ne, aten::lt, torch.equal |
RuntimeError: Failed to create function state object for: eq_dense_bool_ushort (也包括 eq_strided_bool_ushort, ne_…, lt_…) |
fine | 使用 ImageLoadType.UNCHANGED 加载的 16 位 PNG/TIFF,并移动到 MPS。 uint8 / int16 / int32 比较工作。 |
| 4 | aten::linalg_qr |
病理性地缓慢,然后卡死,在一个大小下返回错误结果,并且机器被强制重置 - 请参见下面 | fine | 4 点的弧变换最小路径((B, 9, 8) 的完整 QR),solve_pnp_dlt(3x3 RQ),在 MPS 上构建时 nn.init.orthogonal_ 在 HardNet8 中 |
2 和 3 的重现:
import torch
x = torch.zeros(3, device="mps")
torch.full_like(x, 1.7976931348623157e+308) # RuntimeError on cpu and mps alike
x.clamp_min(-1.7976931348623157e+308) # cpu: RuntimeError; mps: libc++abi terminate ->
…内容来源: kornia/kornia