Changes between Version 13 and Version 14 of SIMDPlan


Ignore:
Timestamp:
Oct 12, 2011 4:23:20 PM (4 years ago)
Author:
pmonday
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • SIMDPlan

    v13 v14  
    3737 
    3838The steps to be undertaken are: 
    39  1. Modify ./compiler/prelude/primops.txt.pp 
     39 1. Modify ./compiler/prelude/PrimOp.lhs (actually, ./compiler/primop-primop-info.hs-incl) to add the new PrimOps (VIntQuotOp, etc...) 
     40 1. Modify ./compiler/prelude/primops.txt.pp (the following instructions may be changed a bit based on the direction) 
    4041  a. Add the following vector length constants as Int# types 
    4142   * intVecLen, intVec8Len, intVec16Len, intVec32Len, intVec64Len, wordVecLen, wordVec8Len, wordVec16Len, wordVec32Len, wordVec64Len, floatVecLen, and doubleVecLen,  
     
    7374It may make more sense to add the MachOps to Cmm prior to implementing the PrimOps (or at least before adding the code to the CgPrimOp.hs file).  There is a useful [http://hackage.haskell.org/trac/ghc/wiki/Commentary/Compiler/CmmType#AdditionsinCmm Cmm Wiki Page] available to aid in the definition of the new Cmm operations. 
    7475 
    75 The primary files that are involved in adding Cmm instructions are: 
    76  1. Modify CmmExpr.hs 
     76Modify compiler/cmm/CmmType.hs to add new required vector types and such, here is a basic outline of what needs to be done: 
     77{{{ 
     78data CmmType    -- The important one! 
     79  = CmmType CmmCat Width 
     80  
     81type Multiplicty = Int 
     82  
     83data CmmCat     -- "Category" (not exported) 
     84   = GcPtrCat   -- GC pointer 
     85   | BitsCat   -- Non-pointer 
     86   | FloatCat   -- Float 
     87   | VBitsCat  Multiplicity   -- Non-pointer 
     88   | VFloatCat Multiplicity  -- Float 
     89   deriving( Eq ) 
     90        -- See Note [Signed vs unsigned] at the end 
     91}}} 
    7792 
    78 Some existing Cmm instructions may be able to be reused, but there will have to be additional instructions added to account for vectorization primitives.  I'm still a little curious why these new instructions should not be built as out-of-line PrimOps.  It should be noted that the reference for adding primops appears to be wildly out of data for adding out-of-line primops. 
     93Modify compiler/cmm/CmmMachOp.hs, this will add the necessary MachOps for use from the PrimOps modifications to support SIMD.  Here is an example of adding a SIMD version of the MO_F_Add MachOp: 
     94{{{ 
     95  -- Floating point arithmetic 
     96  MO_VF_Add Width Int   -- MO_VF_Add W64 4   Add 4-vector of 64-bit floats 
     97}}} 
     98 
     99Some existing Cmm instructions may be able to be reused, but there will have to be additional instructions added to account for vectorization primitives.  This will help keep the SIMD / non-SIMD code generation separate for the time being until we have it working. 
    79100 
    80101== Modify LLVM Code Generator ==