Commit 6c6e368
[Hexagon] Use single allocation to back 2-d arrays (apache#10903)
* [Hexagon] Use single allocation to back 2-d arrays
Currently, each allocation allocates an entire page, so even a
relatively small number of allocations can use very large amounts of
VTCM. This commit changes calls to `AllocVtcmWorkspace` of shape
`[N,M]` from performing `N` allocations of size `M`, to 1 allocation
of size `N*M`. Since `N` is usually much smaller than a page, this
reduces the total amount of memory required.
This is an intermediate step, where the long-term solution is to use
static planning for VTCM allocations. This returns the same `void**`
type as the static planning eventually will, but avoids excess memory
use in the meantime.
* [Hexagon] Maintain alignment of allocations
Previously, when a single monolithic allocation is used to back a 2-d
Hexagon buffer of shape `[nallocs, nbytes_per_allocation]`, the
allocation itself is aligned, but each individual region is not. This
commit ensures that each individual region also followed the alignment
specified.1 parent 0542a69 commit 6c6e368
1 file changed
+16
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
153 | 165 | | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
| 166 | + | |
| 167 | + | |
163 | 168 | | |
| 169 | + | |
| 170 | + | |
164 | 171 | | |
165 | 172 | | |
166 | 173 | | |
| |||
0 commit comments