SDOT/DDOT overcount at SVE VL384 (QEMU)
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 52/100
- Tipo de issue
- Bug
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- c
- Domínio
- performance
Direção de pesquisa
Start with kernel/arm64/dot_kernel_sve.c and inspect how the two-vector and one-vector cutoffs are calculated from cntw or cntd; the issue identifies the non-power-of-two lane-count assumption. Build OpenBLAS for AArch64 and run the supplied repro.c under QEMU at VL384 for both single and double precision. Done means both calls return N rather than overcounting, with the reproducer passing.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
SDOT/DDOT overcount at SVE VL384 (QEMU)
On OpenBLAS develop 277ef7801416412ee970873701fdf14d603d2c3f and release
v0.3.34, one public cblas_sdot call with N=11 returns 37 instead
of 11, and one cblas_ddot call with N=5 returns 19 instead of 5,
with forced ARMV8SVE dispatch and SVE VL384 under QEMU.
Each input vector has 128 allocated elements. X[0..N-1] and all of
Y contain 1; X[N..127] contains 2. This makes reads beyond the
requested vector length affect the result while keeping these reads
inside the allocated arrays.
QEMU 8.2.2 and 10.2.1 agree. The same two calls pass with ARMV8 and
A64FX dispatch at VL384, and with ARMV8SVE, NEOVERSEV1 and NEOVERSEV2
at VL128, 256, 512, 1024 and 2048. The V1 and V2 tables fail at VL384
like ARMV8SVE. Original Reference BLAS v3.12.1 SDOT/DDOT returns
11 and 5 on both emulators at all six tested lengths. The pass
statements describe these two reduced vectors.
Source explanation
kernel/arm64/dot_kernel_sve.c
computes its two-vector and one-vector cutoffs as N & -(2*lanes)
and N & -lanes, where lanes comes from cntw or cntd.
This rounding method assumes a power-of-two lane count.
| Call at VL384 | Lanes | Two-vector cutoff | Full iteration | Result |
|---|---|---|---|---|
| SDOT, N=11 | 12 | 11 & -24 = 8 |
24 elements | 11 + 13*2 = 37 |
| DDOT, N=5 | 6 | 5 & -12 = 4 |
12 elements | 5 + 7*2 = 19 |
The nonzero cutoff enters a full two-vector iteration. The one-vector
cutoff is zero for each example, and the final tail has no active lanes.
Arithmetic division/remainder would avoid the count assumption, but no
source repair has been tested here. A64FX selects a different DOT kernel.
This is separate from #5917:
the failing path here is SVE loop-count calculation, rather than ASIMD
accumulator initialization. It is also separate from the SYRK/SYR2K
panel-split report #6100.
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.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.c \
install/lib/libopenblas.a -lm -lpthread -o dot-repro
OPENBLAS_CORETYPE=ARMV8SVE OPENBLAS_NUM_THREADS=1 \
qemu-aarch64 -L /usr/aarch64-linux-gnu \
-cpu max,sve-default-vector-length=48 ./dot-repro 384 s
OPENBLAS_CORETYPE=ARMV8SVE OPENBLAS_NUM_THREADS=1 \
qemu-aarch64 -L /usr/aarch64-linux-gnu \
-cpu max,sve-default-vector-length=48 ./dot-repro 384 d
The QEMU property is in bytes: 48 requests VL384.
Replacing qemu-aarch64 with QEMU 8.2.2's qemu-aarch64-static
repeats the comparison with the second emulator.
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 mismatch, and 2 means a setup/argument
failure rather than a valid numerical result. Each mode makes one public
BLAS call.
repro.c
/* Public SDOT/DDOT one-call reproducer for a 384-bit SVE length. */
#include <cblas.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 actual = prctl(51, 0, 0, 0, 0);
if (actual < 0 || (actual & 65535) * 8 != requested) return 2;
int isdouble = argc > 2 && !strcmp(argv[2], "d");
int n = isdouble ? 5 : 11;
float xf[128], yf[128];
double xd[128], yd[128];
for (int i = 0; i < 128; i++) {
xf[i] = xd[i] = i < n ? 1 : 2;
yf[i] = yd[i] = 1;
}
double got = isdouble ? cblas_ddot(n, xd, 1, yd, 1)
: cblas_sdot(n, xf, 1, yf, 1);
int wrong = got != n;
printf("DOT-VL: %s precision=%c core=%s VL=%d n=%d got=%g want=%d first_surfaced_by=differential\n",
wrong ? "WRONG" : "RIGHT", isdouble ? 'd' : 's',
openblas_get_corename(), requested, n, got, n);
return wrong ? 1 : 0;
}
First surfaced by differential testing (first_surfaced_by: differential).
- Linguagem predominante
- C
- Estrelas
- 7.6k
- Forks
- 1.7k
- Merge médio
- 1d 11h
- PRs com merge (30d)
- 55
Preparar o ambiente
Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de OpenMathLib/OpenBLAS
-
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 25/100
OpenMathLib/OpenBLAS#6119 · 2 comentários ·
Mantenedores costumam responder em até 1 dia
-
openblas_set_threads_callback_function is a silent no-op on WindowsTalvez já em andamento @martin-frbg assumiu há 6 dias. Aberta
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 43/100
OpenMathLib/OpenBLAS#6108 · 2 comentários · 1 reação ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 45/100
OpenMathLib/OpenBLAS#6104 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 58/100
OpenMathLib/OpenBLAS#6103 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 65/100
OpenMathLib/OpenBLAS#6100 · 2 comentários ·
Mantenedores costumam responder em até 1 dia
Todas as issues de OpenMathLib/OpenBLAS
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 80/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 85/100
libsdl-org/SDL#16530 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
FriendsofECCE/ECCE#336 · 1 comentário ·
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 85/100
fw876/helloworld#2067 ·
Mantenedores costumam responder em até 1 dia
-
mediatek/filogic: OpenFi 6C (openfi,6c): func key has wrong polarity, event class and key codeAberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
immortalwrt/immortalwrt#2501 ·