SDOT/DDOT overcount at SVE VL384 (QEMU)
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 52/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- c
- 領域
- performance
研究方向
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.
由索引模型根據 Issue 內容生成。
描述
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).
- 主要語言
- C
- 星號
- 7.6k
- 分支
- 1.7k
- 平均合併
- 1 天 11 小時
- 30 天內合併 PR
- 53
環境準備
這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
OpenMathLib/OpenBLAS 的其他 Issue
-
難度 5/5 一週以上 新手友好度 25/100
OpenMathLib/OpenBLAS#6119 · 2 則留言 ·
維護者通常 1 天內回覆
-
openblas_set_threads_callback_function is a silent no-op on Windows可能已有人在做 @martin-frbg 於 5 天前認領。 未關閉
難度 4/5 3-5 天 新手友好度 43/100
OpenMathLib/OpenBLAS#6108 · 2 則留言 · 1 個 reaction ·
維護者通常 1 天內回覆
-
難度 4/5 3-5 天 新手友好度 43/100
OpenMathLib/OpenBLAS#6107 · 3 則留言 ·
維護者通常 1 天內回覆
-
難度 4/5 3-5 天 新手友好度 45/100
OpenMathLib/OpenBLAS#6104 ·
維護者通常 1 天內回覆
-
難度 4/5 3-5 天 新手友好度 58/100
OpenMathLib/OpenBLAS#6103 ·
維護者通常 1 天內回覆
查看 OpenMathLib/OpenBLAS 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 62/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 62/100
-
area:gates bug good first issue
難度 1/5 1 小時以內 新手友好度 85/100
InauguralSystems/EigenScript#1782 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 72/100
intel/intel-device-plugins-for-kubernetes#2384 ·
維護者通常 1 天內回覆
-
難度 1/5 1 小時以內 新手友好度 88/100
zephyrproject-rtos/zephyr#122261 ·
維護者通常 3 天內回覆