Commit 5da084a
Lower linear broadcasting through bipermutedimsopadd! (#232)
## Summary
Routes linear broadcasting of `AbstractNamedDimsArray`s through
TensorAlgebra's `bipermutedimsopadd!`. `copyto!` and `copy` now run the
denamed broadcast through `tryflattenlinear`, and the linear case lowers
to `permutedimsopadd!` on the name-aligned operands, where each
operand's `PermutedDimsArray` alignment is unwrapped down to the
backend's own `bipermutedimsopadd!` (the unwrap added in
ITensor/TensorAlgebra.jl#178). Nonlinear
broadcasts fall back to the existing denamed Base broadcast. For a
graded or block-sparse backing, a permuted broadcast now reaches the
block-wise primitive and the result keeps its backend type rather than
densifying.
Out-of-place results allocate from a bare operand prototype with the
broadcast result axes, since `similar` of a permuted wrapper drops the
backend.
Drops the `FunctionImplementations` dependency: `aligneddims` now gets
its lazy permute through `TensorAlgebra.permuteddims`, and the now-dead
`ImplementationStyle` trait that routed it is removed.
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>1 parent 32fc0ed commit 5da084a
3 files changed
Lines changed: 32 additions & 24 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | 13 | | |
15 | 14 | | |
16 | 15 | | |
| |||
39 | 38 | | |
40 | 39 | | |
41 | 40 | | |
42 | | - | |
43 | 41 | | |
44 | 42 | | |
45 | 43 | | |
46 | 44 | | |
47 | 45 | | |
48 | | - | |
| 46 | + | |
49 | 47 | | |
50 | 48 | | |
51 | 49 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | 1 | | |
3 | 2 | | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | 12 | | |
18 | 13 | | |
19 | 14 | | |
20 | 15 | | |
21 | 16 | | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | 17 | | |
27 | 18 | | |
28 | 19 | | |
| |||
54 | 45 | | |
55 | 46 | | |
56 | 47 | | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
| 48 | + | |
64 | 49 | | |
65 | 50 | | |
66 | 51 | | |
| |||
706 | 691 | | |
707 | 692 | | |
708 | 693 | | |
709 | | - | |
| 694 | + | |
710 | 695 | | |
711 | 696 | | |
712 | 697 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
103 | 111 | | |
104 | 112 | | |
105 | 113 | | |
| |||
120 | 128 | | |
121 | 129 | | |
122 | 130 | | |
123 | | - | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
124 | 142 | | |
125 | 143 | | |
126 | 144 | | |
127 | 145 | | |
128 | 146 | | |
129 | 147 | | |
130 | 148 | | |
131 | | - | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
132 | 157 | | |
133 | 158 | | |
0 commit comments