Skip to content

Build of OpenBLAS 0.3.8 breaks on AIX #2671

Closed

Description

@trex58

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 :

ifeq ($(OS), AIX)
	$(CC) $(CFLAGS) -UDOUBLE -UCOMPLEX -E $< -o cgemm_itcopy.s
	m4 cgemm_itcopy.s > cgemm_itcopy_nomacros.s
	$(CC) $(CFLAGS) -c -UDOUBLE -UCOMPLEX cgemm_itcopy_nomacros.s -o $@
	rm cgemm_itcopy.s cgemm_itcopy_nomacros.s

Which generates:

gcc -maix64 -O2 -DMAX_STACK_ALLOC=2048 -fopenmp -Wall -DF_INTERFACE_GFORT -fPIC -DSMP_SERVER -DUSE_OPENMP -DNO_WARMUP -DMAX_CPU_NUMBER=2 -DMAX_PARALLEL_NUMBER=1 -DVERSION=\"0.3.8\" -mpowerpc64 -maix64 -DASMNAME=cgemm_itcopy -DASMFNAME=cgemm_itcopy_ -DNAME=cgemm_itcopy_ -DCNAME=cgemm_itcopy -DCHAR_NAME=\"cgemm_itcopy_\" -DCHAR_CNAME=\"cgemm_itcopy\" -DNO_AFFINITY -I.. -UDOUBLE  -DCOMPLEX -UDOUBLE -UCOMPLEX -E ../kernel/power/../generic/zgemm_tcopy_2.c -o cgemm_itcopy.s

m4 cgemm_itcopy.s > cgemm_itcopy_nomacros.s

...
gcc -maix64 -O2 -DMAX_STACK_ALLOC=2048 -fopenmp -Wall -DF_INTERFACE_GFORT -fPIC -DSMP_SERVER -DUSE_OPENMP -DNO_WARMUP -DMAX_CPU_NUMBER=2 -DMAX_PARALLEL_NUMBER=1 -DVERSION=\"0.3.8\" -mpowerpc64 -maix64 -DASMNAME=cgemm_itcopy -DASMFNAME=cgemm_itcopy_ -DNAME=cgemm_itcopy_ -DCNAME=cgemm_itcopy -DCHAR_NAME=\"cgemm_itcopy_\" -DCHAR_CNAME=\"cgemm_itcopy\" -DNO_AFFINITY -I.. -UDOUBLE  -DCOMPLEX -c -UDOUBLE -UCOMPLEX cgemm_itcopy_nomacros.s -o cgemm_itcopy.o
Assembler:
cgemm_itcopy_nomacros.s: line 12: invalid opcode or pseudo-op
cgemm_itcopy_nomacros.s: line 12: Error In Syntax
...............

File cgemm_itcopy.s starts with:

# 1 "../kernel/power/../generic/zgemm_tcopy_2.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "../kernel/power/../generic/zgemm_tcopy_2.c"
# 39 "../kernel/power/../generic/zgemm_tcopy_2.c"
# 1 "/home2/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/8/include-fixed/stdio.h" 1 3 4
# 11 "/home2/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/8/include-fixed/stdio.h" 3 4
........

This is due to the "-E" option used in line:

$(CC) $(CFLAGS) -UDOUBLE -UCOMPLEX -E $< -o cgemm_itcopy.s

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.

This patch is WRONG. Do not use it.
openblas-0.3.8-CC-E-S.patch.txt

