Ignore:
Timestamp:
Jul 15, 2016, 6:51:29 PM (3 years ago)
Author:
cameron
Message:

Enforce power-of-2 segment size, add getters

File:
1 edited

Legend:

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

    r5044 r5085  
    3030public:
    3131    StreamSetBuffer(IDISA::IDISA_Builder * b, StreamSetType ss_type, unsigned SegmentSize) :
    32     iBuilder(b), mStreamSetType(ss_type), mSegmentSize(SegmentSize), mStreamSetBufferPtr(nullptr) {}
     32    iBuilder(b), mStreamSetType(ss_type), mSegmentSize(SegmentSize), mStreamSetBufferPtr(nullptr) {
     33        if (((SegmentSize - 1) & SegmentSize) != 0) {
     34            throw std::runtime_error("Segment size must be a power of 2!");
     35        }
     36    }
    3337
    3438    llvm::Type * getStreamSetBlockType();
     
    4044    llvm::Value * allocateBuffer();
    4145   
     46    llvm::Value * getStreamSetBufferPtr() {return mStreamSetBufferPtr;}
     47   
     48    unsigned getSegmentSize() { return mSegmentSize; }
     49
    4250    llvm::Value * getBlockPointer(llvm::Value * blockNo);
     51   
    4352private:
    4453    IDISA::IDISA_Builder * iBuilder;
Note: See TracChangeset for help on using the changeset viewer.