Merge branch 'wip/simd'
This merge revises and extends the current SIMD support in GHC. Notable features: * Support for AVX, AVX2, and AVX-512. Support for AVX-512 is untested. * SIMD primops are currently LLVM-only and documented in compiler/prelude/primops.txt.pp. * By default only 128-bit wide SIMD vectors are passed in registers, and then only on the X86_64 architecture. There is a "hidden" flag, -fllvm-pass-vectors-in-regs, that causes GHC to generate LLVM code that assumes all vectors are passed in registers by LLVM. This can be used with a suitably patched version of LLVM, and if we get LLVM 3.4 patched, we can consider turning it on by default for LLVM 3.4+. This would mean that we couldn't mix LLVM <3.4-compiled object files with LLVM >=3.4-compiled object files, but I don't see that as much of a problem. * utils/genprimcode has been hacked up to allow us to write vector operations once and have them instantiated at multiple vector types. I'm not thrilled with this solution, but after discussing with Simon PJ, what I've implemented seems to be the minimal reasonable solution to the problem of exploding primop boilerplate. The changes are documented in compiler/prelude/primops.txt.pp. * Error handling is sub-optimal. My patch checks to make sure that vector primops can be compiled efficiently based on the current set of dynamic flags. For example, if -mavx is not specified and the user tries to use a primop that adds together two 256-bit wide vectors of double-precision elements, the user will see an error message like: ghc-stage2: sorry! (unimplemented feature or known bug) (GHC version 7.7.20130916 for x86_64-unknown-linux): 256-bit wide floating point SIMD vector instructions require at least -mavx.
Showing
- compiler/cmm/CmmCallConv.hs 45 additions, 17 deletionscompiler/cmm/CmmCallConv.hs
- compiler/cmm/CmmExpr.hs 18 additions, 0 deletionscompiler/cmm/CmmExpr.hs
- compiler/cmm/CmmLex.x 6 additions, 0 deletionscompiler/cmm/CmmLex.x
- compiler/cmm/CmmMachOp.hs 10 additions, 0 deletionscompiler/cmm/CmmMachOp.hs
- compiler/cmm/CmmParse.y 4 additions, 0 deletionscompiler/cmm/CmmParse.y
- compiler/cmm/CmmType.hs 16 additions, 2 deletionscompiler/cmm/CmmType.hs
- compiler/cmm/PprC.hs 9 additions, 0 deletionscompiler/cmm/PprC.hs
- compiler/cmm/PprCmmExpr.hs 2 additions, 0 deletionscompiler/cmm/PprCmmExpr.hs
- compiler/codeGen/CgUtils.hs 14 additions, 0 deletionscompiler/codeGen/CgUtils.hs
- compiler/codeGen/StgCmmArgRep.hs 13 additions, 3 deletionscompiler/codeGen/StgCmmArgRep.hs
- compiler/codeGen/StgCmmLayout.hs 2 additions, 0 deletionscompiler/codeGen/StgCmmLayout.hs
- compiler/codeGen/StgCmmPrim.hs 208 additions, 125 deletionscompiler/codeGen/StgCmmPrim.hs
- compiler/ghc.mk 14 additions, 2 deletionscompiler/ghc.mk
- compiler/ghci/ByteCodeAsm.lhs 4 additions, 0 deletionscompiler/ghci/ByteCodeAsm.lhs
- compiler/llvmGen/LlvmCodeGen/Base.hs 2 additions, 0 deletionscompiler/llvmGen/LlvmCodeGen/Base.hs
- compiler/llvmGen/LlvmCodeGen/CodeGen.hs 8 additions, 0 deletionscompiler/llvmGen/LlvmCodeGen/CodeGen.hs
- compiler/llvmGen/LlvmCodeGen/Regs.hs 14 additions, 0 deletionscompiler/llvmGen/LlvmCodeGen/Regs.hs
- compiler/llvmGen/LlvmMangler.hs 38 additions, 1 deletioncompiler/llvmGen/LlvmMangler.hs
- compiler/main/CmdLineParser.hs 1 addition, 1 deletioncompiler/main/CmdLineParser.hs
- compiler/main/DriverPipeline.hs 33 additions, 7 deletionscompiler/main/DriverPipeline.hs
Loading
Please register or sign in to comment