Skip to content

Commit 494da8a

Browse files
committed
move vector length at runtime warning into section
1 parent 5011dc6 commit 494da8a

1 file changed

Lines changed: 14 additions & 7 deletions

File tree

text/3838-scalable-vectors.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,20 @@ not possible for these types to be used with generic functions or traits.
289289
See
290290
[*Trait implementations and generic instantiation*][trait-implementations-and-generic-instantiation].
291291

292+
## Changing vector lengths at runtime
293+
[changing-vector-lengths-at-runtime]: #changing-vector-lengths-at-runtime
294+
295+
It is possible to change the vector length at runtime using a
296+
[`prctl()`][prctl] call to the Linux kernel, or via similar mechanisms in other
297+
operating systems.
298+
299+
Doing so would require that `vscale` change, which Rust will not supported.
300+
301+
`prctl` or similar must only be used to set up the vector length for child
302+
processes, not to change the vector length of the current process. As Rust
303+
cannot prevent users from doing this, it will be documented as undefined
304+
behaviour, consistent with C and C++.
305+
292306
## Implementing `rustc_scalable_vector`
293307
[implementing-rustc_scalable_vector]: #implementing-rustc_scalable_vector
294308

@@ -314,13 +328,6 @@ result in register sizes of 128, 256, 512, 1024 or 2048 and 4, 8, 16, 32, or 64
314328
The `N` in the `#[rustc_scalable_vector(N)]` determines the `element_count` used
315329
in the LLVM type for a scalable vector.
316330

317-
While it is possible to change the vector length at runtime using a
318-
[`prctl()`][prctl] call to the kernel, this would require that `vscale` change,
319-
which is unsupported. `prctl` must only be used to set up the vector length for
320-
child processes, not to change the vector length of the current process. As Rust
321-
cannot prevent users from doing this, it will be documented as undefined
322-
behaviour, consistent with C and C++.
323-
324331
Tuples in RISC-V's V Extension lower to target-specific types in LLVM rather
325332
than generic scalable vector types, so `rustc_scalable_vector` will not
326333
initially support RVV tuples (see

0 commit comments

Comments
 (0)