Activity

  1. trex58 commented on Jun 16, 2020

    @trex58
    Author

    The second issue appears within:

    gcc -maix64 -O2 -DMAX_STACK_ALLOC=2048 -fopenmp -Wall -DF_INTERFACE_GFORT -fPIC -DSMP_SERVER -DUSE_OPENMP -DNO_WARMUP -DMAX_CPU_NUMBER=2 -DMAX_PARALLEL_NUMBER=1 -DVERSION=\"0.3.10\" -mpowerpc64 -maix64 -UASMNAME -UASMFNAME -UNAME -UCNAME -UCHAR_NAME -UCHAR_CNAME -DASMNAME=sgemm_kernel -DASMFNAME=sgemm_kernel_ -DNAME=sgemm_kernel_ -DCNAME=sgemm_kernel -DCHAR_NAME=\"sgemm_kernel_\" -DCHAR_CNAME=\"sgemm_kernel\" -DNO_AFFINITY -I.. -UDOUBLE  -UCOMPLEX -S -UDOUBLE -UCOMPLEX  ../kernel/power/gemm_kernel_power6.S -o sgemm_kernel.s
    

    still in code of kernel/Makefile.L3 (version 0.3.10) :

    656: ifeq ($(OS), AIX)
    657:        $(CC) $(CFLAGS) -S -UDOUBLE -UCOMPLEX  $< -o sgemm_kernel$(TSUFFIX).s
    
  2. martin-frbg commented on Jun 16, 2020

    @martin-frbg
    Collaborator

    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 ?)

  3. trex58 commented on Jun 16, 2020

    @trex58
    Author

    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.

  4. trex58 commented on Jun 17, 2020

    @trex58
    Author

    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:

    cd kernel
    gcc -E ../generic/zgemm_tcopy_2.c  ---> cgemm_itcopy.s
    m4 cgemm_itcopy.s ----> cgemm_itcopy_nomacros.s
    gcc cgemm_itcopy_nomacros.s ---> 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 :

    # diff cgemm_itcopy.s cgemm_itcopy_nomacros.s
    2038c2038
    <  extern int mkstemp(char *);
    ---
    >  extern int char *kZwqea;
    3066c3066
    <         extern char *index(const char *, int);
    ---
    >         extern char *-1;
    
  5. martin-frbg commented on Jun 17, 2020

    @martin-frbg
    Collaborator

    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.

  6. trex58 commented on Jun 17, 2020

    @trex58
    Author

    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.

  7. trex58 commented on Jun 17, 2020

    @trex58
    Author

    No. I have the same behavior with GCC 6.3 on AIX 6.1 :

    # gcc --version
    gcc (GCC) 6.3.0
    
    + gcc -maix64 -O2 -DMAX_STACK_ALLOC=2048 -fopenmp -Wall -DF_INTERFACE_GFORT -fPIC -DSMP_SERVER -DUSE_OPENMP -DNO_WARMUP -DMAX_CPU_NUMBER=2 -DMAX_PARALLEL_NU
    MBER=1 -DVERSION="0.3.8" -mpowerpc64 -maix64 -DASMNAME=cgemm_itcopy -DASMFNAME=cgemm_itcopy_ -DNAME=cgemm_itcopy_ -DCNAME=cgemm_itcopy -DCHAR_NAME="cgemm_it
    copy_" -DCHAR_CNAME="cgemm_itcopy" -DNO_AFFINITY -I.. -UDOUBLE -DCOMPLEX -UDOUBLE -UCOMPLEX \
            -E ../kernel/power/../generic/zgemm_tcopy_2.c -o cgemm_itcopy.s
    + m4 cgemm_itcopy.s
    + 1> cgemm_itcopy_nomacros.s
    + gcc -maix64 -O2 -DMAX_STACK_ALLOC=2048 -fopenmp -Wall -DF_INTERFACE_GFORT -fPIC -DSMP_SERVER -DUSE_OPENMP -DNO_WARMUP -DMAX_CPU_NUMBER=2 -DMAX_PARALLEL_NU
    MBER=1 -DVERSION="0.3.8" -mpowerpc64 -maix64 -DASMNAME=cgemm_itcopy -DASMFNAME=cgemm_itcopy_ -DNAME=cgemm_itcopy_ -DCNAME=cgemm_itcopy -DCHAR_NAME="cgemm_it
    copy_" -DCHAR_CNAME="cgemm_itcopy" -DNO_AFFINITY -I.. -UDOUBLE -DCOMPLEX -c -UDOUBLE -UCOMPLEX \
            cgemm_itcopy_nomacros.s -o cgemm_itcopy.o
    Assembler:
    cgemm_itcopy_nomacros.s: line 12: invalid opcode or pseudo-op
    cgemm_itcopy_nomacros.s: line 12: Error In Syntax
    
  8. martin-frbg commented on Jun 17, 2020

    @martin-frbg
    Collaborator

    Does it work when you rename the .s to .c again (or add -x c to the gcc options) ? I.e., is the error introduced by m4 present there as well ?

  9. brada4 commented on Jun 17, 2020

    @brada4
    Contributor

    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.

  10. trex58 commented on Jun 18, 2020

    @trex58
    Author

    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:

    $(KDIR)$(SGEMMOTCOPYOBJ) : $(KERNELDIR)/$(SGEMMOTCOPY)
    ifeq ($(OS), AIX)
            $(CC) $(CFLAGS) -E -UDOUBLE -UCOMPLEX $< -o sgemmotcopy.s
            m4 sgemmotcopy.s > sgemmotcopy_nomacros.s
            $(CC) $(CFLAGS) -c -UDOUBLE -UCOMPLEX sgemmotcopy_nomacros.s -o $@
            rm sgemmotcopy.s sgemmotcopy_nomacros.s
    else
            $(CC) $(CFLAGS) -c -UDOUBLE -UCOMPLEX $< -o $@
    endif
    

    appear in kernel/Makefile.L3 . They were added for Power8 I think.

    The .spec file I'm using comes from IBM. It defines:

    PATH=/opt/freeware/bin:/usr/local/bin/:/usr/vac/bin:/opt/freeware/bin:/usr/linux/bin:/usr/local/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:/usr/java8_64/jre/bin:/usr/java8_64/bin:/usr/samples/kernel:.
    + export CC=gcc -maix64
    + export CXX=g++ -maix64
    + export FC=gfortran -maix64
    + make BINARY=64 TARGET=POWER6
    

    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:

    gcc -maix64 -Ofast -mcpu=power8 -mtune=power8 -mvsx -malign-power -DUSE_OPENMP `
    -fno-fast-math -fopenmp -DMAX_STACK_ALLOC=2048 -fopenmp -Wall -DF_INTERFACE_GFORT
     -fPIC -DSMP_SERVER -DUSE_OPENMP -DNO_WARMUP -DMAX_CPU_NUMBER=2
     -DMAX_PARALLEL_NUMBER=1 -DVERSION=\"0.3.8\" -mpowerpc64 -maix64
     -DASMNAME=sgemm_kernel -DASMFNAME=sgemm_kernel_ -DNAME=sgemm_kernel_
     -DCNAME=sgemm_kernel -DCHAR_NAME=\"sgemm_kernel_\"
     -DCHAR_CNAME=\"sgemm_kernel\" -DNO_AFFINITY -I.. -UDOUBLE  -UCOMPLEX -S -UDOUBLE
     -UCOMPLEX  ../kernel/power/sgemm_kernel_16x8_power8.S -o sgemm_kernel.s
    # 1 "../kernel/power/sgemm_kernel_16x8_power8.S"
    # 1 "<built-in>"
    # 1 "<command-line>"
    # 1 "../kernel/power/sgemm_kernel_16x8_power8.S"
    # 75 "../kernel/power/sgemm_kernel_16x8_power8.S"
    

    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
    

    However, looking at kernel/power, there are :

    KERNEL.POWER3
    KERNEL.POWER4
    KERNEL.POWER5
    KERNEL.POWER6
    KERNEL.POWER8
    KERNEL.POWER9
    

    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 .

  11. martin-frbg commented on Jun 18, 2020

    @martin-frbg
    Collaborator

    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

  12. trex58 commented on Jun 18, 2020

    @trex58
    Author

    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.

  13. trex58 commented on Jun 18, 2020

    @trex58
    Author

    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 .

  14. martin-frbg commented on Jun 18, 2020

    @martin-frbg
    Collaborator

    Probably something like (untested)

    ifeq ($(OS)$(filter-out($(TARGET),POWER8 POWER9 POWER10), AIX)
    

    instead of the ifeq($(OS),AIX)

  15. trex58 commented on Jun 18, 2020

    @trex58
    Author

    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.

  16. 26 remaining items

  17. kavanabhat commented on Jun 22, 2020

    @kavanabhat
    Contributor

    GNU m4 is being invoked.

  18. trex58 commented on Jun 22, 2020

    @trex58
    Author

    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):

    • make BINARY=64 TARGET=POWER8
    gcc -maix64 -Ofast -mcpu=power8 -mtune=power8 -mvsx -malign-power -DUSE_OPENMP -fno-fast-math -fopenmp -DMAX_STACK_ALLOC=2048 -fopenmp -Wall -DF_INTERFACE_GFORT -fPIC -DSMP_SERVER -DUSE_OPENMP -DNO_WARMUP -DMAX_CPU_NUMBER=2 -DMAX_PARALLEL_NUMBER=1 -DVERSION=\"0.3.10\" -mpowerpc64 -maix64 -UASMNAME -UASMFNAME -UNAME -UCNAME -UCHAR_NAME -UCHAR_CNAME -DASMNAME=sgemm_otcopy -DASMFNAME=sgemm_otcopy_ -DNAME=sgemm_otcopy_ -DCNAME=sgemm_otcopy -DCHAR_NAME=\"sgemm_otcopy_\" -DCHAR_CNAME=\"sgemm_otcopy\" -DNO_AFFINITY -I.. -UDOUBLE  -UCOMPLEX -E -UDOUBLE -UCOMPLEX **../kernel/power/sgemm_tcopy_8_power8.S** -o sgemmotcopy.s
    m4 sgemmotcopy.s > sgemmotcopy_nomacros.s
    gcc -maix64 -Ofast -mcpu=power8 -mtune=power8 -mvsx -malign-power -DUSE_OPENMP -fno-fast-math -fopenmp -DMAX_STACK_ALLOC=2048 -fopenmp -Wall -DF_INTERFACE_GFORT -fPIC -DSMP_SERVER -DUSE_OPENMP -DNO_WARMUP -DMAX_CPU_NUMBER=2 -DMAX_PARALLEL_NUMBER=1 -DVERSION=\"0.3.10\" -mpowerpc64 -maix64 -UASMNAME -UASMFNAME -UNAME -UCNAME -UCHAR_NAME -UCHAR_CNAME -DASMNAME=sgemm_otcopy -DASMFNAME=sgemm_otcopy_ -DNAME=sgemm_otcopy_ -DCNAME=sgemm_otcopy -DCHAR_NAME=\"sgemm_otcopy_\" -DCHAR_CNAME=\"sgemm_otcopy\" -DNO_AFFINITY -I.. -UDOUBLE  -UCOMPLEX -c -UDOUBLE -UCOMPLEX sgemmotcopy_nomacros.s -o sgemm_otcopy.o
    rm sgemmotcopy.s sgemmotcopy_nomacros.s
    

    File ../kernel/power/sgemm_tcopy_8_power8.S is made of #define and #include and of assembler code.

    • make BINARY=64 TARGET=POWER6
    gcc -maix64 -O2 -DMAX_STACK_ALLOC=2048 -fopenmp -Wall -DF_INTERFACE_GFORT -fPIC -DSMP_SERVER -DUSE_OPENMP -DNO_WARMUP -DMAX_CPU_NUMBER=2 -DMAX_PARALLEL_NUMBER=1 -DVERSION=\"0.3.10\" -mpowerpc64 -maix64 -UASMNAME -UASMFNAME -UNAME -UCNAME -UCHAR_NAME -UCHAR_CNAME -DASMNAME=sgemm_otcopy -DASMFNAME=sgemm_otcopy_ -DNAME=sgemm_otcopy_ -DCNAME=sgemm_otcopy -DCHAR_NAME=\"sgemm_otcopy_\" -DCHAR_CNAME=\"sgemm_otcopy\" -DNO_AFFINITY -I.. -UDOUBLE  -UCOMPLEX -c -UDOUBLE -UCOMPLEX ../kernel/power/gemm_tcopy_4.S -o sgemm_otcopy.o
    

    File : ./kernel/power/gemm_tcopy_4.S is made of some #define and of assembler code.

    If I replace the lines:

    ifeq ($(findstring AIXPOW, $(OSNAME)$(filter $(TARGET), POWER8 POWER9 POWER10)), AIXPOW)
           $(CC) $(CFLAGS) -E -UDOUBLE -UCOMPLEX $< -o sgemmotcopy.s
           m4 sgemmotcopy.s > sgemmotcopy_nomacros.s
           $(CC) $(CFLAGS) -c -UDOUBLE -UCOMPLEX sgemmotcopy_nomacros.s -o $@
           rm sgemmotcopy.s sgemmotcopy_nomacros.s
    

    by:

    ifeq ($(findstring AIXPOW, $(OSNAME)$(filter $(TARGET), POWER8 POWER9 POWER10)), AIXPOW)
            $(CC) $(CFLAGS) -c -UDOUBLE -UCOMPLEX $< -o $@
    

    That breaks as:

     gcc -maix64 -Ofast -mcpu=power8 -mtune=power8 -mvsx -malign-power -DUSE_OPENMP -fno-fast-math -fopenmp -DMAX_STACK_ALLOC=2048 -fopenmp -Wall -DF_INTERFACE_GFORT -fPIC -DSMP_SERVER -DUSE_OPENMP -DNO_WARMUP -DMAX_CPU_NUMBER=2 -DMAX_PARALLEL_NUMBER=1 -DVERSION="0.3.10" -mpowerpc64 -maix64 -UASMNAME -UASMFNAME -UNAME -UCNAME -UCHAR_NAME -UCHAR_CNAME -DASMNAME=sgemm_otcopy -DASMFNAME=sgemm_otcopy_ -DNAME=sgemm_otcopy_ -DCNAME=sgemm_otcopy -DCHAR_NAME="sgemm_otcopy_" -DCHAR_CNAME="sgemm_otcopy" -DNO_AFFINITY -I.. -UDOUBLE -UCOMPLEX -c -UDOUBLE -UCOMPLEX ../kernel/power/sgemm_tcopy_8_power8.S -o sgemm_otcopy.o
    Assembler:
    /tmp//cceKS9Rd.s: line 56: Invalid source character 0x60
    /tmp//cceKS9Rd.s: line 56: Error In Syntax
    ...
    

    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...":

    # 42 "../kernel/power/sgemm_tcopy_macros_8_power8.S"
    define(`COPY_4x8', `
    ....
    

    is not accepted.
    Original code:

    #if defined(_AIX)
    define(`COPY_4x8', `
    #else
    .macro COPY_4x8
    #endif
    
            lxvw4x          vs32,   o0,     A0
            lxvw4x          vs33,   o16,    A0
    ...
    

    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.

  19. kavanabhat commented on Jun 22, 2020

    @kavanabhat
    Contributor

    @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

  20. martin-frbg commented on Jun 22, 2020

    @martin-frbg
    Collaborator

    @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.)

  21. trex58 commented on Jun 22, 2020

    @trex58
    Author

    I'm in several meeting calls this afternoon. Will go back later.

  22. martin-frbg commented on Jun 22, 2020

    @martin-frbg
    Collaborator

    Another question for those familiar with AIX - is this statement (from #1803 (comment)) correct at all ?

     on AIX, all shared object files ends in .a, not .so.
    
  23. edelsohn commented on Jun 22, 2020

    @edelsohn

    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.

  24. edelsohn commented on Jun 22, 2020

    @edelsohn

    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.

  25. edelsohn commented on Jun 22, 2020

    @edelsohn

    @trex58 It's not OpenBLAS job to debug AIX assembler.

  26. edelsohn commented on Jun 23, 2020

    @edelsohn

    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.

    ifeq ($(OS), AIX)
    	$(CC) $(CFLAGS) -UDOUBLE -UCOMPLEX -E $< -o cgemm_itcopy.c
    	m4 cgemm_itcopy.c > cgemm_itcopy_nomacros.c
    	$(CC) $(CFLAGS) -c -UDOUBLE -UCOMPLEX cgemm_itcopy_nomacros.c -o $@
    	rm cgemm_itcopy.c cgemm_itcopy_nomacros.c
    

    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

            lxvw4x          vs32,   o0,     A0
    

    but vs32, o0, and A0 are not valid operands for the AIX assembler.

  27. brada4 commented on Jun 23, 2020

    @brada4
    Contributor

    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.

  28. added a commit that references this issue on Jun 24, 2020
  29. added a commit that references this issue on Jun 26, 2020
  30. martin-frbg commented on Oct 17, 2020

    @martin-frbg
    Collaborator

    Hopefully all fixed in 0.3.11 now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions