Hello,
We have found a case where the OpenPOWER nonvolatile registers vsr52-vsr63 are not saved and restored across calls to several assembly language functions.
According to the latest Power ABI (rev. 1.4 dated May 10, 2017) found at:
https://openpowerfoundation.org/?resource_lib=64-bit-elf-v2-abi-specification-power-architecture
The vector registers vr20-vr31 (see Table 2.22) are nonvolatile (callee save). The vector registers vr0-vr31 are overlaid onto Vector Scalar Registers (VSR) vsr32-vsr63 (see Fig 2.17). Thus vsr52-vsr63 are also nonvolatile, and for a routine to use any of these registers requires a save-restore sequence within the assembly code.
Within the OpenBLAS-0.2.[19,20]/kernel/power source code there are 12 files that reference these nonvolatile registers (vsr52-vsr63):
cgemm_macros_8x4_power8.S
ctrmm_macros_8x4_power8.S
dgemm_macros_16x4_power8.S
dgemm_ncopy_macros_4_power8.S
dgemm_tcopy_macros_16_power8.S
dtrmm_macros_16x4_power8.S
dtrsm_macros_LT_16x4_power8.S
sgemm_macros_16x8_power8.S
strmm_macros_16x8_power8.S
zgemm_macros_8x2_power8.S
zgemm_tcopy_macros_8_power8.S
ztrmm_macros_8x2_power8.S
These 12 files are used in a subset of the .S files which include the assembly macros within these files. These built routines do correctly save and restore fpr14-fpr31, the 64-bit registers which overlay the left half of vsr14-vsr31 (and are specified in Table 2.20 of the ABI document as nonvolatile). However, vsr52-vsr63 are NOT saved and restored. This omission means that if any of vr20-vr31 (or by different names vsr52-vsr63) are defined and then used after a call which contains any of the 12 assembly files listed above, corruption can, and indeed has, occurred. We have tracked down instances where these calls have overwritten nonvolatile registers; these cases resulted in a segfault in our test program.
We believe a solution is to save and restore vsr52-vsr63 (or vr30-vr31) in the same manner, and roughly in the same locations, as is currently done for fpr14-fpr31.
Please feel free to contact us for any additional details or further explanation.
Thanks!
Eric
Hello,
We have found a case where the OpenPOWER nonvolatile registers vsr52-vsr63 are not saved and restored across calls to several assembly language functions.
According to the latest Power ABI (rev. 1.4 dated May 10, 2017) found at:
https://openpowerfoundation.org/?resource_lib=64-bit-elf-v2-abi-specification-power-architecture
The vector registers vr20-vr31 (see Table 2.22) are nonvolatile (callee save). The vector registers vr0-vr31 are overlaid onto Vector Scalar Registers (VSR) vsr32-vsr63 (see Fig 2.17). Thus vsr52-vsr63 are also nonvolatile, and for a routine to use any of these registers requires a save-restore sequence within the assembly code.
Within the OpenBLAS-0.2.[19,20]/kernel/power source code there are 12 files that reference these nonvolatile registers (vsr52-vsr63):
cgemm_macros_8x4_power8.S
ctrmm_macros_8x4_power8.S
dgemm_macros_16x4_power8.S
dgemm_ncopy_macros_4_power8.S
dgemm_tcopy_macros_16_power8.S
dtrmm_macros_16x4_power8.S
dtrsm_macros_LT_16x4_power8.S
sgemm_macros_16x8_power8.S
strmm_macros_16x8_power8.S
zgemm_macros_8x2_power8.S
zgemm_tcopy_macros_8_power8.S
ztrmm_macros_8x2_power8.S
These 12 files are used in a subset of the .S files which include the assembly macros within these files. These built routines do correctly save and restore fpr14-fpr31, the 64-bit registers which overlay the left half of vsr14-vsr31 (and are specified in Table 2.20 of the ABI document as nonvolatile). However, vsr52-vsr63 are NOT saved and restored. This omission means that if any of vr20-vr31 (or by different names vsr52-vsr63) are defined and then used after a call which contains any of the 12 assembly files listed above, corruption can, and indeed has, occurred. We have tracked down instances where these calls have overwritten nonvolatile registers; these cases resulted in a segfault in our test program.
We believe a solution is to save and restore vsr52-vsr63 (or vr30-vr31) in the same manner, and roughly in the same locations, as is currently done for fpr14-fpr31.
Please feel free to contact us for any additional details or further explanation.
Thanks!
Eric