Ignore:
Timestamp:
May 6, 2017, 4:05:05 PM (2 years ago)
Author:
nmedfort
Message:

Continued refactoring work.

Location:
icGREP/icgrep-devel/icgrep/IR_Gen
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/IR_Gen/CBuilder.cpp

    r5429 r5435  
    746746}
    747747
    748 CBuilder::CBuilder(Module * const module, const unsigned GeneralRegisterWidthInBits, const bool SupportsIndirectBr, const unsigned CacheLineAlignmentInBytes)
     748CBuilder::CBuilder(Module * const module, const unsigned GeneralRegisterWidthInBits)
    749749: IRBuilder<>(module->getContext())
    750750, mMod(module)
    751 , mCacheLineAlignment(CacheLineAlignmentInBytes)
     751, mCacheLineAlignment(64)
    752752, mSizeType(getIntNTy(GeneralRegisterWidthInBits))
    753753, mFILEtype(nullptr)
    754 , mSupportsIndirectBr(SupportsIndirectBr)
    755754, mDriver(nullptr) {
    756755
  • icGREP/icgrep-devel/icgrep/IR_Gen/CBuilder.h

    r5431 r5435  
    2525public:
    2626
    27     CBuilder(llvm::Module * const module, const unsigned GeneralRegisterWidthInBits, const bool SupportsIndirectBr, const unsigned CacheLineAlignmentInBytes = 64);
     27    CBuilder(llvm::Module * const module, const unsigned GeneralRegisterWidthInBits);
    2828   
    2929    virtual ~CBuilder() {}
     
    173173    }
    174174
    175     bool supportsIndirectBr() const {
    176         return mSupportsIndirectBr;
     175    virtual bool supportsIndirectBr() const {
     176        return true;
    177177    }
    178178
     
    214214    llvm::IntegerType *             mSizeType;
    215215    llvm::StructType *              mFILEtype;
    216     const bool                      mSupportsIndirectBr;
    217216    ParabixDriver *                 mDriver;
    218217    llvm::LLVMContext               mContext;
  • icGREP/icgrep-devel/icgrep/IR_Gen/idisa_avx_builder.h

    r5425 r5435  
    1616public:
    1717   
    18     IDISA_AVX_Builder(llvm::Module * const module, unsigned archBitWidth, unsigned bitBlockWidth)
    19     : IDISA_SSE2_Builder(module, archBitWidth, bitBlockWidth) {
     18    IDISA_AVX_Builder(llvm::Module * const module, unsigned archBitWidth, unsigned bitBlockWidth, unsigned stride)
     19    : IDISA_Builder(module, archBitWidth, bitBlockWidth, stride)
     20    , IDISA_SSE2_Builder(module, archBitWidth, bitBlockWidth, stride)
     21    {
     22
    2023    }
    2124
    2225    virtual std::string getBuilderUniqueName() override;
     26
    2327    Value * hsimd_signmask(unsigned fw, Value * a) override;
     28
    2429    ~IDISA_AVX_Builder() {}
    2530
     
    2934public:
    3035   
    31     IDISA_AVX2_Builder(llvm::Module * const module, unsigned archBitWidth, unsigned bitBlockWidth)
    32     : IDISA_AVX_Builder(module, archBitWidth, bitBlockWidth) {
     36    IDISA_AVX2_Builder(llvm::Module * const module, unsigned archBitWidth, unsigned bitBlockWidth, unsigned stride)
     37    : IDISA_Builder(module, archBitWidth, bitBlockWidth, stride)
     38    , IDISA_AVX_Builder(module, archBitWidth, bitBlockWidth, stride) {
     39
    3340    }
    3441
  • icGREP/icgrep-devel/icgrep/IR_Gen/idisa_builder.cpp

    r5425 r5435  
    376376}
    377377
    378 IDISA_Builder::IDISA_Builder(llvm::Module * const module, unsigned archBitWidth, unsigned bitBlockWidth, unsigned stride, const bool SupportsIndirectBr, unsigned CacheAlignment)
    379 : CBuilder(module, archBitWidth, SupportsIndirectBr, CacheAlignment)
     378void IDISA_Builder::initialize(llvm::Module * const module, unsigned archBitWidth, unsigned bitBlockWidth, unsigned stride) {
     379
     380}
     381
     382IDISA_Builder::IDISA_Builder(llvm::Module * const module, unsigned archBitWidth, unsigned bitBlockWidth, unsigned stride)
     383: CBuilder(module, archBitWidth)
    380384, mBitBlockWidth(bitBlockWidth)
    381385, mStride(stride)
    382 , mBitBlockType(VectorType::get(IntegerType::get(getContext(), 64), bitBlockWidth / 64))
     386, mBitBlockType(VectorType::get(IntegerType::get(module->getContext(), 64), bitBlockWidth / 64))
    383387, mZeroInitializer(Constant::getNullValue(mBitBlockType))
    384388, mOneInitializer(Constant::getAllOnesValue(mBitBlockType))
  • icGREP/icgrep-devel/icgrep/IR_Gen/idisa_builder.h

    r5425 r5435  
    2020public:
    2121
    22     IDISA_Builder(llvm::Module * const module, unsigned archBitWidth, unsigned bitBlockWidth, unsigned stride, const bool SupportsIndirectBr=true, unsigned CacheAlignment=64);
     22    IDISA_Builder(llvm::Module * const module, unsigned archBitWidth, unsigned bitBlockWidth, unsigned stride);
    2323
    2424    virtual ~IDISA_Builder();
     
    131131   
    132132protected:
     133
     134    void initialize(llvm::Module * const module, unsigned archBitWidth, unsigned bitBlockWidth, unsigned stride);
     135
     136protected:
    133137    unsigned            mBitBlockWidth;
    134138    unsigned            mStride;
     
    155159    CreateBlockAlignedStore(value, CreateGEP(ptr, indices));
    156160}
    157    
     161
    158162}
    159163#endif // IDISA_BUILDER_H
  • icGREP/icgrep-devel/icgrep/IR_Gen/idisa_i64_builder.h

    r5425 r5435  
    1313namespace IDISA {
    1414
    15 class IDISA_I64_Builder : public IDISA_Builder {
     15class IDISA_I64_Builder : public virtual IDISA_Builder {
    1616public:
    1717 
    18     IDISA_I64_Builder(llvm::Module * const module, unsigned archBitWidth, unsigned bitBlockWidth = 64, unsigned stride = 64, const bool SupportsIndirectBr = true)
    19     : IDISA_Builder(module, archBitWidth, bitBlockWidth, stride, SupportsIndirectBr) {
     18    IDISA_I64_Builder(llvm::Module * const module, unsigned archBitWidth, unsigned bitBlockWidth, unsigned stride)
     19    : IDISA_Builder(module, archBitWidth, bitBlockWidth, stride) {
    2020
    2121    }
  • icGREP/icgrep-devel/icgrep/IR_Gen/idisa_nvptx_builder.h

    r5425 r5435  
    1616public:
    1717   
    18     IDISA_NVPTX20_Builder(llvm::Module * const module, unsigned groupSize)
    19     : IDISA_I64_Builder(module, 64, 64, 64 * groupSize, false)
     18    IDISA_NVPTX20_Builder(llvm::Module * const module, unsigned registerWidth, unsigned vectorWidth, unsigned groupSize)
     19    : IDISA_Builder(module, registerWidth, registerWidth, (vectorWidth * groupSize))
     20    , IDISA_I64_Builder(module, registerWidth, registerWidth, (vectorWidth * groupSize))
    2021    , groupThreads(groupSize) {
    2122        CreateGlobals();
     
    4344    LoadInst * CreateAtomicLoadAcquire(Value * ptr) override;
    4445    StoreInst * CreateAtomicStoreRelease(Value * val, Value * ptr) override;
     46
     47    bool supportsIndirectBr() const final {
     48        return false;
     49    }
    4550
    4651private:
  • icGREP/icgrep-devel/icgrep/IR_Gen/idisa_sse_builder.h

    r5425 r5435  
    1414namespace IDISA {
    1515
    16 class IDISA_SSE_Builder : public IDISA_Builder {
     16class IDISA_SSE_Builder : public virtual IDISA_Builder {
    1717public:
    1818 
    19     IDISA_SSE_Builder(llvm::Module * const module, unsigned archBitWidth, unsigned bitBlockWidth)
    20     : IDISA_Builder(module, archBitWidth, bitBlockWidth, bitBlockWidth) {
     19    IDISA_SSE_Builder(llvm::Module * const module, unsigned archBitWidth, unsigned bitBlockWidth, unsigned stride)
     20    : IDISA_Builder(module, archBitWidth, bitBlockWidth, stride) {
     21
    2122    }
    2223
     
    3031public:
    3132 
    32     IDISA_SSE2_Builder(llvm::Module * const module, unsigned archBitWidth, unsigned bitBlockWidth)
    33     : IDISA_SSE_Builder(module, archBitWidth, bitBlockWidth) {
     33    IDISA_SSE2_Builder(llvm::Module * const module, unsigned archBitWidth, unsigned bitBlockWidth, unsigned stride)
     34    : IDISA_Builder(module, archBitWidth, bitBlockWidth, stride)
     35    , IDISA_SSE_Builder(module, archBitWidth, bitBlockWidth, stride) {
     36
    3437    }
    3538
     
    3841    Value * hsimd_packh(unsigned fw, Value * a, Value * b) override;
    3942    Value * hsimd_packl(unsigned fw, Value * a, Value * b) override;
    40     std::pair<Value *, Value *> bitblock_advance(Value * a, Value * shiftin, unsigned shift) override;
     43    std::pair<Value *, Value *> bitblock_advance(Value * a, Value * shiftin, unsigned shift) final;
    4144
    4245    ~IDISA_SSE2_Builder() {}
  • icGREP/icgrep-devel/icgrep/IR_Gen/idisa_target.cpp

    r5425 r5435  
    1313#include <llvm/ADT/Triple.h>
    1414
     15#include <kernels/kernel_builder.h>
     16
     17using namespace kernel;
     18
    1519namespace IDISA {
    1620   
    17 IDISA_Builder * GetIDISA_Builder(llvm::Module * const module) {
     21KernelBuilder * GetIDISA_Builder(llvm::Module * const module) {
    1822    unsigned registerWidth = 0;
    1923    Triple T(module->getTargetTriple());
     
    3135    if (codegen::BlockSize >= 256) {
    3236        if (hasAVX2) {
    33             return new IDISA_AVX2_Builder(module, registerWidth, codegen::BlockSize);
     37            return new KernelBuilderImpl<IDISA_AVX2_Builder>(module, registerWidth, codegen::BlockSize, codegen::BlockSize);
    3438        }
    3539    } else if (codegen::BlockSize == 64) {
    36         return new IDISA_I64_Builder(module, registerWidth);
     40        return new KernelBuilderImpl<IDISA_I64_Builder>(module, registerWidth, codegen::BlockSize, codegen::BlockSize);
    3741    }
    38     return new IDISA_SSE2_Builder(module, registerWidth, codegen::BlockSize);
     42    return new KernelBuilderImpl<IDISA_SSE2_Builder>(module, registerWidth, codegen::BlockSize, codegen::BlockSize);
    3943}
    4044
    41 IDISA_Builder * GetIDISA_GPU_Builder(llvm::Module * const module) {
    42     return new IDISA_NVPTX20_Builder(module, 64);
     45KernelBuilder * GetIDISA_GPU_Builder(llvm::Module * const module) {
     46    return new KernelBuilderImpl<IDISA_NVPTX20_Builder>(module, 64, 64, 64);
    4347}
    4448
  • icGREP/icgrep-devel/icgrep/IR_Gen/idisa_target.h

    r5425 r5435  
    99#include <string>
    1010namespace llvm { class Module; }
    11 namespace IDISA { class IDISA_Builder; }
     11namespace kernel { class KernelBuilder; }
    1212
    1313namespace IDISA {
    1414   
    15 IDISA::IDISA_Builder * GetIDISA_Builder(llvm::Module * const module);
     15kernel::KernelBuilder * GetIDISA_Builder(llvm::Module * const module);
    1616
    17 IDISA::IDISA_Builder * GetIDISA_GPU_Builder(llvm::Module * const module);
     17kernel::KernelBuilder * GetIDISA_GPU_Builder(llvm::Module * const module);
    1818
    1919}
Note: See TracChangeset for help on using the changeset viewer.