Ignore:
Timestamp:
Sep 22, 2017, 3:36:36 PM (2 years ago)
Author:
nmedfort
Message:

Minor bug fixes and removal of inadvertent check in for StreamSet?.cpp/h

Location:
icGREP/icgrep-devel/icgrep/kernels
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/kernels/kernel_builder.cpp

    r5646 r5647  
    133133    std::tie(port, index) = mKernel->getStreamPort(name);
    134134    const StreamSetBuffer * buf = nullptr;
    135     if (port == Kernel::Port::Input) {
    136         buf = mKernel->getInputStreamSetBuffer(name);
     135    if (port == Kernel::Port::Input) {       
    137136        const auto lookAhead = mKernel->getLookAhead(index);
    138137        if (LLVM_UNLIKELY(lookAhead != 0)) {
    139138            fromPosition = CreateAdd(ConstantInt::get(fromPosition->getType(), lookAhead), fromPosition);
    140139        }
     140        buf = mKernel->getInputStreamSetBuffer(name);
    141141    } else {
    142142        buf = mKernel->getOutputStreamSetBuffer(name);
    143143    }
     144    assert (buf);
    144145    return buf->getLinearlyAccessibleItems(this, getStreamSetBufferPtr(name), fromPosition);
    145146}
     
    149150    std::tie(port, index) = mKernel->getStreamPort(name);
    150151    const StreamSetBuffer * buf = nullptr;
    151     if (port == Kernel::Port::Input) {
    152         buf = mKernel->getInputStreamSetBuffer(name);
     152    if (port == Kernel::Port::Input) {       
    153153        const auto lookAhead = mKernel->getLookAhead(index);
    154154        if (LLVM_UNLIKELY(lookAhead != 0)) {
     
    156156            fromBlock = CreateAdd(ConstantInt::get(fromBlock->getType(), blocksAhead), fromBlock);
    157157        }
     158        buf = mKernel->getInputStreamSetBuffer(name);
    158159    } else {
    159160        buf = mKernel->getOutputStreamSetBuffer(name);
    160161    }
     162    assert (buf);
    161163    return buf->getLinearlyAccessibleBlocks(this, getStreamSetBufferPtr(name), fromBlock);
    162164}
  • icGREP/icgrep-devel/icgrep/kernels/streamset.cpp

    r5646 r5647  
    140140}
    141141
    142 Value * StreamSetBuffer::getLinearlyAccessibleItems(IDISA::IDISA_Builder * const iBuilder, Value * self, Value * fromPosition, bool reverse, const unsigned lookAhead) const {
     142Value * StreamSetBuffer::getLinearlyAccessibleItems(IDISA::IDISA_Builder * const iBuilder, Value * self, Value * fromPosition, bool reverse) const {
    143143    Constant * bufSize = iBuilder->getSize(mBufferBlocks * iBuilder->getStride());
    144144    Value * bufRem = iBuilder->CreateURem(fromPosition, bufSize);
     
    149149}
    150150
    151 Value * StreamSetBuffer::getLinearlyAccessibleBlocks(IDISA::IDISA_Builder * const iBuilder, Value * self, Value * fromBlock, bool reverse, const unsigned lookAhead) const {
     151Value * StreamSetBuffer::getLinearlyAccessibleBlocks(IDISA::IDISA_Builder * const iBuilder, Value * self, Value * fromBlock, bool reverse) const {
    152152    Constant * bufBlocks = iBuilder->getSize(mBufferBlocks);
    153153    Value * bufRem = iBuilder->CreateURem(fromBlock, bufBlocks);
     
    264264}
    265265
    266 Value * SourceBuffer::getLinearlyAccessibleItems(IDISA::IDISA_Builder * const iBuilder, Value * self, Value * fromPosition, bool reverse, const unsigned lookAhead) const {
     266Value * SourceBuffer::getLinearlyAccessibleItems(IDISA::IDISA_Builder * const iBuilder, Value * self, Value * fromPosition, bool reverse) const {
    267267    if (reverse) report_fatal_error("SourceBuffer cannot be accessed in reverse");
    268268    return iBuilder->CreateSub(getCapacity(iBuilder, self), fromPosition);
    269269}
    270270
    271 Value * SourceBuffer::getLinearlyAccessibleBlocks(IDISA::IDISA_Builder * const iBuilder, Value * self, Value * fromBlock, bool reverse, const unsigned lookAhead) const {
     271Value * SourceBuffer::getLinearlyAccessibleBlocks(IDISA::IDISA_Builder * const iBuilder, Value * self, Value * fromBlock, bool reverse) const {
    272272    if (reverse) report_fatal_error("SourceBuffer cannot be accessed in reverse");
    273273    return iBuilder->CreateSub(iBuilder->CreateUDiv(getCapacity(iBuilder, self), iBuilder->getSize(iBuilder->getBitBlockWidth())), fromBlock);
     
    301301}
    302302
    303 Value * ExternalBuffer::getLinearlyAccessibleItems(IDISA::IDISA_Builder * const, Value *, Value *, bool, const unsigned) const {
     303Value * ExternalBuffer::getLinearlyAccessibleItems(IDISA::IDISA_Builder * const, Value *, Value *, bool) const {
    304304    report_fatal_error("External buffers: getLinearlyAccessibleItems is not supported.");
    305305}
     
    591591}
    592592
    593 Value * ExpandableBuffer::getLinearlyAccessibleItems(IDISA::IDISA_Builder * const, Value *, Value *, bool, const unsigned) const {
     593Value * ExpandableBuffer::getLinearlyAccessibleItems(IDISA::IDISA_Builder * const, Value *, Value *, bool) const {
    594594    report_fatal_error("Expandable buffers: getLinearlyAccessibleItems is not supported.");
    595595}
     
    682682
    683683
    684 Value * DynamicBuffer::getLinearlyAccessibleItems(IDISA::IDISA_Builder * const b, Value * handle, Value * fromPosition, bool reverse, const unsigned lookAhead) const {
     684Value * DynamicBuffer::getLinearlyAccessibleItems(IDISA::IDISA_Builder * const b, Value * handle, Value * fromPosition, bool reverse) const {
    685685    Constant * blockSize = b->getSize(b->getBitBlockWidth());
    686686    Value * const bufBlocks = b->CreateLoad(b->CreateGEP(handle, {b->getInt32(0), b->getInt32(int(Field::WorkingBlocks))}));
     
    699699}
    700700
    701 Value * DynamicBuffer::getLinearlyAccessibleBlocks(IDISA::IDISA_Builder * const b, Value * handle, Value * fromBlock, bool reverse, const unsigned lookAhead) const {
     701Value * DynamicBuffer::getLinearlyAccessibleBlocks(IDISA::IDISA_Builder * const b, Value * handle, Value * fromBlock, bool reverse) const {
    702702    Value * const bufBlocks = b->CreateLoad(b->CreateGEP(handle, {b->getInt32(0), b->getInt32(int(Field::WorkingBlocks))}));
    703703    Value * bufRem = b->CreateURem(fromBlock, bufBlocks);
  • icGREP/icgrep-devel/icgrep/kernels/streamset.h

    r5646 r5647  
    8383   
    8484    // The number of items that cam be linearly accessed from a given logical stream position.
    85     virtual llvm::Value * getLinearlyAccessibleItems(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * fromPosition, bool reverse = false, const unsigned lookAhead = 0) const;
    86    
    87     virtual llvm::Value * getLinearlyAccessibleBlocks(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * fromBlock, bool reverse = false, const unsigned lookAhead = 0) const;
     85    virtual llvm::Value * getLinearlyAccessibleItems(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * fromPosition, bool reverse = false) const;
     86   
     87    virtual llvm::Value * getLinearlyAccessibleBlocks(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * fromBlock, bool reverse = false) const;
    8888   
    8989    void createBlockCopy(IDISA::IDISA_Builder * const iBuilder, llvm::Value * targetBlockPtr, llvm::Value * sourceBlockPtr, llvm::Value * blocksToCopy) const;
     
    163163    llvm::Value * getCapacity(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self) const override;
    164164   
    165     llvm::Value * getLinearlyAccessibleItems(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * fromPosition, bool reverse = false, const unsigned lookAhead = 0) const override;
    166    
    167     llvm::Value * getLinearlyAccessibleBlocks(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * fromBlock, bool reverse = false, const unsigned lookAhead = 0) const override;
     165    llvm::Value * getLinearlyAccessibleItems(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * fromPosition, bool reverse = false) const override;
     166   
     167    llvm::Value * getLinearlyAccessibleBlocks(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * fromBlock, bool reverse = false) const override;
    168168
    169169    llvm::Type * getStreamSetBlockType() const override;
     
    191191    ExternalBuffer(const std::unique_ptr<kernel::KernelBuilder> & b, llvm::Type * type, llvm::Value * addr, unsigned AddressSpace = 0);
    192192
    193     llvm::Value * getLinearlyAccessibleItems(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * fromPosition, bool reverse = false, const unsigned lookAhead = 0) const override;
     193    llvm::Value * getLinearlyAccessibleItems(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * fromPosition, bool reverse = false) const override;
    194194
    195195    void allocateBuffer(const std::unique_ptr<kernel::KernelBuilder> & iBuilder) override;
     
    291291    llvm::Value * getStreamPackPtr(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * streamIndex, llvm::Value * blockIndex, llvm::Value * packIndex, const bool readOnly) const override;
    292292
    293     llvm::Value * getLinearlyAccessibleItems(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * fromPosition, bool reverse = false, const unsigned lookAhead = 0) const override;
     293    llvm::Value * getLinearlyAccessibleItems(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * fromPosition, bool reverse = false) const override;
    294294
    295295    llvm::Value * getStreamSetCount(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self) const override;
     
    322322    DynamicBuffer(const std::unique_ptr<kernel::KernelBuilder> & b, llvm::Type * type, size_t initialCapacity, size_t overflowBlocks = 0, unsigned swizzleFactor = 1, unsigned addrSpace = 0);
    323323   
    324     llvm::Value * getLinearlyAccessibleItems(IDISA::IDISA_Builder * const b, llvm::Value * handle, llvm::Value * fromPosition, bool reverse = false, const unsigned lookAhead = 0) const override;
    325    
    326     llvm::Value * getLinearlyAccessibleBlocks(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * fromBlock, bool reverse = false, const unsigned lookAhead = 0) const override;
     324    llvm::Value * getLinearlyAccessibleItems(IDISA::IDISA_Builder * const b, llvm::Value * handle, llvm::Value * fromPosition, bool reverse = false) const override;
     325   
     326    llvm::Value * getLinearlyAccessibleBlocks(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * fromBlock, bool reverse = false) const override;
    327327
    328328    llvm::Value * getLinearlyWritableItems(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * fromPosition, bool reverse = false) const override;
Note: See TracChangeset for help on using the changeset viewer.