SVE complex GEMM packing mispartitions rows at VL384 (QEMU)
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 45/100
Piste de recherche
Start with the two named complex SVE packers, kernel/arm64/gemm_ncopy_complex_sve_v1x4.c and kernel/arm64/gemm_tcopy_complex_sve_v1x4.c, and trace how their full-vector and remainder bounds determine packed layout. Build OpenBLAS with the supplied commands, then run the provided C reproducer under QEMU at VL384 for both c and z. Done means the checked outputs and unused tail pass for the affected dispatch tables without regressing the other reported vector lengths.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
SVE complex GEMM packing mispartitions rows at VL384 (QEMU)
On OpenBLAS develop 277ef7801416412ee970873701fdf14d603d2c3f and release
v0.3.34, public CGEMM/ZGEMM calls give wrong results with forced ARMV8SVE,
A64FX and NEOVERSEV1 dispatch at SVE VL384 under QEMU 8.2.2 and 10.2.1.
The one-call reproducer below uses column-major NoTrans/NoTrans, alpha=1,
beta=0, N=K=2, and M=13 for c or M=7 for z. With zero-based row i,
A(i,h)=i+2h+1 and B=1, so every result has real part 2*i+4 and imaginary
part zero. It checks all requested outputs and the unused output tail.
These two vectors pass with ARMV8 and NEOVERSEV2 dispatch at VL384, and
with the affected tables at the other five tested lengths: 128, 256, 512,
1024 and 2048 bits. Original Reference BLAS v3.12.1 CGEMM/ZGEMM returns the
expected results on both emulators at all six tested lengths. These pass
statements describe these reduced vectors.
Suspected cause and distinct path
The complex SVE packers kernel/arm64/gemm_ncopy_complex_sve_v1x4.c
and kernel/arm64/gemm_tcopy_complex_sve_v1x4.c
use n & -sve_size to select full vectors. At VL384, the lane counts are
12 for float and 6 for double. Thus 13 & -12 = 4 and 7 & -6 = 2,
where floor-to-multiple counts would be 12 and 6. The full-vector loop
advances by the actual vector width, while the remainder uses the masked
bound, making the packed layout inconsistent.
The NoTrans/NoTrans complex calls reach the regular GEMM path and its
complex tcopy packer. These tables use the generic complex small-matrix
permit, whose executable body returns zero
(kernel/generic/zgemm_small_matrix_permit.c).
This report is deliberately anchored on C/Z calls: tiny real S/D GEMM
calls in this build enter separate small-matrix kernels and do not isolate
the regular real packers.
This count calculation is separate from the SYRK/SYR2K driver panel-split
problem in #6100.
Arithmetic division/remainder is a candidate direction; no source repair
has been implemented or tested for this report.
Hardware scope
The names above select OpenBLAS dispatch tables on QEMU's max CPU.
Documented maximum SVE lengths for the named processors are 128 bits for
Neoverse N2/V2, 256 bits for Neoverse V1, and 512 bits for A64FX
(Arm, NVIDIA).
SVE permits non-power-of-two multiples of 128 bits;
VL384 is an architectural conformance case supported by QEMU. These forced
table/VL combinations do not establish a failure on the named native
processors. Native confirmation is unavailable.
Reproduce
On Linux, use Git, GNU Make, host GCC, an AArch64 GCC cross toolchain
with its glibc sysroot, and QEMU user mode. GCC 15.2 was used for the
reported builds. Save the C block below as repro-complex.c in a clean
working directory, then run these commands from that directory:
git init openblas-src
git -C openblas-src fetch --depth=1 https://github.com/OpenMathLib/OpenBLAS.git 277ef7801416412ee970873701fdf14d603d2c3f
git -C openblas-src checkout --detach FETCH_HEAD
cd openblas-src
make -j4 ARCH=arm64 BINARY=64 TARGET=ARMV8 DYNAMIC_ARCH=1 \
'DYNAMIC_LIST=ARMV8SVE A64FX NEOVERSEV1 NEOVERSEN2' \
NOFORTRAN=1 NO_LAPACK=1 USE_THREAD=0 NUM_THREADS=1 HOSTCC=gcc \
CC=aarch64-linux-gnu-gcc AR=aarch64-linux-gnu-ar RANLIB=aarch64-linux-gnu-ranlib
make ARCH=arm64 BINARY=64 TARGET=ARMV8 DYNAMIC_ARCH=1 \
'DYNAMIC_LIST=ARMV8SVE A64FX NEOVERSEV1 NEOVERSEN2' \
NOFORTRAN=1 NO_LAPACK=1 USE_THREAD=0 NUM_THREADS=1 HOSTCC=gcc \
CC=aarch64-linux-gnu-gcc AR=aarch64-linux-gnu-ar RANLIB=aarch64-linux-gnu-ranlib \
PREFIX="$PWD/install" install
aarch64-linux-gnu-gcc -O2 -Wall -Wextra -Iinstall/include ../repro-complex.c \
install/lib/libopenblas.a -lm -lpthread -o complex-repro
OPENBLAS_CORETYPE=ARMV8SVE OPENBLAS_NUM_THREADS=1 \
qemu-aarch64 -L /usr/aarch64-linux-gnu \
-cpu max,sve-default-vector-length=48 ./complex-repro 384 c
Replace the final c with z for double complex. Repeat with QEMU
8.2.2's qemu-aarch64-static for the second emulator. The QEMU property
takes bytes: 48 requests VL384.
The program checks the actual vector length with PR_SVE_GET_VL and
prints the selected OpenBLAS core; confirm that the printed core matches
the requested dispatch table. Exit 0 means the checked values are right,
1 means a numerical or padding mismatch, and 2 means a setup/argument
failure rather than a valid numerical result. Each mode makes one public
BLAS call.
repro-complex.c
/* Public complex GEMM reduced from the VL384 packing search. */
#include <cblas.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/prctl.h>
int main(int argc,char **argv) {
int requested=argc>1?atoi(argv[1]):384;
int vl=prctl(51,0,0,0,0);
if(vl<0 || (vl&65535)*8!=requested)return 2;
int isdouble=argc>2&&!strcmp(argv[2],"z"),m=isdouble?7:13,n=2,k=2;
float af[256],bf[8],cf[256],alpha[2]={1,0},beta[2]={0,0};
double ad[256],bd[8],cd[256],alphad[2]={1,0},betad[2]={0,0};
for(int i=0;i<256;i++){af[i]=ad[i]=NAN;cf[i]=cd[i]=17;}
for(int h=0;h<k;h++)for(int i=0;i<m;i++){
af[2*(i+h*m)]=ad[2*(i+h*m)]=i+2*h+1;
af[2*(i+h*m)+1]=ad[2*(i+h*m)+1]=0;
}
for(int i=0;i<8;i++){bf[i]=bd[i]=(i&1)?0:1;}
for(int i=0;i<2*m*n;i++)cf[i]=cd[i]=NAN;
if(isdouble)cblas_zgemm(CblasColMajor,CblasNoTrans,CblasNoTrans,m,n,k,alphad,ad,m,bd,k,betad,cd,m);
else cblas_cgemm(CblasColMajor,CblasNoTrans,CblasNoTrans,m,n,k,alpha,af,m,bf,k,beta,cf,m);
int wrong=0;
for(int j=0;j<n;j++)for(int i=0;i<m;i++){
double actual=isdouble?cd[2*(i+j*m)]:cf[2*(i+j*m)],imag=isdouble?cd[2*(i+j*m)+1]:cf[2*(i+j*m)+1];
if(actual!=2*i+4 || imag!=0)wrong++;
}
for(int i=2*m*n;i<256;i++)wrong+=(isdouble?cd[i]:cf[i])!=17;
printf("COMPLEX-VL: %s precision=%c core=%s VL=%d m=%d n=2 k=2 last=%g want=%d wrong=%d first_surfaced_by=differential\n",
wrong?"WRONG":"RIGHT",isdouble?'z':'c',openblas_get_corename(),requested,m,
isdouble?cd[2*(m-1)]:cf[2*(m-1)],2*(m-1)+4,wrong);
return wrong?1:0;
}
First surfaced by differential testing (first_surfaced_by: differential).
- Langage dominant
- C
- Étoiles
- 7.6k
- Forks
- 1.7k
- Merge moyen
- 1 j 11 h
- PR mergées (30 j)
- 53
Préparer son environnement
Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de OpenMathLib/OpenBLAS
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
OpenMathLib/OpenBLAS#6119 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
openblas_set_threads_callback_function is a silent no-op on WindowsPeut-être pris @martin-frbg l’a pris il y a 5 jours. Ouverte
Difficulté 4/5 3-5 jours Accessibilité débutants 43/100
OpenMathLib/OpenBLAS#6108 · 2 commentaires · 1 réaction ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 4/5 3-5 jours Accessibilité débutants 43/100
OpenMathLib/OpenBLAS#6107 · 3 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 4/5 3-5 jours Accessibilité débutants 58/100
OpenMathLib/OpenBLAS#6103 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 4/5 3-5 jours Accessibilité débutants 52/100
OpenMathLib/OpenBLAS#6102 ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de OpenMathLib/OpenBLAS
Issues similaires
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 82/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
FStarLang/karamel#784 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
DaveGamble/cJSON#1100 ·
-
UB: (int) cast of a user double outside int range in dispatch / vm_index_is_int / flat_index_atOuvertearea:runtime-vm
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
InauguralSystems/EigenScript#1748 ·
Les mainteneurs répondent en général sous 1 jour
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
leanprover/lean4#15677 ·
Les mainteneurs répondent en général sous 1 jour