Commit 97f49ed
authored
fix: support 64K alignment (#8599)
## Rationale for this change
Our `Alignment` type currently has a restriction that it fits in a
`u16`. This is easy enough to satisfy most of the time.
However, while doing some testing with GH200 machines, which are ARM and
which [NVIDIA recommends you setup with 64K page
alignment](https://docs.nvidia.com/dccpu/grace-perf-tuning-guide/os-settings.html#page-size),
I have seen some production code fail because it uses a custom allocator
that passes back page-aligned memory, and attempting to construct 64K
alignment is one past the maximum value so it panics.
## What changes are included in this PR?
- Remove panic if `Alignment > u16::MAX`, now you can represent 64K
alignment on buffers
-
## What APIs are changed? Are there any user-facing changes?
`Alignment` now has no restriction that it must fit into a `u16`.
The infallable `From<Alignment> for u16` impl has been removed entirely,
there were zero callers within Vortex. This is technically a breaking
change and anyone who was relying on this behavior should switch to
using the exponent instead which will fit in `u8`.
Signed-off-by: Andrew Duffy <andrew@a10y.dev>1 parent 3c53111 commit 97f49ed
2 files changed
Lines changed: 16 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | | - | |
| 13 | + | |
15 | 14 | | |
16 | 15 | | |
17 | 16 | | |
| |||
32 | 31 | | |
33 | 32 | | |
34 | 33 | | |
35 | | - | |
| 34 | + | |
36 | 35 | | |
37 | 36 | | |
38 | 37 | | |
39 | | - | |
40 | 38 | | |
41 | 39 | | |
42 | 40 | | |
| |||
63 | 61 | | |
64 | 62 | | |
65 | 63 | | |
66 | | - | |
67 | | - | |
| 64 | + | |
| 65 | + | |
68 | 66 | | |
69 | 67 | | |
70 | 68 | | |
| |||
110 | 108 | | |
111 | 109 | | |
112 | 110 | | |
113 | | - | |
| 111 | + | |
114 | 112 | | |
115 | 113 | | |
116 | 114 | | |
117 | 115 | | |
118 | 116 | | |
119 | 117 | | |
120 | | - | |
| 118 | + | |
121 | 119 | | |
122 | 120 | | |
123 | 121 | | |
| |||
160 | 158 | | |
161 | 159 | | |
162 | 160 | | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | 161 | | |
171 | 162 | | |
172 | 163 | | |
| |||
184 | 175 | | |
185 | 176 | | |
186 | 177 | | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | 178 | | |
191 | 179 | | |
192 | 180 | | |
| |||
206 | 194 | | |
207 | 195 | | |
208 | 196 | | |
209 | | - | |
210 | | - | |
211 | | - | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
212 | 202 | | |
213 | 203 | | |
214 | 204 | | |
| |||
238 | 228 | | |
239 | 229 | | |
240 | 230 | | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
241 | 235 | | |
242 | 236 | | |
243 | 237 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| |||
0 commit comments