Ignore:
Timestamp:
Nov 6, 2016, 8:37:11 PM (3 years ago)
Author:
nmedfort
Message:

Initial work on adding types to PabloAST and mutable Var objects.

File:
1 edited

Legend:

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

    r5174 r5202  
    1111#include <llvm/IR/Type.h>
    1212#include <IDISA/idisa_builder.h>
    13 #include "streamset.h"
     13#include <kernels/streamset.h>
    1414
     15struct Binding {
     16    llvm::Type * type;
     17    std::string name;
    1518
    16 struct ScalarBinding {
    17     llvm::Type * scalarType;
    18     std::string scalarName;
     19    Binding(llvm::Type * type, std::string name)
     20    : type(type)
     21    , name(std::move(name)) {
     22
     23    }
    1924};
    2025
    21 struct StreamSetBinding {
    22     parabix::StreamSetType ssType;
    23     std::string ssName;
    24 };
    25    
    26 const std::string init_suffix = "_Init";
    27 const std::string doBlock_suffix = "_DoBlock";
    28 const std::string doSegment_suffix = "_DoSegment";
    29 const std::string finalBlock_suffix = "_FinalBlock";
    30 const std::string accumulator_infix = "_get_";
     26static const std::string init_suffix = "_Init";
     27static const std::string doBlock_suffix = "_DoBlock";
     28static const std::string doSegment_suffix = "_DoSegment";
     29static const std::string finalBlock_suffix = "_FinalBlock";
     30static const std::string accumulator_infix = "_get_";
    3131
    3232class KernelInterface {
     
    4444    std::string & getName() { return mKernelName;}
    4545   
    46     std::vector<StreamSetBinding> getStreamInputs() {return mStreamSetInputs;}
    47     std::vector<StreamSetBinding> getStreamOutputs() {return mStreamSetOutputs;}
    48     std::vector<ScalarBinding> getScalarInputs() { return mScalarInputs;}
    49     std::vector<ScalarBinding> getScalarOutputs() { return mScalarOutputs;}
     46    std::vector<Binding> getStreamInputs() {return mStreamSetInputs;}
     47    std::vector<Binding> getStreamOutputs() {return mStreamSetOutputs;}
     48    std::vector<Binding> getScalarInputs() { return mScalarInputs;}
     49    std::vector<Binding> getScalarOutputs() { return mScalarOutputs;}
    5050   
    5151   
     
    5959    llvm::Value * createGetAccumulatorCall(llvm::Value * kernelInstance, std::string accumName);
    6060   
    61     unsigned getLookAhead() { return mLookAheadPositions; }
     61    unsigned getLookAhead() const {
     62        return mLookAheadPositions;
     63    }
    6264   
    63    
     65    IDISA::IDISA_Builder * getBuilder() const {
     66        return iBuilder;
     67    }
     68
    6469    virtual llvm::Value * getLogicalSegmentNo(llvm::Value * kernelInstance) = 0;
    6570    virtual llvm::Value * getProcessedItemCount(llvm::Value * kernelInstance) = 0;
     
    6772    virtual llvm::Value * getTerminationSignal(llvm::Value * kernelInstance) = 0;
    6873   
     74    void setLookAhead(unsigned lookAheadPositions) {
     75        mLookAheadPositions = lookAheadPositions;
     76    }
     77
     78    llvm::Value * createDoBlockCall(llvm::Value * kernelInstance);
     79
    6980protected:
     81
    7082    KernelInterface(IDISA::IDISA_Builder * builder,
    7183                    std::string kernelName,
    72                     std::vector<StreamSetBinding> stream_inputs,
    73                     std::vector<StreamSetBinding> stream_outputs,
    74                     std::vector<ScalarBinding> scalar_parameters,
    75                     std::vector<ScalarBinding> scalar_outputs,
    76                     std::vector<ScalarBinding> internal_scalars) :
     84                    std::vector<Binding> stream_inputs,
     85                    std::vector<Binding> stream_outputs,
     86                    std::vector<Binding> scalar_inputs,
     87                    std::vector<Binding> scalar_outputs,
     88                    std::vector<Binding> internal_scalars) :
    7789    iBuilder(builder),
    7890    mKernelName(kernelName),
    7991    mStreamSetInputs(stream_inputs),
    8092    mStreamSetOutputs(stream_outputs),
    81     mScalarInputs(scalar_parameters),
     93    mScalarInputs(scalar_inputs),
    8294    mScalarOutputs(scalar_outputs),
    8395    mInternalScalars(internal_scalars),
     
    8597    mLookAheadPositions(0) {}
    8698   
     99protected:
    87100   
    88    
    89     IDISA::IDISA_Builder * iBuilder;
     101    IDISA::IDISA_Builder * const iBuilder;
    90102    std::string mKernelName;
    91     std::vector<StreamSetBinding> mStreamSetInputs;
    92     std::vector<StreamSetBinding> mStreamSetOutputs;
    93     std::vector<ScalarBinding> mScalarInputs;
    94     std::vector<ScalarBinding> mScalarOutputs;
    95     std::vector<ScalarBinding> mInternalScalars;
     103    std::vector<Binding> mStreamSetInputs;
     104    std::vector<Binding> mStreamSetOutputs;
     105    std::vector<Binding> mScalarInputs;
     106    std::vector<Binding> mScalarOutputs;
     107    std::vector<Binding> mInternalScalars;
    96108    llvm::Type * mKernelStateType;
    97109    unsigned mLookAheadPositions;
    98110   
    99     void setLookAhead(unsigned lookAheadPositions) {mLookAheadPositions = lookAheadPositions;}
    100     llvm::Value * createDoBlockCall(llvm::Value * kernelInstance);
    101 
    102111};
    103112#endif
Note: See TracChangeset for help on using the changeset viewer.