You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
Between v0.3.7 and v0.3.8, a change was done in file kernel/Makefile.L3 , and thus building v0.3.8 breaks in my AIX 7.2 environment though building v0.3.7 builds/tests OK.
The following lines were added in line 529 of Makefile.L3 :
This option requires the C compiler (gcc here) to run the C Preprocessor only. Thus the generated file cgemm_itcopy.s is kind of C source code but not assembler.
I guess that the correct option to use is: -S .
Changing -E by -S in all places (all for AIX) does fix the issue. OpenBlas 0.3.8 now builds... up to some other error I have to study.
Weird, the relevant change is from #2338 and according to #1997 earlier versions of OpenBLAS would not have been expected to build on AIX. Having -S here instead of -E does make sense, perhaps the branch used for the PR was a prettied-up (but not tested again) version of the actual work ? (Somehow interconverting the occurences of -S and -E perhaps ?)
Hi Martin,
I'm now studying the code in order to understand what it is aimed to do.
About -E , I now understand that it is used to replace some macro in the ./kernel/generic/zgemm_tcopy_2.c C file.
So, my first comment seems to be wrong.
However, the file which is generated (cgemm_itcopy.s) is named .s though it is C code (?!).
Then, m4 is used as a macro-processor and there are some few changes between cgemm_itcopy.s and cgemm_itcopy_nomacros.s (see details below).
And then, gcc is called on cgemm_itcopy_nomacros.s in order to generate cgemm_itcopy.o .
However, GCC (v8.4) - based on the suffix .s of cgemm_itcopy_nomacros.s - thinks that it is an assembler code. Thus it tries to compile it as an assembler code, and says:
cgemm_itcopy_nomacros.s: line 12: invalid opcode or pseudo-op
cgemm_itcopy_nomacros.s: line 12: Error In Syntax
on the line:
12: typedef __builtin_va_list __gnuc_va_list;
which clearly is C code.
Renaming cgemm_itcopy_nomacros.s as cgemm_itcopy_nomacros.c does fix this issue.
However, then, it breaks at:
In file included from ../common.h:83,
from ../kernel/power/../generic/zgemm_tcopy_2.c:40:
/home2/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/8/include-fixed/stdlib.h:538:13: error: two or more data types in declaration specifiers
extern int mkstemp(char *);
^~~~
/home2/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/8/include-fixed/stdlib.h:538:19: error: expected identifier or '(' before '-' token
extern int mkstemp(char *);
^
In file included from ../common.h:84,
from ../kernel/power/../generic/zgemm_tcopy_2.c:40:
/home2/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/8/include-fixed/string.h:345:22: error: expected identifier or '(' before '-' token
extern char *index(const char *, int);
^
So, probably that this code was correctly built with GCC v6 but breaks with GCC v8.4 ?!
I'll try to find a machine with GCC v6 installed in order to check.
Moreover, it seems that there are optimizations that may depend on the kind of processor.
I'm now using a Power8 VM.
Details about the difference between cgemm_itcopy.s and cgemm_itcopy_nomacros.s :
This looks more like a bug in your GCC installation or include paths to me - types.h not matching the expectations of stdlib.h or something like that, or your m4 is misbehaving.
Yes. Probably that something has changed.
Before I lost Internet for 1/2h, I was able to check that removing the m4 step for this file does fix the issue, for the case cgemm_itcopy.
Investigating. I'll check on a GCC v6 machine.
Could you try to produce m4 output with AIX m4 (something old shipped with their sendmail) and GNU m4 from linux toolbox, then run diff between files. Please help with the diff output (make it *.txt, edit out private paths if any) uploaded.
It might be that there is something tested only with GNU m4 ever and not so POSIX for POSIX tools to handle.
I know very very few about how openblas is built. Anyway, after some experiment, I think that things have been done for AIX that are not required for my AIX environment.
It seems to me that the kernel/Makefile.L3 of v0.3.8 is used for building on AIX.
Looking at it, many lines like:
I'm using a Power8 VM, but, for compatibility with older machines for our customers, it was compiled with TARGET=POWER6 . Though changes done within: #2338 clearly have been done for POWER8.
By simply replacing "AIX" by "AIX-POWER8" (which does not exist) everywhere in kernel/Makefile.L3 , the else part of "ifeq ($(OS), AIX)" is executed, and everything works perfectly, till the tests, which are all PASSED.
However, then, changing the .spec file : make BINARY=64 TARGET=POWER8 , WITHOUT changing AIX by AIX-POWER8, does not succeed: I still have the code breaking at:
So, maybe that there are more options to be set before building, starting with version 0.3.8 ?
Reading README.md, I see some other options, like: HOSTCC= , CC= , FC= , DEBUG=1 , USE_MASS=1 .
The IBM MASS accelerator seems available only for PPC LittleEndian VM. AIX is BigEndian.
More about Power:
#### PPC/PPC64
- **POWER8**: Optimized BLAS, only for PPC64LE (Little Endian), only with `USE_OPENMP=1`
- **POWER9**: Optimized Level-3 BLAS (real) and some Level-1,2. PPC64LE with OpenMP only.
### Supported OS:
- **AIX**: Supported on PPC up to POWER8
So, my expectation was that the lines in kernel/Makefile.L3 were added for AIX & POWER8 only, breaking building for POWER6. But that still break when TARGET=POWER8 .
I have requested an account on the gcc compile farm to be able to debug such issues in the future.
Right now I can only guess what makes "your" AIX different from kavanabhat's installation (where I trust these additions in Makefile.L3 will have worked). Given the nature of the changes, it seems likely that they are/were required to work around limitations in some native AIX assembler rather than GNU as that you are probably using.
As an aside, for "historical" reasons the README.md only lists cpu models that are supported in
addition to those known to the original GotoBLAS
I'll discuss of this with IBM people, ayappanec, this afternoon. Maybe I am not launching the build correctly. However, looking at their last version of the .spec file, for OpenBlas v0.3.6, they seem to do the same I do, but for power8 and for power6. So, they may not be aware of these more recent changes that appeared in v0.3.8 .
I am using AIX 7.2 , GCC 8.4 , a VM using Power8 HW.
Last Minute: When experimenting with POWER8 target, I forgot to remove the patch changing -E by -S , which is wrong when compiling with POWER 8. It's building now. If OK, that means that the changes made for Power8, and named as "ifeq ($(OS), AIX)" are not compatible when building with Power6. So the test should be more detailed: "if OS==AIX and TARGET>=POWER8", something like this.
Yes. The build with TARGET=POWER8 and without my wrong previous patch -E --> -S goes further, close to running the tests (Updated: all OK). So, I think that the addition of new stuff for POWER8 for AIX , appearing with version 0.3.8, did break building with TARGET=POWER6 for AIX. The test if OS=AIX must be improved to not apply when TARGET=POWER6 .
Thx! I do not master this syntax.
I'll experiment right now.
Moreover, I'll use a .spec file which builds for both TARGET=POWER6 and 8 . So that we'll know.
However, if I reuse this script and replace ../kernel/power/sgemm_tcopy_8_power8.S by ../kernel/power/gemm_tcopy_4.S , that works !!
So, there is something different in these 2 files, which make compiling first one breaks and compiling second one compile OK.
Looking at the assembler generated, I see line "define(`COPY_4x8...":
@kavanabhat how about the assembler - I assume now GNU as is required ?
(Apart from that, my tests now suggest that it is not strlctly necessary to replace the CC -E by CC -S plus redirection of the output - it must have been primarily the unwanted application of that call on POWER6 that created the initial confusion, coupled with the build quietly misdetecting POWER8 hardware as POWER5 when no TARGET is supplied.)
AIX native shared objects are archives of shared objects. The normal archive file, contains a shared object (shr.o or libopenblas.1.so) or whatever. AIX linker has a mode to look for bare shared objects, but that can introduce other problems.
The Makefile rules that create ".c" or ".s" pre-processed file are explicit. It seems like a bug / typo that ".s" was chosen. One can change the (AIX-specific) rule to use the correct suffixes.
AIX m4 (and solaris amd64 gives impression it comes from POSIX) requires extending one of three buffers to process bigger macros, just that it is less bug reports if it builds perfectly using "standard" tools, no matter how old that standard is.
Activity
trex58 commentedon Jun 16, 2020
The second issue appears within:
still in code of kernel/Makefile.L3 (version 0.3.10) :
martin-frbg commentedon Jun 16, 2020
Weird, the relevant change is from #2338 and according to #1997 earlier versions of OpenBLAS would not have been expected to build on AIX. Having -S here instead of -E does make sense, perhaps the branch used for the PR was a prettied-up (but not tested again) version of the actual work ? (Somehow interconverting the occurences of -S and -E perhaps ?)
trex58 commentedon Jun 16, 2020
I don't know. 8:30PM here. Will see tomorrow about the 2nd issue. The patch I've attached previously is not the final one.
trex58 commentedon Jun 17, 2020
Hi Martin,
I'm now studying the code in order to understand what it is aimed to do.
About -E , I now understand that it is used to replace some macro in the ./kernel/generic/zgemm_tcopy_2.c C file.
So, my first comment seems to be wrong.
However, the file which is generated (cgemm_itcopy.s) is named .s though it is C code (?!).
Then, m4 is used as a macro-processor and there are some few changes between cgemm_itcopy.s and cgemm_itcopy_nomacros.s (see details below).
And then, gcc is called on cgemm_itcopy_nomacros.s in order to generate cgemm_itcopy.o .
Summary:
However, GCC (v8.4) - based on the suffix .s of cgemm_itcopy_nomacros.s - thinks that it is an assembler code. Thus it tries to compile it as an assembler code, and says:
on the line:
which clearly is C code.
Renaming cgemm_itcopy_nomacros.s as cgemm_itcopy_nomacros.c does fix this issue.
However, then, it breaks at:
So, probably that this code was correctly built with GCC v6 but breaks with GCC v8.4 ?!
I'll try to find a machine with GCC v6 installed in order to check.
Moreover, it seems that there are optimizations that may depend on the kind of processor.
I'm now using a Power8 VM.
Details about the difference between cgemm_itcopy.s and cgemm_itcopy_nomacros.s :
martin-frbg commentedon Jun 17, 2020
This looks more like a bug in your GCC installation or include paths to me - types.h not matching the expectations of stdlib.h or something like that, or your m4 is misbehaving.
trex58 commentedon Jun 17, 2020
Yes. Probably that something has changed.
Before I lost Internet for 1/2h, I was able to check that removing the m4 step for this file does fix the issue, for the case cgemm_itcopy.
Investigating. I'll check on a GCC v6 machine.
trex58 commentedon Jun 17, 2020
No. I have the same behavior with GCC 6.3 on AIX 6.1 :
martin-frbg commentedon Jun 17, 2020
Does it work when you rename the .s to .c again (or add
-x cto the gcc options) ? I.e., is the error introduced by m4 present there as well ?brada4 commentedon Jun 17, 2020
Could you try to produce m4 output with AIX m4 (something old shipped with their sendmail) and GNU m4 from linux toolbox, then run diff between files. Please help with the diff output (make it *.txt, edit out private paths if any) uploaded.
It might be that there is something tested only with GNU m4 ever and not so POSIX for POSIX tools to handle.
trex58 commentedon Jun 18, 2020
I know very very few about how openblas is built. Anyway, after some experiment, I think that things have been done for AIX that are not required for my AIX environment.
It seems to me that the kernel/Makefile.L3 of v0.3.8 is used for building on AIX.
Looking at it, many lines like:
appear in kernel/Makefile.L3 . They were added for Power8 I think.
The .spec file I'm using comes from IBM. It defines:
I'm using a Power8 VM, but, for compatibility with older machines for our customers, it was compiled with TARGET=POWER6 . Though changes done within: #2338 clearly have been done for POWER8.
By simply replacing "AIX" by "AIX-POWER8" (which does not exist) everywhere in kernel/Makefile.L3 , the else part of "ifeq ($(OS), AIX)" is executed, and everything works perfectly, till the tests, which are all PASSED.
However, then, changing the .spec file : make BINARY=64 TARGET=POWER8 , WITHOUT changing AIX by AIX-POWER8, does not succeed: I still have the code breaking at:
So, maybe that there are more options to be set before building, starting with version 0.3.8 ?
Reading README.md, I see some other options, like: HOSTCC= , CC= , FC= , DEBUG=1 , USE_MASS=1 .
The IBM MASS accelerator seems available only for PPC LittleEndian VM. AIX is BigEndian.
More about Power:
However, looking at kernel/power, there are :
so the README.md file needs some update.
So, my expectation was that the lines in kernel/Makefile.L3 were added for AIX & POWER8 only, breaking building for POWER6. But that still break when TARGET=POWER8 .
martin-frbg commentedon Jun 18, 2020
I have requested an account on the gcc compile farm to be able to debug such issues in the future.
Right now I can only guess what makes "your" AIX different from kavanabhat's installation (where I trust these additions in Makefile.L3 will have worked). Given the nature of the changes, it seems likely that they are/were required to work around limitations in some native AIX assembler rather than GNU as that you are probably using.
As an aside, for "historical" reasons the README.md only lists cpu models that are supported in
addition to those known to the original GotoBLAS
trex58 commentedon Jun 18, 2020
I'll discuss of this with IBM people, ayappanec, this afternoon. Maybe I am not launching the build correctly. However, looking at their last version of the .spec file, for OpenBlas v0.3.6, they seem to do the same I do, but for power8 and for power6. So, they may not be aware of these more recent changes that appeared in v0.3.8 .
I am using AIX 7.2 , GCC 8.4 , a VM using Power8 HW.
Last Minute: When experimenting with POWER8 target, I forgot to remove the patch changing -E by -S , which is wrong when compiling with POWER 8. It's building now. If OK, that means that the changes made for Power8, and named as "ifeq ($(OS), AIX)" are not compatible when building with Power6. So the test should be more detailed: "if OS==AIX and TARGET>=POWER8", something like this.
trex58 commentedon Jun 18, 2020
Yes. The build with TARGET=POWER8 and without my wrong previous patch -E --> -S goes further, close to running the tests (Updated: all OK). So, I think that the addition of new stuff for POWER8 for AIX , appearing with version 0.3.8, did break building with TARGET=POWER6 for AIX. The test if OS=AIX must be improved to not apply when TARGET=POWER6 .
martin-frbg commentedon Jun 18, 2020
Probably something like (untested)
instead of the
ifeq($(OS),AIX)trex58 commentedon Jun 18, 2020
Thx! I do not master this syntax.
I'll experiment right now.
Moreover, I'll use a .spec file which builds for both TARGET=POWER6 and 8 . So that we'll know.
26 remaining items
kavanabhat commentedon Jun 22, 2020
GNU m4 is being invoked.
trex58 commentedon Jun 22, 2020
I'm quite lost with what should be done...
On my side, I just can show what happens in my environment (AIX 7.2, GCC 8.4):
File ../kernel/power/sgemm_tcopy_8_power8.S is made of #define and #include and of assembler code.
File : ./kernel/power/gemm_tcopy_4.S is made of some #define and of assembler code.
If I replace the lines:
by:
That breaks as:
However, if I reuse this script and replace ../kernel/power/sgemm_tcopy_8_power8.S by ../kernel/power/gemm_tcopy_4.S , that works !!
So, there is something different in these 2 files, which make compiling first one breaks and compiling second one compile OK.
Looking at the assembler generated, I see line "define(`COPY_4x8...":
is not accepted.
Original code:
So, I'm not an expert of assembler, but it really seems that, on AIX, using m4 is required in case of this Power8-specific file.
kavanabhat commentedon Jun 22, 2020
@trex58, please use the below patch and let me know if you are able to compile for both power6 and power8. Ensure GNU m4 command is invoked.
https://github.com/xianyi/OpenBLAS/files/4809319/openblas-0.3.8-AIX-patch.txt
martin-frbg commentedon Jun 22, 2020
@kavanabhat how about the assembler - I assume now GNU
asis required ?(Apart from that, my tests now suggest that it is not strlctly necessary to replace the CC -E by CC -S plus redirection of the output - it must have been primarily the unwanted application of that call on POWER6 that created the initial confusion, coupled with the build quietly misdetecting POWER8 hardware as POWER5 when no TARGET is supplied.)
trex58 commentedon Jun 22, 2020
I'm in several meeting calls this afternoon. Will go back later.
martin-frbg commentedon Jun 22, 2020
Another question for those familiar with AIX - is this statement (from #1803 (comment)) correct at all ?
edelsohn commentedon Jun 22, 2020
AIX native shared objects are archives of shared objects. The normal archive file, contains a shared object (shr.o or libopenblas.1.so) or whatever. AIX linker has a mode to look for bare shared objects, but that can introduce other problems.
edelsohn commentedon Jun 22, 2020
GNU Assembler does not work on AIX. It is not required.
One can use .S CPP-preprocessed assembly language.
AIX assembler does not understand register with letter prefixes, like v0, fr0. Only numbers.
edelsohn commentedon Jun 22, 2020
@trex58 It's not OpenBLAS job to debug AIX assembler.
edelsohn commentedon Jun 23, 2020
The Makefile rules that create ".c" or ".s" pre-processed file are explicit. It seems like a bug / typo that ".s" was chosen. One can change the (AIX-specific) rule to use the correct suffixes.
The assembly file definitely is relying upon m4 (possibly requiring GNU m4) and requires that pre-processing step.
Torbjorn Granlund uses m4 to pre-process PowerPC assembly code in GMP library to work on both Linux and AIX, so there are other working examples.
I don't know exactly what produced
but
vs32,o0, andA0are not valid operands for the AIX assembler.brada4 commentedon Jun 23, 2020
AIX m4 (and solaris amd64 gives impression it comes from POSIX) requires extending one of three buffers to process bigger macros, just that it is less bug reports if it builds perfectly using "standard" tools, no matter how old that standard is.
Fix for OpenMathLib#2671
Merge pull request #2680 from kavanabhat/aix_makefile_fix
martin-frbg commentedon Oct 17, 2020
Hopefully all fixed in 0.3.11 now