Repository navigation
Closed
Description
Hi,
Following issue 2693 [https://github.com//pull/2693] by @EGuesnet, once fixed by our patch , we have found another issue when tests are run during build phase, still with Power8/32bit, thus using the Power8 assembler code.
+ make BINARY=32 TARGET=POWER8
...
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 ./sblat3 < ./sblat3.dat
******* FATAL ERROR - PARAMETER NUMBER 2 WAS CHANGED INCORRECTLY *******
******* FATAL ERROR - PARAMETER NUMBER 3 WAS CHANGED INCORRECTLY *******
******* FATAL ERROR - PARAMETER NUMBER 4 WAS CHANGED INCORRECTLY *******
******* FATAL ERROR - PARAMETER NUMBER 5 WAS CHANGED INCORRECTLY *******
******* FATAL ERROR - PARAMETER NUMBER 6 WAS CHANGED INCORRECTLY *******
******* FATAL ERROR - PARAMETER NUMBER 9 WAS CHANGED INCORRECTLY *******
******* STRMM FAILED ON CALL NUMBER:
506: STRMM ('L','U','N','U', 1, 1, 1.0, A, 2, B, 2) .
Program received signal SIGSEGV: Segmentation fault - invalid memory reference.
C and fortran codes were built with the following options:
gcc -maix32 -D_LARGE_FILES -Ofast -mcpu=power8 -mtune=power8 -mvsx -malign-power -DUSE_OPENMP -fno-fast-math \
-fopenmp -DMAX_STACK_ALLOC=2048 -Wall -DF_INTERFACE_GFORT -fPIC -DNO_AVX512 -DSMP_SERVER -DNO_WARMUP \
-DMAX_CPU_NUMBER=2 -DMAX_PARALLEL_NUMBER=1 -DVERSION="0.3.10" -Wa,-a32 -UASMNAME -UASMFNAME -UNAME \
-UCNAME -UCHAR_NAME -UCHAR_CNAME -DASMNAME= -DASMFNAME=_ -DNAME=_ -DCNAME= -DCHAR_NAME="_" \
-DCHAR_CNAME="" -DNO_AFFINITY -I. -DHAVE_LAPACK_CONFIG_H -I../include -c -o lapacke_ztr_nancheck.o \
lapacke_ztr_nancheck.c
gfortran -maix32 -Ofast -mcpu=power8 -mtune=power8 -mvsx -malign-power -DUSE_OPENMP -fno-fast-math -fopenmp \
-Wall -frecursive -fno-optimize-sibling-calls -fopenmp -O2 -frecursive -mcpu=power8 -mtune=power8 -malign-power \
-DUSE_OPENMP -fno-fast-math -fopenmp -fno-optimize-sibling-calls -Wl,-blibpath:/opt/freeware/lib:/usr/lib:/lib \
-Wl,-bmaxdata:0x80000000 -o zblat3 zblat3.o ../libopenblas_power8p-r0.3.10.a -lm -lpthread -lgfortran -lm -lpthread \
-lgfortran -L/opt/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/8 -L/opt/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/8/../../.. \
-L/opt/freeware/lib -lc /opt/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/8/libgcc.a /opt/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/8/libgcc_eh.a \
/opt/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/8/libgcc.a /opt/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/8/libgcc_eh.a
gdb and dbx say nothing very useful.
Since it is written in assembler, that may be very difficult to debug, and our 2 assembler experts are out and will be back next week only.
For now, we have no idea about the root cause. We need help, probably from the Power assembler expert who wrote this code.
Metadata
Metadata
Assignees
Labels
No labels
Activity
martin-frbg commentedon Jun 30, 2020
Unfortunately wernsaar has not been active here (nor responding to messages) since early 2017, and I learned just about the bare minimum ppc assembly needed to fix the obvious omissions in his code as they were pointed out. Perhaps @kavanabhat can help ? (@quickwritereader would be our semi-"resident" expert for ppc but I believe is not that familiar with AIX or coding for big-endian in general. Actually endianness could be the problem here - but perhaps gdb can be coaxed into reporting the actual assembly instruction on which it crashes )
brada4 commentedon Jun 30, 2020
what do you see in gdb or dbx repeating the failing test command?
also worth using assembly-free GENERIC target, because POWER8 assembly was unlikely on PPC604e or whatever was the latest 32bit PPC running AIX
trex58 commentedon Jul 1, 2020
Since we worked to work-around this for being able to generate RPM files, I had to rebuild it all without the work-around, and then original above issue has disappeared and has been replaced, still in the same test, by:
32bit/power8/test/sblat3.f :
32bit/power8/test/SBLAT3.SUMM :
32bit/power8/test/sblat3.dat:
So, that looks random. Damned!
Nuts !!! The last time I wrote Fortran code, it was maybe in 1983, or sure in 1981 (6 months). Fortran 77... ;-) I need a refresh.
trex58 commentedon Jul 1, 2020
Hummm. Since that works fine for Power8/64bit, I'm not sure it is Endianess.
I do not remember exactly the output of gdb and dbx. Probably nothing for gdb, and 3 lines for dbx with a fortran routine at the top.
trex58 commentedon Jul 1, 2020
Hummm So, maybe this 32bit assembler code had never been tested.
We are using "using assembly-free GENERIC target" as a work-around. Not very fast, but that works fine in 32bit too.
We need openblas in 32bit because we have numpy in 64bit and 32 because we have Boost.Python and Boost in both 64bit and 32bit because AIX manages both 64 & 32bit.
Anyway, we have a work-around.
I'll experiment reproducing the build & test and see if it is stable or not.
martin-frbg commentedon Jul 1, 2020
I see nothing wrong with the format line labeled 9994, probably something is scribbling over parts of the stack
trex58 commentedon Jul 1, 2020
Thanks for providing your expertise.
Hummmm I gonna relaunch the test, and then rebuild, and see if I get a third result (random...) or if it stabilizes.
Random issues are always a pain...
trex58 commentedon Jul 1, 2020
The problem may be not stable, since it now shows the first issue, but with no core:
SBLAT3.SUMM:
martin-frbg commentedon Jul 1, 2020
gdb keeps acting up for me, single-stepping through sblat3 is extremely slow with lots of "internal error ... in read in psymtab but not in symtab" warnings. valgrind does not appear to be installed on the (gcc compile farm) machine
trex58 commentedon Jul 7, 2020
When rebuilding all (libopenblas_power5p-r0.3.10.a) after complete clean, by scripts, with -O0 -g, or -O1 -g, or -O2 -g, there is no more bug.
Before, it was built with -Ofast and sometimes with -O2 .
Rebuilding all with -Ofast -g, or with -Ofast, still with scripts, does not produce the issue!
cd test
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 ./sblat3 < ./sblat3.dat
SBLAT3.SUMM when it's OK:
Rebuilding all from scratch from running rpmbuild on the .spec file does recreate the issue:
Relaunching the test by hand leads to a different error message, with no core, as described at beginning of this issue:
and now the SBLAT3.SUMM file is no more empty and contains what has already been described above:
????
martin-frbg commentedon Jul 7, 2020
First rebuild was probably without setting TARGET, leading to an all-C power5 build (as I have not completed and merged my PR yet), spec file probably specifies TARGET=POWER8 ? (Had no luck with gdb so far - building with
-fsanitize=address -fsanitize=undefined(on 64bit) turns up several complaints about misaligned arguments in loads and stores of vector floats though none of them in level3 BLAS)trex58 commentedon Jul 7, 2020
Yes. I forgot this. Now using BINARY and TARGET. Not perfectly awaken this morning...
Now using:
gdb is still KO.
Which is not exactly what I got from the total rebuild from .spec file:
trex58 commentedon Jul 7, 2020
By the way, the number of cores to be used on AIX is not computed by OpenBlas, thus leading to NUM_CORES=2 .
The attached patch does make use of the real number of cores of the AIX VM. Thus speeding a lot the build.
openblas-0.3.10-AIX-NUM_CORES.patch.txt
martin-frbg commentedon Jul 7, 2020
Need to add DEBUG=1 (or
-gin yourCC) to get (any chance of) detailed information from inside sblat3. (Did not help when I tried though, and setting a breakpoint at MAIN__ and single-stepping from there proved to be extremely time-consuming (to the point where my ssh to the other side of the world would die before I got to anything useful)martin-frbg commentedon Jul 7, 2020
Is there an advantage to using SC_NPROCESSORS_ONLN rather than _CONF ? (Which is what is used on Linux - changed that some years ago to improve ARM support where additional processors may wake up on demand)
trex58 commentedon Jul 7, 2020
The man of sysconf on both AIX and Fedora say:
AIX : _SC_NPROCESSORS_ONLN Number of processors online.
Fedora: - _SC_NPROCESSORS_ONLN The number of processors currently online (available).
I guess that _SC_NPROCESSORS_CONF is what was set at start of the VM and that the number of processors may have been dynamically changed. Thus _SC_NPROCESSORS_ONLN should show what is available at the time of the call, I think.
martin-frbg commentedon Jul 7, 2020
Just asking as we used to see the opposite effect (on armv8 however), where ONLN would show less than actually available (the others taking a nap unless some other compute-intensive task had just finished). But no problem with adding a separate code path for AIX instead of adding it to the
if Linux or Sunblock already there.trex58 commentedon Jul 8, 2020
On AIX, the number of CPUs available for a VM is far more complicated than on Linux. The number of CPUs for a VM can be set fixed all along the life of the VM (capped). Or it can be uncapped, with a minimum N1 and a maximum N2: thus, if the total M processors of the machine (CEC) are not used by the other (AIX or Linux) VMs, if the workload is very high on the VM, some m processors from (M-N2) can be dynamically added to N. And I'm not sure I'm describing this fully correctly.
martin-frbg commentedon Jul 8, 2020
returning tp the original topic, what is a bit suspicious to me is that the Power8 GEMM kernels have a surprisingly tiny STACKSIZE defined in 32-bit mode (400 bytes compared to 34k), exploring that now
trex58 commentedon Jul 8, 2020
About this issue, after testing with the appropriate options, it looks like there are issues with GCC and gdb, in 32bit only and Power8.
We have to clarify this.
trex58 commentedon Jul 8, 2020
What is "Power8 GEMM kernel" ?
Looking at my environment, we are using:
Moreover, by default on AIX, there are limitations to several sizes, including the "stack size". By means of: ulimit ...
Extending "max memory size", "stack size", and 'data seg size" did not fixed the issue.
Nothing better with: export AIXTHREAD_STK=400000 too .
martin-frbg commentedon Jul 8, 2020
From kernel/power/KERNEL.POWER8 :
SGEMMKERNEL= sgemm_kernel_16x8_power8.Swhich has(but blindly increasing the STACKSIZE value does not have the desired effect )
martin-frbg commentedon Jul 14, 2020
The problem appears to affect the GEMM/TRMM kernels as well as DTRSM. So far #2682 only automates the choice of POWER6 kernels when TARGET=POWER8 was specified for a 32 bit build (but this does not work for autodetection, kind of a chicken-and-egg problem there). A somewhat more flexible workaround would leave the build system unchanged but add a big messy
ifdef big-endian and 32bitin KERNEL.POWER8 to replace the affected kernels with their POWER6 equivalents (with a corresponding 32bit-section using POWER6 GEMM_UNROLL values in param.h). Still no clue on the actual overflow or other coding issue behind all this though - can you estimate how prevalent 32bit POWER8 is (i.e. how important getting full performance on that platform would be) ?