CBLAS complex non-absolute index extensions depend on stride-hole elements
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
研究方向
Read interface/imax.c, especially the non-absolute path selecting ISMAX_K/ISMIN_K and IDMAX_K/IDMIN_K, then trace how the complex CBLAS wrapper passes incx. Use the provided Linux reproducer with an LP64 library and 32-bit BLAS integers; done means the four functions' results no longer depend on stride-hole values, without changing the separate absolute-extrema path. The intended general complex ordering remains unresolved.
由索引模型根據 Issue 內容生成。
描述
cblas_icmax, cblas_icmin, cblas_izmax, and cblas_izmin return different
indexes when only the unused elements between the specified complex inputs
are changed.
With n=4 and incx=2 (interpreted in complex elements), the logical inputs
are elements 0, 2, 4, and 6: [1+0i, 2+0i, 3+0i, 4+0i]. The baseline fills
holes 1, 3, and 5 with zero; the second array fills those holes with
[100+0i, -100+0i, 50+0i]. The logical inputs are bit-for-bit identical.
The central problem is dependence on stride-hole memory. Under the usual
real-axis ordering the expected zero-based max/min indexes are 3/0, but the
input-invariance failure does not require choosing a general ordering for
complex numbers. These are the non-absolute index extensions, not
cblas_icamax or cblas_izamax.
Observed output
The unchanged reproducer below prints this on the independently checked
0.3.21 binary:
REPRO: cblas_icmax expected=3 baseline=2 changed_holes=1
REPRO: cblas_icmin expected=0 baseline=1 changed_holes=3
REPRO: cblas_izmax expected=3 baseline=2 changed_holes=1
REPRO: cblas_izmin expected=0 baseline=1 changed_holes=3
SUMMARY: BUG reproduced=4/4
The independently checked 0.3.30 binary gives the same numeric results, with
scipy_ prefixed symbol names.
Source diagnosis
In interface/imax.c at v0.3.34,
the non-absolute path selects the real ISMAX_K / ISMIN_K or
IDMAX_K / IDMIN_K kernel, even when COMPLEX is defined. The CBLAS wrapper
casts to FLOAT * and passes incx without converting complex-element stride
to scalar stride. That explains this witness: for scalar step 2 it sees
[1, 0, 2, 0] or [1, 100, 2, -100], rather than the four logical inputs.
A fix needs to address the complex-to-scalar stride conversion without
changing the separate absolute-extrema path. Simply doubling the stride is
a candidate direction for this real-axis witness, not a demonstrated complete
fix or a definition of the extensions' general complex ordering. Please
clarify the intended contract if these exported extensions are meant to use a
different stride or comparison convention.
Runtime evidence and source scope
An independent x86-64 Linux check reproduced the result in both of these
existing bundled libraries, using GCC 14.2.0 and OPENBLAS_NUM_THREADS=1:
| Library | openblas_get_config() |
Reproduction |
|---|---|---|
CasADi-bundled libcasadi-tp-openblas.so |
OpenBLAS 0.3.21 NO_AFFINITY CORE2 MAX_THREADS=16 |
Four of four exports |
SciPy-bundled libscipy_openblas-6cdc3b4a.so |
OpenBLAS 0.3.30 DYNAMIC_ARCH NO_AFFINITY SkylakeX MAX_THREADS=64 |
Four of four exports; only the lookup names were changed to add scipy_ |
These are configuration strings from particular distributed binaries, not
claims about every build of those releases. The original investigation also
reported the same result in AArch64 builds of v0.3.34 (e0166008be8e466242aa76b2ff75ce3f0fbf574a) and
31e82fa8c509e6f0d96288de3c20d8916d894e72. Those AArch64 runs were not independently repeated in the x86-64
check; the physical runner/operating-system details are not inferred here.
The relevant source was inspected at v0.3.34 and 31e82fa8c509e6f0d96288de3c20d8916d894e72. At the time of
review, develop was 277ef7801416412ee970873701fdf14d603d2c3f; its intervening WASM packing commit does not
change these interface files. The current-head statement is a source check,
not a claim of running a binary built from that commit.
Reproduce on Linux
Use an LP64 OpenBLAS shared library with 32-bit BLAS integers and unprefixed
symbols, compiled for the same architecture as the test. Do not use this
hard-coded int call interface against an ILP64 / INTERFACE64=1 library.
cc -O2 -Wall -Wextra -Werror -o repro repro.c -ldl
OPENBLAS_NUM_THREADS=1 ./repro /absolute/path/to/libopenblas.so
Exit 0 means all four bug witnesses were reproduced. Exit 1 means incomplete
reproduction, not proof of correctness; exit 2 means a detected setup error.
No register-poisoning harness is needed for this direct-call reproducer.
Complete repro.c
/* Fixed-array reproduction for the non-absolute complex index extensions.
* Only complex elements 0, 2, 4 and 6 belong to the input with incx=2. */
#include <dlfcn.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
typedef size_t (*index_fn)(int, const void *, int);
static size_t check(void *lib, const char *name, const void *baseline,
const void *changed_holes, size_t expected) {
index_fn fn = (index_fn)dlsym(lib, name);
if (!fn) { fprintf(stderr, "missing %s\n", name); exit(2); }
size_t first = fn(4, baseline, 2);
size_t second = fn(4, changed_holes, 2);
printf("REPRO: %s expected=%zu baseline=%zu changed_holes=%zu\n",
name, expected, first, second);
return first != second && second != expected;
}
int main(int argc, char **argv) {
if (argc != 2) { fprintf(stderr, "usage: repro LIBRARY\n"); return 2; }
void *lib = dlopen(argv[1], RTLD_NOW | RTLD_LOCAL);
if (!lib) { fprintf(stderr, "dlopen: %s\n", dlerror()); return 2; }
/* Seven complex elements, stored as interleaved real/imaginary scalars.
* The four logical inputs (elements 0, 2, 4, 6) are identical; only
* the three unused stride holes differ between the two arrays. */
const float cf_base[] = {1,0, 0,0, 2,0, 0,0, 3,0, 0,0, 4,0};
const float cf_holes[] = {1,0, 100,0, 2,0, -100,0, 3,0, 50,0, 4,0};
const double zd_base[] = {1,0, 0,0, 2,0, 0,0, 3,0, 0,0, 4,0};
const double zd_holes[] = {1,0, 100,0, 2,0, -100,0, 3,0, 50,0, 4,0};
size_t bugs = 0;
bugs += check(lib, "cblas_icmax", cf_base, cf_holes, 3);
bugs += check(lib, "cblas_icmin", cf_base, cf_holes, 0);
bugs += check(lib, "cblas_izmax", zd_base, zd_holes, 3);
bugs += check(lib, "cblas_izmin", zd_base, zd_holes, 0);
printf("SUMMARY: %s reproduced=%zu/4\n", bugs == 4 ? "BUG" : "INCOMPLETE", bugs);
dlclose(lib);
return bugs == 4 ? 0 : 1;
}
- 主要語言
- C
- 星號
- 7.6k
- 分支
- 1.7k
- 平均合併
- 1 天 17 小時
- 30 天內合併 PR
- 47
環境準備
這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
OpenMathLib/OpenBLAS 的其他 Issue
-
難度 5/5 一週以上 新手友好度 25/100
OpenMathLib/OpenBLAS#6152 ·
維護者通常 1 天內回覆
-
難度 5/5 一週以上 新手友好度 28/100
OpenMathLib/OpenBLAS#6151 · 2 則留言 ·
維護者通常 1 天內回覆
-
VORTEXM4: s2_usable() runs RDSVL before the SME2 check (SIGILL without SME)可能已有人在做 @tesch1 於 4 天前認領。 未關閉
難度 3/5 1-2 天 新手友好度 25/100
OpenMathLib/OpenBLAS#6150 ·
維護者通常 1 天內回覆
-
難度 5/5 一週以上 新手友好度 35/100
OpenMathLib/OpenBLAS#6149 ·
維護者通常 1 天內回覆
-
難度 4/5 3-5 天 新手友好度 43/100
OpenMathLib/OpenBLAS#6148 ·
維護者通常 1 天內回覆
查看 OpenMathLib/OpenBLAS 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 78/100
HexaCluster/credcheck#86 ·
-
bug
難度 2/5 1-3 小時 新手友好度 74/100
AOMediaCodec/SVT-AV1#3320 ·
-
difficulty: easy
難度 2/5 1-3 小時 新手友好度 64/100
-
難度 2/5 1-3 小時 新手友好度 78/100
open-quantum-safe/liboqs#2647 ·
維護者通常 1 天內回覆
-
難度 1/5 1 小時以內 新手友好度 85/100
維護者通常 1 天內回覆