Ignore:
Timestamp:
Sep 18, 2017, 8:37:23 AM (20 months ago)
Author:
cameron
Message:

Modularizing copyBack support

File:
1 edited

Legend:

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

    r5639 r5641  
    5757        return mStreamSetBufferPtr;
    5858    }
    59 
     59   
    6060    virtual llvm::Type * getStreamSetBlockType() const;
    6161   
     
    9494   
    9595    virtual llvm::Value * getLinearlyWritableBlocks(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * fromBlock, bool reverse = false) const;
     96   
     97    virtual bool supportsCopyBack() const {
     98        return false;  // Overridden to return true by buffer types that support copyback.
     99    }
     100    virtual void genCopyBackLogic(IDISA::IDISA_Builder * const b, llvm::Value * handle, llvm::Value * priorProduced, llvm::Value * newProduced, const std::string);
    96101   
    97102    virtual ~StreamSetBuffer() = 0;
     
    227232    CircularCopybackBuffer(const std::unique_ptr<kernel::KernelBuilder> & b, llvm::Type * type, size_t bufferBlocks, size_t overflowBlocks, unsigned AddressSpace = 0);
    228233   
    229     // Generate copyback code for the given number of overflowItems.
    230     void createCopyBack(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * overflowItems) const;
    231        
    232234    llvm::Value * getLinearlyWritableItems(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * fromPosition, bool reverse = false) const override;
    233235   
     
    236238    void allocateBuffer(const std::unique_ptr<kernel::KernelBuilder> & iBuilder) override;
    237239
     240    bool supportsCopyBack() const override {
     241        return mOverflowBlocks > 0; 
     242    }
     243   
     244    void genCopyBackLogic(IDISA::IDISA_Builder * const b, llvm::Value * handle, llvm::Value * priorProduced, llvm::Value * newProduced, const std::string) override;
     245   
     246   
    238247private:
    239248    size_t mOverflowBlocks;
     
    249258    void createBlockAlignedCopy(IDISA::IDISA_Builder * const iBuilder, llvm::Value * targetBlockPtr, llvm::Value * sourceBlockPtr, llvm::Value * itemsToCopy) const override;
    250259
    251     // Generate copyback code for the given number of overflowItems.
    252     void createCopyBack(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * overflowItems) const;
    253    
    254260    llvm::Value * getLinearlyWritableItems(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * fromPosition, bool reverse = false) const override;
    255261   
     
    257263   
    258264    void allocateBuffer(const std::unique_ptr<kernel::KernelBuilder> & iBuilder) override;
     265
     266    bool supportsCopyBack() const override {
     267        return mOverflowBlocks > 0; 
     268    }
     269   
     270    void genCopyBackLogic(IDISA::IDISA_Builder * const b, llvm::Value * handle, llvm::Value * priorProduced, llvm::Value * newProduced, const std::string) override;
    259271
    260272protected:
     
    314326    llvm::Value * getLinearlyAccessibleBlocks(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * fromBlock, bool reverse = false) const override;
    315327
    316     virtual llvm::Value * getLinearlyWritableItems(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * fromPosition, bool reverse = false) const;
     328    llvm::Value * getLinearlyWritableItems(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * fromPosition, bool reverse = false) const override;
    317329   
    318330    void allocateBuffer(const std::unique_ptr<kernel::KernelBuilder> & b) override;
     
    326338    void doubleCapacity(IDISA::IDISA_Builder * const b, llvm::Value * handle);
    327339
     340    bool supportsCopyBack() const override {
     341        return mOverflowBlocks > 0; 
     342    }
     343       
     344    void genCopyBackLogic(IDISA::IDISA_Builder * const b, llvm::Value * handle, llvm::Value * priorProduced, llvm::Value * newProduced, const std::string) override;
    328345
    329346protected:
Note: See TracChangeset for help on using the changeset viewer.