Ignore:
Timestamp:
Mar 11, 2016, 4:44:53 PM (3 years ago)
Author:
nmedfort
Message:

Added ability to name internal state types; removed unnecessary predefined states. Some progress towards supporting segment size > 1

File:
1 edited

Legend:

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

    r4968 r4970  
    88#include <string>
    99#include <vector>
     10#include <boost/container/flat_map.hpp>
    1011
    1112namespace llvm {
     
    3233
    3334class KernelBuilder {
    34 
     35    using NameMap = boost::container::flat_map<std::string, unsigned>;
    3536public:
    3637    // sets name & sets internal state to the kernel superclass state
    3738    KernelBuilder(std::string name, llvm::Module * m, IDISA::IDISA_Builder * b);
    3839
    39     unsigned addInternalStateType(llvm::Type * const type);
     40    unsigned addInternalState(llvm::Type * const type);
     41    unsigned addInternalState(llvm::Type * const type, std::string name);
     42
     43    void addInputStream(const unsigned fields);
     44    void addInputStream(const unsigned fields, std::string name);
     45
     46    void addInputScalar(llvm::Type * const type);
     47    void addInputScalar(llvm::Type * const type, std::string name);
     48
     49
    4050    void addOutputStream(const unsigned fields);
    41     void addOutputAccum(llvm::Type * const type);
    42     void addInputStream(const unsigned fields, std::string name);
    43     void addInputScalar(llvm::Type * const type, std::string name);
     51    void addOutputScalar(llvm::Type * const type);
    4452
    4553    llvm::Function * prepareFunction();
    4654
    4755    void increment();
    48     void incrementCircularBuffer();
    4956
    5057    llvm::Value * getInputStream(const unsigned index, const unsigned streamOffset = 0);
     58
    5159    llvm::Value * getInputScalar(const unsigned index);
    52     llvm::Value * getKernelState(const unsigned index, const unsigned streamOffset = 0);
     60
     61    llvm::Value * getInternalState(const std::string & name, llvm::Value * const inputStruct = nullptr);
     62
     63    llvm::Value * getInternalState(const unsigned index, llvm::Value * const inputStruct = nullptr);
     64
    5365    llvm::Value * getOutputStream(const unsigned index, const unsigned streamOffset = 0);
     66
    5467    llvm::Value * getOutputScalar(const unsigned index);
    5568
     
    6982
    7083    void setInternalState(const unsigned index, llvm::Value * const value);
    71     llvm::Value * getInternalState(const unsigned index);
     84
     85    llvm::Value * getBlockIndexScalar();
    7286
    7387protected:
     
    8498    std::vector<llvm::Type *>           mOutputStreams;
    8599    std::vector<llvm::Type *>           mInputScalars;
    86     std::vector<llvm::Type *>           mOutputAccums;
     100    std::vector<llvm::Type *>           mOutputScalar;
    87101    std::vector<std::string>            mInputStreamNames;
    88102    std::vector<std::string>            mInputScalarNames;
     
    100114    llvm::Value *                       mKernelParam;
    101115    unsigned                            mSegmentIndex;
    102     unsigned                            mStartIndex;
     116    unsigned                            mBlockIndex;
     117
     118
     119    NameMap                             mStateNameMap;
     120
    103121};
    104122
     
    127145}
    128146
     147inline llvm::Value * KernelBuilder::getBlockIndexScalar() {
     148    return getInternalState(mBlockIndex);
     149}
     150
    129151#endif // KERNEL_H
Note: See TracChangeset for help on using the changeset viewer.