Sunday, November 01, 2020

Re: assembler error on trying to port OpenBLAS

On Sat, Oct 31, 2020 at 11:33:07PM -0400, Aisha Tammy wrote:
> On 10/31/20 9:48 PM, Brad Smith wrote:
> > On 10/31/2020 12:57 PM, Aisha Tammy wrote:
> > > On 10/29/20 8:25 PM, Aisha Tammy wrote:
> > > > Hi,
> > > > I'm trying to port OpenBLAS to the tree and am currently getting
> > > > some weird assembler errors (port makefile is attached at end math/openblas)
> > > >
> > > > ../kernel/x86_64/saxpy_microk_sandy-2.c: Assembler messages:
> > > > ../kernel/x86_64/saxpy_microk_sandy-2.c:37: Error: no such instruction: `vbroadcastss (%rcx),%ymm0'
> > > > ../kernel/x86_64/saxpy_microk_sandy-2.c:38: Error: no such instruction: `vmovups (%rdx,%rax,4),%ymm8'
> > > > ../kernel/x86_64/saxpy_microk_sandy-2.c:39: Error: no such instruction: `vmovups 32(%rdx,%rax,4),%ymm9'
> > > > ../kernel/x86_64/saxpy_microk_sandy-2.c:40: Error: no such instruction: `vmovups 64(%rdx,%rax,4),%ymm10'
> > > > ../kernel/x86_64/saxpy_microk_sandy-2.c:41: Error: no such instruction: `vmovups 96(%rdx,%rax,4),%ymm11'
> > > > ../kernel/x86_64/saxpy_microk_sandy-2.c:42: Error: no such instruction: `vmovups (%rsi,%rax,4),%ymm4'
> > > > ../kernel/x86_64/saxpy_microk_sandy-2.c:43: Error: no such instruction: `vmovups 32(%rsi,%rax,4),%ymm5'
> > > > ../kernel/x86_64/saxpy_microk_sandy-2.c:44: Error: no such instruction: `vmovups 64(%rsi,%rax,4),%ymm6'
> > > > ../kernel/x86_64/saxpy_microk_sandy-2.c:45: Error: no such instruction: `vmovups 96(%rsi,%rax,4),%ymm7'
> > > > ../kernel/x86_64/saxpy_microk_sandy-2.c:51: Error: no such instruction: `vmulps %ymm4,%ymm0,%ymm4'
> > > > ../kernel/x86_64/saxpy_microk_sandy-2.c:52: Error: no such instruction: `vaddps %ymm8,%ymm4,%ymm12'
> > > > ../kernel/x86_64/saxpy_microk_sandy-2.c:53: Error: no such instruction: `vmulps %ymm5,%ymm0,%ymm5'
> > > > ../kernel/x86_64/saxpy_microk_sandy-2.c:54: Error: no such instruction: `vaddps %ymm9,%ymm5,%ymm13'
> > > > ../kernel/x86_64/saxpy_microk_sandy-2.c:55: Error: no such instruction: `vmulps %ymm6,%ymm0,%ymm6'
> > > > ../kernel/x86_64/saxpy_microk_sandy-2.c:56: Error: no such instruction: `vaddps %ymm10,%ymm6,%ymm14'
> > > > ../kernel/x86_64/saxpy_microk_sandy-2.c:57: Error: no such instruction: `vmulps %ymm7,%ymm0,%ymm7'
> > > > ../kernel/x86_64/saxpy_microk_sandy-2.c:58: Error: no such instruction: `vaddps %ymm11,%ymm7,%ymm15'
> > > > ../kernel/x86_64/saxpy_microk_sandy-2.c:59: Error: no such instruction: `vmovups (%rdx,%rax,4),%ymm8'
> > > > ../kernel/x86_64/saxpy_microk_sandy-2.c:60: Error: no such instruction: `vmovups 32(%rdx,%rax,4),%ymm9'
> > > > ../kernel/x86_64/saxpy_microk_sandy-2.c:61: Error: no such instruction: `vmovups 64(%rdx,%rax,4),%ymm10'
> > > > ../kernel/x86_64/saxpy_microk_sandy-2.c:62: Error: no such instruction: `vmovups 96(%rdx,%rax,4),%ymm11'
> > > > ../kernel/x86_64/saxpy_microk_sandy-2.c:63: Error: no such instruction: `vmovups (%rsi,%rax,4),%ymm4'
> > > > ../kernel/x86_64/saxpy_microk_sandy-2.c:64: Error: no such instruction: `vmovups 32(%rsi,%rax,4),%ymm5'
> > > > ../kernel/x86_64/saxpy_microk_sandy-2.c:65: Error: no such instruction: `vmovups 64(%rsi,%rax,4),%ymm6'
> > > > ../kernel/x86_64/saxpy_microk_sandy-2.c:66: Error: no such instruction: `vmovups 96(%rsi,%rax,4),%ymm7'
> > > > ../kernel/x86_64/saxpy_microk_sandy-2.c:67: Error: no such instruction: `vmovups %ymm12,-128(%rdx,%rax,4)'
> > > > ../kernel/x86_64/saxpy_microk_sandy-2.c:68: Error: no such instruction: `vmovups %ymm13,-96(%rdx,%rax,4)'
> > > > ../kernel/x86_64/saxpy_microk_sandy-2.c:69: Error: no such instruction: `vmovups %ymm14,-64(%rdx,%rax,4)'
> > > > ../kernel/x86_64/saxpy_microk_sandy-2.c:70: Error: no such instruction: `vmovups %ymm15,-32(%rdx,%rax,4)'
> > > > ../kernel/x86_64/saxpy_microk_sandy-2.c:75: Error: no such instruction: `vmulps %ymm4,%ymm0,%ymm4'
> > > > ../kernel/x86_64/saxpy_microk_sandy-2.c:76: Error: no such instruction: `vmulps %ymm5,%ymm0,%ymm5'
> > > > ../kernel/x86_64/saxpy_microk_sandy-2.c:77: Error: no such instruction: `vmulps %ymm6,%ymm0,%ymm6'
> > > > ../kernel/x86_64/saxpy_microk_sandy-2.c:78: Error: no such instruction: `vmulps %ymm7,%ymm0,%ymm7'
> > > > ../kernel/x86_64/saxpy_microk_sandy-2.c:79: Error: no such instruction: `vaddps %ymm8,%ymm4,%ymm12'
> > > > ../kernel/x86_64/saxpy_microk_sandy-2.c:80: Error: no such instruction: `vaddps %ymm9,%ymm5,%ymm13'
> > > > ../kernel/x86_64/saxpy_microk_sandy-2.c:81: Error: no such instruction: `vaddps %ymm10,%ymm6,%ymm14'
> > > > ../kernel/x86_64/saxpy_microk_sandy-2.c:82: Error: no such instruction: `vaddps %ymm11,%ymm7,%ymm15'
> > > > ../kernel/x86_64/saxpy_microk_sandy-2.c:83: Error: no such instruction: `vmovups %ymm12,-128(%rdx,%rax,4)'
> > > > ../kernel/x86_64/saxpy_microk_sandy-2.c:84: Error: no such instruction: `vmovups %ymm13,-96(%rdx,%rax,4)'
> > > > ../kernel/x86_64/saxpy_microk_sandy-2.c:85: Error: no such instruction: `vmovups %ymm14,-64(%rdx,%rax,4)'
> > > > ../kernel/x86_64/saxpy_microk_sandy-2.c:86: Error: no such instruction: `vmovups %ymm15,-32(%rdx,%rax,4)'
> > > > ../kernel/x86_64/saxpy_microk_sandy-2.c:87: Error: no such instruction: `vzeroupper '
> > > >
> > > >
> > > > Presumably this is happening due to the assembler being used is
> > > > the one from base as we don't build the ports egcc with gas for
> > > > anything except aarch64 and arm.
> > > > I'm kind of stumped here as it seems like using gfortran sets the
> > > > compiler to egcc (compiling the above file with cc works).
> > > > Is it possible to mix gfortran with base-clang C compiler?
> > > > Another (possible) solution would be to build egcc all archs with
> > > > the new gas assembler, but that sounds a lot more dangerous and I
> > > > don't know enough to know if that is possible/or even a good idea/
> > > > or if it will even work :-/
> > > >
> > > > Any pointers would be cool to have.
> > > > (I've cc'ed pascal@ as they are the maintainer for gcc port and
> > > > can be better suited to answer the second point of gas)
> > > >
> > > > Thanks,
> > > > Aisha
> > > >
> > > >
> > > > # $OpenBSD $
> > > >
> > > > COMMENT?????? =?????? optimized BLAS/LAPACK library based on GotoBLAS
> > > > PKGNAME =?????? ${DISTNAME:L}
> > > > CATEGORIES =?????? math
> > > >
> > > > GH_ACCOUNT =?????? xianyi
> > > > GH_PROJECT =?????? OpenBLAS
> > > > GH_TAGNAME =?????? v0.3.12
> > > >
> > > > SHARED_LIBS =?????? openblas 0.0 \
> > > > ???????????????? blas 7.2 \
> > > > ???????????????? cblas 7.2 \
> > > > ???????????????? lapack 7.2 \
> > > > ???????????????? lapacke 7.2
> > > >
> > > > MAINTAINER =?????? Aisha Tammy <openbsd@aisha.cc>
> > > >
> > > > # BSD
> > > > PERMIT_PACKAGE =?????? Yes
> > > >
> > > > WANT_LIB +=?????? c m pthread
> > > >
> > > > MODULES =?????? fortran
> > > > MODFORTRAN_COMPILER =?????? gfortran
> > > >
> > > > USE_GMAKE =?????? Yes
> > > >
> > > > MAKE_ENV =?????? CFLAGS="${CFLAGS}" FFLAGS="${CFLAGS}" \
> > > > ???????????????? LIBopenblas_VERSION="${LIBopenblas_VERSION}" \
> > > > ???????????????? LIBblas_VERSION="${LIBblas_VERSION}" \
> > > > ???????????????? LIBcblas_VERSION="${LIBcblas_VERSION}" \
> > > > ???????????????? LIBlapack_VERSION="${LIBlapack_VERSION}" \
> > > > ???????????????? LIBlapacke_VERSION="${LIBlapacke_VERSION}" \
> > > > ???????????????? USE_THREAD=1 USE_OPENMP=0 \
> > > > ???????????????? NUM_PARALLEL=8 \
> > > > ???????????????? NUM_THREADS=64 \
> > > > ???????????????? MAKE_NB_JOBS=-1 \
> > > > ???????????????? DYNAMIC_ARCH=1 \
> > > > ???????????????? TARGET=GENERIC \
> > > > ???????????????? NO_AFFINITY=1 \
> > > > ???????????????? NO_STATIC=0 \
> > > > ???????????????? BUILD_RELAPACK=1
> > > >
> > > > .include <bsd.port.mk>
> > > >
> > >
> > > Thanks for the people who commented.
> > > I've managed to fix the error by forcing the
> > > COMPILER_LINKS = cc /usr/bin/cc gcc /usr/bin/gcc
> >
> > But that's not an option for something that is to be commited to the tree.
> >
>
> Well damn...
> Is there any other method to fix the compiler to cc instead of
> this?
> I tried adding the lang/clang module before the fortran module
> MODULES = lang/clang fortran
> but that fixes the compiler to /usr/local/bin/clang instead of the
> /usr/bin/clang.
> I am not sure what else to try right now :(

at least both clangs are the same version of clang (on 6.7).
And what's wrong with using /usr/local/bin/clang here?
(It could potentially lead to problems if there was C++ involved, but here it's not the case).

I'd have tried setting CC=/usr/bin/clang in MAKE_ENV list
(don't know whether this is legal from OpenBSD point of view)

Dima


>
> Thanks,
> Aisha
>

No comments:

Post a Comment