[commit: ghc] master: Merge branch 'wip/simd' (680441d)

git at git.haskell.org git at git.haskell.org
Mon Sep 23 06:28:16 CEST 2013


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/680441de191145dd874bd453e09e4ee906d87bbb/ghc

>---------------------------------------------------------------

commit 680441de191145dd874bd453e09e4ee906d87bbb
Merge: 6e6e6f5 25eeb67
Author: Geoffrey Mainland <gmainlan at microsoft.com>
Date:   Mon Sep 23 00:22:19 2013 -0400

    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.



>---------------------------------------------------------------

680441de191145dd874bd453e09e4ee906d87bbb
 compiler/cmm/CmmCallConv.hs              |   62 +++-
 compiler/cmm/CmmExpr.hs                  |   18 +
 compiler/cmm/CmmLex.x                    |    6 +
 compiler/cmm/CmmMachOp.hs                |   10 +
 compiler/cmm/CmmParse.y                  |    4 +
 compiler/cmm/CmmType.hs                  |   18 +-
 compiler/cmm/PprC.hs                     |    9 +
 compiler/cmm/PprCmmExpr.hs               |    2 +
 compiler/codeGen/CgUtils.hs              |   14 +
 compiler/codeGen/StgCmmArgRep.hs         |   16 +-
 compiler/codeGen/StgCmmLayout.hs         |    2 +
 compiler/codeGen/StgCmmPrim.hs           |  333 +++++++++++-------
 compiler/ghc.mk                          |   16 +-
 compiler/ghci/ByteCodeAsm.lhs            |    4 +
 compiler/llvmGen/LlvmCodeGen/Base.hs     |    2 +
 compiler/llvmGen/LlvmCodeGen/CodeGen.hs  |    8 +
 compiler/llvmGen/LlvmCodeGen/Regs.hs     |   14 +
 compiler/llvmGen/LlvmMangler.hs          |   39 ++-
 compiler/main/CmdLineParser.hs           |    2 +-
 compiler/main/DriverPipeline.hs          |   40 ++-
 compiler/main/DynFlags.hs                |   55 ++-
 compiler/nativeGen/X86/CodeGen.hs        |    2 +
 compiler/prelude/PrelNames.lhs           |   15 +-
 compiler/prelude/PrimOp.lhs              |   11 +-
 compiler/prelude/TysPrim.lhs             |   40 +--
 compiler/prelude/primops.txt.pp          |  546 ++++++++----------------------
 includes/Cmm.h                           |    2 +
 includes/CodeGen.Platform.hs             |  124 ++++++-
 includes/rts/storage/FunTypes.h          |   36 +-
 includes/stg/MachRegs.h                  |   53 ++-
 includes/stg/MiscClosures.h              |    4 +
 includes/stg/Regs.h                      |   84 +++++
 includes/stg/Types.h                     |    4 +
 rts/Linker.c                             |    6 +
 utils/deriveConstants/DeriveConstants.hs |   12 +
 utils/genapply/GenApply.hs               |   12 +
 utils/genprimopcode/Lexer.x              |    8 +
 utils/genprimopcode/Main.hs              |  396 ++++++++++++++++------
 utils/genprimopcode/Parser.y             |   29 +-
 utils/genprimopcode/ParserM.hs           |    8 +
 utils/genprimopcode/Syntax.hs            |   42 ++-
 41 files changed, 1380 insertions(+), 728 deletions(-)




More information about the ghc-commits mailing list