Ignore:
Timestamp:
Jun 13, 2016, 11:12:08 AM (3 years ago)
Author:
cameron
Message:

s2p kernel with new infrastructure, includes s2p_FinalBlock

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/kernels/kernel.h

    r5037 r5051  
    4242
    4343namespace kernel {
    44 
     44    struct ParameterBinding {
     45        llvm::Type * parameterType;
     46        std::string parameterName;
     47    };
     48   
     49   
     50   
    4551class Instance;
    4652
     
    5460    KernelBuilder(IDISA::IDISA_Builder * builder, std::string && name, const unsigned defaultBufferSize);
    5561
     62   
     63    void setInstanceParameters(std::vector<ParameterBinding> binding);
     64
    5665    unsigned addInternalState(llvm::Type * const type);
    57     unsigned addInternalState(llvm::Type * const type, std::string && name);
     66    unsigned addInternalState(llvm::Type * const type, std::string name);
    5867
    5968    void addInputStream(const unsigned fields);
    6069    void addInputStream(const unsigned fields, std::string && name);
    6170
    62     void addInputScalar(llvm::Type * const type);
    63     void addInputScalar(llvm::Type * const type, std::string && name);
    64 
    6571    unsigned addOutputStream(const unsigned fields);
    66     unsigned addOutputScalar(llvm::Type * const type);
    67 
     72
     73   
     74   
     75    llvm::Function * createInitMethod();
     76
     77   
    6878    inline llvm::Function * prepareFunction() {
    6979        return prepareFunction({0});
     
    118128    }
    119129
    120     inline llvm::Value * getInputScalar(const unsigned index) {
    121         assert (index < getNumOfInputScalars());
    122         return getInputScalarInternal(mInputScalarParam, iBuilder->getInt32(index));
    123     }
    124 
    125     inline llvm::Value * getInputScalar(disable_implicit_conversion<llvm::Value *> const index) {
    126         return getInputScalarInternal(mInputScalarParam, index);
    127     }
    128 
    129     inline unsigned getNumOfInputScalars() const {
    130         return mInputScalar.size();
    131     }
    132 
    133     inline llvm::Type * getInputScalarType() const {
    134         return mInputScalarType;
    135     }
    136 
    137130    inline llvm::Value * getOutputStream(const unsigned index) {
    138131        assert (index < getNumOfOutputStreams());
     
    152145    }
    153146
    154     inline llvm::Value * getOutputScalar(const unsigned index) {
    155         assert (index < getNumOfOutputScalars());
    156         return getOutputScalarInternal(mOutputScalarParam, iBuilder->getInt32(index));
    157     }
    158 
    159     inline llvm::Value * getOutputScalar(disable_implicit_conversion<llvm::Value *> const index) {
    160         return getOutputScalarInternal(mOutputScalarParam, index);
    161     }
    162 
    163     inline unsigned getNumOfOutputScalars() const {
    164         return mOutputScalar.size();
    165     }
    166 
    167     inline llvm::Type * getOutputScalarType() const {
    168         return mOutputStreamType;
    169     }
    170 
    171147    inline llvm::Value * getBlockNo() {
    172148        return getBlockNoInternal(mKernelStateParam);
     
    199175    llvm::Value * getInputStreamInternal(llvm::Value * const inputStreamSet, disable_implicit_conversion<llvm::Value *> index);
    200176
    201     llvm::Value * getInputScalarInternal(llvm::Value * const inputScalarSet, disable_implicit_conversion<llvm::Value *> index);
    202 
    203177    llvm::Value * getInternalStateInternal(llvm::Value * const kernelState, const std::string & name);
    204178
     
    212186
    213187    llvm::Value * getOutputStreamInternal(llvm::Value * const outputStreamSet, disable_implicit_conversion<llvm::Value *> index);
    214 
    215     llvm::Value * getOutputScalarInternal(llvm::Value * const outputScalarSet, disable_implicit_conversion<llvm::Value *> index);
    216188
    217189    llvm::Value * getBlockNoInternal(llvm::Value * const instance) {
     
    238210    llvm::Function *                                    mDoBlock;
    239211
     212    std::vector<ParameterBinding>           mInstanceParameters;
     213    unsigned                            mInstanceParametersOffset;
     214   
    240215    llvm::Type *                        mKernelStateType;
    241     llvm::Type *                        mInputScalarType;
    242216    llvm::Type *                        mInputStreamType;
    243     llvm::Type *                        mOutputScalarType;
    244217    llvm::Type *                        mOutputStreamType;
    245218
    246219    llvm::Value *                       mKernelStateParam;
    247     llvm::Value *                       mInputScalarParam;
    248220    InputStreamMap                      mInputStreamParam;
    249     llvm::Value *                       mOutputScalarParam;
    250221    llvm::Value *                       mOutputStreamParam;
    251222
    252     std::vector<llvm::Type *>           mInputScalar;
    253223    std::vector<std::string>            mInputScalarName;   
    254224    std::vector<llvm::Type *>           mInputStream;
    255225    std::vector<std::string>            mInputStreamName;
    256226    std::vector<unsigned>               mInputStreamOffsets;
    257     std::vector<llvm::Type *>           mOutputScalar;
    258227    std::vector<llvm::Type *>           mOutputStream;
    259228    std::vector<llvm::Type *>                   mInternalState;
     
    272241    return mDefaultBufferSize;
    273242}
    274 
     243   
     244llvm::Value * make_New(IDISA::IDISA_Builder * iBuilder, std::string kernel_name, std::vector<Value *> args);
     245
     246    llvm::Value * make_DoBlock_Call(IDISA::IDISA_Builder * iBuilder, std::string kernel_name, std::vector<Value *> args);
     247    llvm::Value * make_FinalBlock_Call(IDISA::IDISA_Builder * iBuilder, std::string kernel_name, std::vector<Value *> args);
     248   
    275249} // end of namespace kernel
    276250
Note: See TracChangeset for help on using the changeset viewer.