2525 f'flag_gems.runtime.backend._mthreads.ops.{ __name__ .split ("." )[- 1 ]} '
2626)
2727
28- # Moore Threads hardware does not support fp64 compute. The Hessenberg reduction
29- # (O(n³) bulk of the eigenvalue algorithm) runs in fp32 Triton on-device;
30- # only the final QR eigenvalue extraction runs on CPU LAPACK. Matrices larger
31- # than _HESS_MAX_N cannot fit in one register tile and fall back to a full
32- # CPU solve. Complex inputs are unsupported (MUSA has no device-side complex
33- # storage) and also fall back.
3428_SUPPORTED_DTYPES = {torch .float32 }
35- _HESS_MAX_N = 192
29+ _HESS_MAX_N = 128
3630
3731
3832@libentry ()
@@ -147,12 +141,10 @@ def _linalg_eigvals(inp):
147141
148142 Moore Threads specialization. The hardware does not support fp64 compute or
149143 device-side complex tensors, so the Hessenberg reduction runs in fp32 Triton
150- on-device (the O(n³) bulk of the algorithm), and only the final QR eigenvalue
151- extraction runs on CPU LAPACK. This structure matches the thead specialization
152- (#167) but operates entirely in fp32 due to MUSA hardware constraints.
144+ on-device and the final QR eigenvalue extraction runs on CPU LAPACK.
153145
154- Matrices up to 192×192 use the on-device Hessenberg kernel; larger matrices
155- exceed register tile limits and fall back to the generic implementation.
146+ Matrices smaller than _HESS_MAX_N use the on-device Hessenberg kernel; larger
147+ matrices fall back to the generic implementation.
156148 """
157149 logger .debug ("GEMS_MTHREADS _LINALG_EIGVALS" )
158150
@@ -164,14 +156,11 @@ def _linalg_eigvals(inp):
164156 "_linalg_eigvals: input must be a square matrix or batch of square matrices"
165157 )
166158
167- # Matrices >192×192 exceed the register tile limit of the Hessenberg kernel;
168- # defer to the generic implementation instead.
169159 n = inp .shape [- 1 ]
170- if n > _HESS_MAX_N :
160+ if n >= _HESS_MAX_N :
171161 return default_linalg_eigvals (inp )
172162
173163 if inp .ndim > 2 :
174- # Batched: reduce each matrix on device, one LAPACK solve each.
175164 flat = inp .reshape (- 1 , inp .shape [- 2 ], inp .shape [- 1 ])
176165 cols = [_eigvals_impl (m ) for m in flat ]
177166 return torch .stack (cols ).reshape (* inp .shape [:- 2 ], inp .shape [- 1 ])
0 commit comments