Commit dea9b90
[MAGMA][CUDA] eig: deprecate MAGMA and dispatch to cuSOLVER unconditionally (pytorch#173510)
As per title.
Benchmark script:
```python
import torch
import torch.utils.benchmark as benchmark
from itertools import product
results = []
batches = [(), (16,), (64,)]
sizes = [16, 128, 512, 2048]
for b, n in product(batches, sizes):
shape = b + (n, n)
print(f"Testing shape={shape}")
label = "torch.eig"
sub_label = f"{shape}"
x = torch.rand(*shape, device="cuda")
x = x + x.mH
stmt = "torch.linalg.eig(x)"
for backend in ("magma", "cusolver"):
torch.backends.cuda.preferred_linalg_library(backend)
# warm-up
for _ in range(5):
exec(stmt)
results.append(benchmark.Timer(
stmt=stmt,
globals={'x': x},
label=label,
sub_label=sub_label,
description=backend,
).blocked_autorange(min_run_time=1))
compare = benchmark.Compare(results)
compare.print()
```
Benchmark results (H100):
```
[-------------------- torch.eig -------------------]
| magma | cusolver | cusolver speedup
1 threads: ------------------------------------------
(16, 16) | 67215.3 | 893.3 | 75.24
(128, 128) | 390101.4 | 10526.9 | 37.05
(512, 512) | 1614706.1 | 61347.5 | 26.32
(2048, 2048) | 6447301.5 | 356181.2 | 18.10
(16, 16, 16) | 660036.1 | 13095.2 | 50.40
(16, 128, 128) | 6530718.7 | 166647.0 | 39.18
(16, 512, 512) | 20375827.4 | 994115.1 | 20.49
(16, 2048, 2048) | 98335490.6 | 5717112.5 | 17.20
(64, 16, 16) | 2167358.2 | 51977.5 | 41.69
(64, 128, 128) | 25925259.8 | 664574.7 | 39.01
(64, 512, 512) | 84731703.1 | 3946917.0 | 21.46
(64, 2048, 2048) | 380878661.3 | 23008593.5 | 16.55
Times are in microseconds (us).
```
Pull Request resolved: pytorch#173510
Approved by: https://github.com/Skylion0071 parent c0b01aa commit dea9b90
File tree
4 files changed
+42
-38
lines changed- aten/src/ATen/native/cuda/linalg
- test
- torch/testing/_internal
4 files changed
+42
-38
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
| 153 | + | |
153 | 154 | | |
154 | 155 | | |
155 | 156 | | |
156 | 157 | | |
157 | 158 | | |
158 | 159 | | |
159 | 160 | | |
| 161 | + | |
160 | 162 | | |
161 | 163 | | |
162 | 164 | | |
| |||
721 | 723 | | |
722 | 724 | | |
723 | 725 | | |
| 726 | + | |
724 | 727 | | |
725 | 728 | | |
726 | 729 | | |
| |||
800 | 803 | | |
801 | 804 | | |
802 | 805 | | |
| 806 | + | |
803 | 807 | | |
804 | 808 | | |
805 | 809 | | |
| |||
971 | 975 | | |
972 | 976 | | |
973 | 977 | | |
974 | | - | |
| 978 | + | |
975 | 979 | | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
976 | 984 | | |
977 | | - | |
978 | | - | |
979 | | - | |
980 | | - | |
981 | | - | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
982 | 989 | | |
983 | 990 | | |
984 | 991 | | |
| |||
1968 | 1975 | | |
1969 | 1976 | | |
1970 | 1977 | | |
| 1978 | + | |
1971 | 1979 | | |
1972 | 1980 | | |
1973 | 1981 | | |
| |||
2045 | 2053 | | |
2046 | 2054 | | |
2047 | 2055 | | |
| 2056 | + | |
| 2057 | + | |
2048 | 2058 | | |
| 2059 | + | |
2049 | 2060 | | |
2050 | 2061 | | |
2051 | 2062 | | |
2052 | 2063 | | |
2053 | | - | |
2054 | | - | |
2055 | | - | |
2056 | | - | |
2057 | | - | |
2058 | | - | |
2059 | | - | |
2060 | | - | |
2061 | | - | |
2062 | | - | |
2063 | | - | |
2064 | | - | |
2065 | | - | |
| 2064 | + | |
| 2065 | + | |
| 2066 | + | |
| 2067 | + | |
| 2068 | + | |
| 2069 | + | |
2066 | 2070 | | |
| 2071 | + | |
2067 | 2072 | | |
2068 | 2073 | | |
2069 | 2074 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
| 75 | + | |
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| |||
2255 | 2256 | | |
2256 | 2257 | | |
2257 | 2258 | | |
2258 | | - | |
| 2259 | + | |
2259 | 2260 | | |
2260 | 2261 | | |
2261 | 2262 | | |
| |||
2304 | 2305 | | |
2305 | 2306 | | |
2306 | 2307 | | |
2307 | | - | |
| 2308 | + | |
2308 | 2309 | | |
2309 | 2310 | | |
2310 | 2311 | | |
| |||
2414 | 2415 | | |
2415 | 2416 | | |
2416 | 2417 | | |
2417 | | - | |
| 2418 | + | |
2418 | 2419 | | |
2419 | 2420 | | |
2420 | 2421 | | |
| |||
2466 | 2467 | | |
2467 | 2468 | | |
2468 | 2469 | | |
2469 | | - | |
2470 | | - | |
2471 | | - | |
2472 | | - | |
2473 | | - | |
2474 | | - | |
2475 | | - | |
2476 | | - | |
2477 | | - | |
2478 | | - | |
2479 | | - | |
2480 | | - | |
2481 | 2470 | | |
| 2471 | + | |
2482 | 2472 | | |
2483 | 2473 | | |
2484 | 2474 | | |
| |||
2563 | 2553 | | |
2564 | 2554 | | |
2565 | 2555 | | |
2566 | | - | |
2567 | 2556 | | |
| 2557 | + | |
2568 | 2558 | | |
2569 | 2559 | | |
2570 | 2560 | | |
| |||
2626 | 2616 | | |
2627 | 2617 | | |
2628 | 2618 | | |
2629 | | - | |
| 2619 | + | |
2630 | 2620 | | |
2631 | 2621 | | |
2632 | 2622 | | |
| |||
3110 | 3100 | | |
3111 | 3101 | | |
3112 | 3102 | | |
3113 | | - | |
3114 | 3103 | | |
| 3104 | + | |
3115 | 3105 | | |
3116 | 3106 | | |
3117 | 3107 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1828 | 1828 | | |
1829 | 1829 | | |
1830 | 1830 | | |
| 1831 | + | |
| 1832 | + | |
| 1833 | + | |
| 1834 | + | |
| 1835 | + | |
| 1836 | + | |
| 1837 | + | |
| 1838 | + | |
| 1839 | + | |
1831 | 1840 | | |
1832 | 1841 | | |
1833 | 1842 | | |
| |||
0 commit comments