CBLAS complex non-absolute index extensions depend on stride-hole elements
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 43/100
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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;
}
- Lenguaje dominante
- C
- Estrellas
- 7.6k
- Forks
- 1.7k
- Merge medio
- 1 d 11 h
- PR fusionados (30 d)
- 53
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de OpenMathLib/OpenBLAS
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
OpenMathLib/OpenBLAS#6119 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
openblas_set_threads_callback_function is a silent no-op on WindowsPosiblemente ocupada @martin-frbg la tomó hace 5 días. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 43/100
OpenMathLib/OpenBLAS#6108 · 2 comentarios · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
OpenMathLib/OpenBLAS#6104 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 58/100
OpenMathLib/OpenBLAS#6103 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 52/100
OpenMathLib/OpenBLAS#6102 ·
Los mantenedores suelen responder en 1 día
Todos los issues de OpenMathLib/OpenBLAS
Issues similares
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 82/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
FStarLang/karamel#784 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
DaveGamble/cJSON#1100 ·
-
UB: (int) cast of a user double outside int range in dispatch / vm_index_is_int / flat_index_atAbiertoarea:runtime-vm
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
InauguralSystems/EigenScript#1748 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
leanprover/lean4#15677 ·
Los mantenedores suelen responder en 1 día