Ignore:
Timestamp:
May 4, 2017, 10:16:15 AM (2 years ago)
Author:
cameron
Message:

getLinearlyWritableItems/Blocks includes buffer space plus overflow blocks; more processing rate functions

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

Legend:

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

    r5433 r5434  
    3434    enum class ProcessingRateKind : uint8_t { FixedRatio, RoundUp, Add1, MaxRatio, Unknown };
    3535    ProcessingRateKind getKind() const {return mKind;}
     36    bool isFixedRatio() const {return mKind == ProcessingRateKind::FixedRatio;}
     37    bool isMaxRatio() const {return mKind == ProcessingRateKind::MaxRatio;}
    3638    bool isExact() const {return (mKind == ProcessingRateKind::FixedRatio)||(mKind == ProcessingRateKind::RoundUp)||(mKind == ProcessingRateKind::Add1) ;}
    37     bool isUnknown() const { return !isExact(); }
     39    bool isUnknownRate() const { return mKind == ProcessingRateKind::Unknown; }
    3840    llvm::Value * CreateRatioCalculation(IDISA::IDISA_Builder * b, llvm::Value * principalInputItems, llvm::Value * doFinal = nullptr) const;
    39     llvm::Value * CreateMaxReferenceItemsCalculation(IDISA::IDISA_Builder * b, llvm::Value * outputItems, llvm::Value * doFinal) const;
     41    llvm::Value * CreateMaxReferenceItemsCalculation(IDISA::IDISA_Builder * b, llvm::Value * outputItems, llvm::Value * doFinal = nullptr) const;
    4042    friend ProcessingRate FixedRatio(unsigned strmItemsPer, unsigned perPrincipalInputItems, std::string && referenceStreamSet);
    4143    friend ProcessingRate MaxRatio(unsigned strmItemsPer, unsigned perPrincipalInputItems, std::string && referenceStreamSet);
     
    4345    friend ProcessingRate Add1(std::string && referenceStreamSet);
    4446    friend ProcessingRate UnknownRate();
     47    uint16_t getRatioNumerator() const { return mRatioNumerator;}
     48    uint16_t getRatioDenominator() const { return mRatioDenominator;}
    4549    std::string referenceStreamSet() const { return mReferenceStreamSet;}
    4650protected:
  • icGREP/icgrep-devel/icgrep/kernels/kernel.cpp

    r5431 r5434  
    9595        }
    9696        mScalarInputs.emplace_back(mStreamSetInputBuffers[i]->getPointerType(), mStreamSetInputs[i].name + BUFFER_PTR_SUFFIX);
    97         if ((i == 0) || mStreamSetInputs[i].rate.isUnknown()) {
     97        if ((i == 0) || !mStreamSetInputs[i].rate.isExact()) {
    9898            addScalar(iBuilder->getSizeTy(), mStreamSetInputs[i].name + PROCESSED_ITEM_COUNT_SUFFIX);
    9999        }       
  • icGREP/icgrep-devel/icgrep/kernels/streamset.cpp

    r5432 r5434  
    129129    Constant * bufBlocks = iBuilder->getSize(mBufferBlocks);
    130130    return iBuilder->CreateSub(bufBlocks, iBuilder->CreateURem(fromBlock, bufBlocks));
     131}
     132
     133Value * StreamSetBuffer::getLinearlyWritableItems(IDISA_Builder * const iBuilder, Value * self, Value * fromPosition) const {
     134    return getLinearlyAccessibleItems(iBuilder, self, fromPosition);
     135}
     136
     137Value * StreamSetBuffer::getLinearlyWritableBlocks(IDISA_Builder * const iBuilder, Value * self, Value * fromBlock) const {
     138    return getLinearlyAccessibleBlocks(iBuilder, self, fromBlock);
    131139}
    132140
     
    245253Value * CircularCopybackBuffer::getStreamSetBlockPtr(IDISA_Builder * const iBuilder, Value * self, Value * blockIndex) const {
    246254    return iBuilder->CreateGEP(getBaseAddress(iBuilder, self), modByBufferBlocks(iBuilder, blockIndex));
     255}
     256
     257Value * CircularCopybackBuffer::getLinearlyWritableItems(IDISA_Builder * const iBuilder, Value * self, Value * fromPosition) const {
     258    return iBuilder->CreateAdd(getLinearlyAccessibleItems(iBuilder, self, fromPosition), iBuilder->getSize(mOverflowBlocks * iBuilder->getBitBlockWidth()));
     259}
     260
     261Value * CircularCopybackBuffer::getLinearlyWritableBlocks(IDISA_Builder * const iBuilder, Value * self, Value * fromBlock) const {
     262    return iBuilder->CreateAdd(getLinearlyAccessibleBlocks(iBuilder, self, fromBlock), iBuilder->getSize(mOverflowBlocks));
    247263}
    248264
     
    296312}
    297313
     314Value * SwizzledCopybackBuffer::getLinearlyWritableItems(IDISA_Builder * const iBuilder, Value * self, Value * fromPosition) const {
     315    return iBuilder->CreateAdd(getLinearlyAccessibleItems(iBuilder, self, fromPosition), iBuilder->getSize(mOverflowBlocks * iBuilder->getBitBlockWidth()));
     316}
     317
     318Value * SwizzledCopybackBuffer::getLinearlyWritableBlocks(IDISA_Builder * const iBuilder, Value * self, Value * fromBlock) const {
     319    return iBuilder->CreateAdd(getLinearlyAccessibleBlocks(iBuilder, self, fromBlock), iBuilder->getSize(mOverflowBlocks));
     320}
     321
    298322// Expandable Buffer
    299323
  • icGREP/icgrep-devel/icgrep/kernels/streamset.h

    r5432 r5434  
    7777    // The number of items that cam be linearly accessed from a given logical stream position.
    7878    virtual llvm::Value * getLinearlyAccessibleItems(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * fromPosition) const;
    79 
     79   
    8080    virtual llvm::Value * getLinearlyAccessibleBlocks(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * fromBlock) const;
     81   
     82    virtual llvm::Value * getLinearlyWritableItems(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * fromPosition) const;
     83   
     84    virtual llvm::Value * getLinearlyWritableBlocks(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * fromBlock) const;
    8185   
    8286    virtual void createBlockAlignedCopy(IDISA::IDISA_Builder * const iBuilder, llvm::Value * targetBlockPtr, llvm::Value * sourceBlockPtr, llvm::Value * itemsToCopy) const;
     
    214218    void createCopyBack(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * overflowItems) const;
    215219       
     220    llvm::Value * getLinearlyWritableItems(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * fromPosition) const override;
     221   
     222    llvm::Value * getLinearlyWritableBlocks(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * fromBlock) const override;
     223   
    216224protected:
    217225    llvm::Value * getStreamSetBlockPtr(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * blockIndex) const override;
     
    233241    // Generate copyback code for the given number of overflowItems.
    234242    void createCopyBack(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * overflowItems) const;
     243   
     244    llvm::Value * getLinearlyWritableItems(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * fromPosition) const override;
     245   
     246    llvm::Value * getLinearlyWritableBlocks(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * fromBlock) const override;
    235247   
    236248protected:
Note: See TracChangeset for help on using the changeset viewer.