ARM-software / abi-aa

Application Binary Interface for the Arm® Architecture
Other
878 stars 173 forks source link

PCS is not clear if SVE VG can be changed #260

Open a74nh opened 2 months ago

a74nh commented 2 months ago

The Procedure Call Standard for the Arm® 64-bit Architecture (AArch64) states:

Like a short vector (see Short Vectors), a scalable vector is a machine type that is composed of repeated instances of one fundamental integral or floating-point type. The number of bytes in the vector is always VG×8, where VG is a runtime value determined by the execution environment. VG is an even integer greater than or equal to 2; the ABI does not define an upper bound. VG is the same for all scalable vector types and scalable predicate types.

This states that VG is a runtime value. It is not explicit in stating if this is a fixed value.

If a program whilst executing were to use Linux syscall prctl() to change the vector length, then that would change VG. It's not clear if this breaks the Procedure Call Standard. Is it ok for a function to change the vector length, call new functions, reset the vector length to it's previous value, then return? What happens if a function changes the vector length then returns without restoring the original value?

It would be useful if there was an additional paragraph clarifying this.