Code Monkey home page Code Monkey logo

psimd's Issues

error compiling on Ubuntu 17.10

Trying to compile NNPACK I get the following psimd error on ubuntu 17.10

/usr/bin/cc -DNNP_BACKEND_PSIMD=1 -DNNP_CONVOLUTION_ONLY=0 -DNNP_INFERENCE_ONLY=1 -Iinclude -Isrc -Ideps/cpuinfo/include -Ideps/pthreadpool/include -Ideps/fxdiv/include -Ideps/psimd/include -Ideps/fp16/include -std=gnu99 -MD -MT CMakeFiles/nnpack.dir/src/psimd/softmax.c.o -MF CMakeFiles/nnpack.dir/src/psimd/softmax.c.o.d -o CMakeFiles/nnpack.dir/src/psimd/softmax.c.o   -c src/psimd/softmax.c
In file included from src/psimd/softmax.c:10:0:
src/psimd/exp.h: In function 'psimd_exp_f32':
src/psimd/exp.h:45:1: error: unrecognizable insn:
 }
 ^
(insn 169 168 170 2 (set (reg:V4SI 126 [ _89 ])
        (gt:V4SI (reg:V4SI 227)
            (mem/c:V4SI (plus:DI (reg/f:DI 82 virtual-stack-vars)
                    (const_int -64 [0xffffffffffffffc0])) [2 b+0 S16 A32]))) "deps/psimd/include/psimd.h":669 -1
     (nil))
src/psimd/exp.h:45:1: internal compiler error: in extract_insn, at recog.c:2311
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-7/README.Bugs> for instructions.
[19/51] Building C object CMakeFiles/nnpack.dir/src/psimd/blas/shdotxf.c.o
FAILED: CMakeFiles/nnpack.dir/src/psimd/blas/shdotxf.c.o 
/usr/bin/cc -DNNP_BACKEND_PSIMD=1 -DNNP_CONVOLUTION_ONLY=0 -DNNP_INFERENCE_ONLY=1 -Iinclude -Isrc -Ideps/cpuinfo/include -Ideps/pthreadpool/include -Ideps/fxdiv/include -Ideps/psimd/include -Ideps/fp16/include -std=gnu99 -MD -MT CMakeFiles/nnpack.dir/src/psimd/blas/shdotxf.c.o -MF CMakeFiles/nnpack.dir/src/psimd/blas/shdotxf.c.o.d -o CMakeFiles/nnpack.dir/src/psimd/blas/shdotxf.c.o   -c src/psimd/blas/shdotxf.c
src/psimd/blas/shdotxf.c: In function 'nnp_shdotxf1__psimd':
src/psimd/blas/shdotxf.c:33:1: error: unrecognizable insn:
 }
 ^
(insn 200 199 201 5 (set (reg:V4SI 116 [ _104 ])
        (gt:V4SI (reg:V4SI 247)
            (mem/c:V4SI (plus:DI (reg/f:DI 82 virtual-stack-vars)
                    (const_int -416 [0xfffffffffffffe60])) [2 b+0 S16 A32]))) "deps/psimd/include/psimd.h":669 -1
     (nil))
src/psimd/blas/shdotxf.c:33:1: internal compiler error: in extract_insn, at recog.c:2311```

Support portable vector alignment

Different vector units handle alignment in interesting ways. ARM/NEON supports fixing up unaligned accesses at runtime, or trapping on them depending on the instruction alignment specifier. PowerPC/Altivec however silently loads/stores...somewhere slightly different, which causes all manner of problems if an unaligned address makes it to the Altivec load/store unit.

Currently, GCC9 on PowerPC ignores the Altivec execution unit entirely when using PSIMD, this appears to be because aligned(N) has N set to at most 4 bytes, but the Altivec unit require 16 byte alignment before it can safely load/store vectors. Increasing N to 16 results in AltiVec instructions being used; however, much code using PSIMD isn't written to align its memory. For example, NNPACK fails the convolution tests.

I think this is because the psimd_(load|store)_ family of instructions aren't alignment-aware and support load/store to native C types, which may not be aligned to the requirements of a vector unit.

I'm not sure what the right solution would be, perhaps some combination of:

  • adding a platform-recommended alignment so api callers can align their buffers to use
  • adding some load/store aligned functions
  • fixing up the current load/store functions to handle unaligned accesses in software on platforms that require it

__builtin_shuffle not supported in icc

The title says it all. icc fails with this message:

error: "__builtin_shuffle" is not supported

Any chance of getting an alternative implementation for icc? This impacts the compilation of pytorch with the intel compiler, making it essentially not possible.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.