Ignore:
Timestamp:
May 3, 2017, 1:13:04 PM (2 years ago)
Author:
nmedfort
Message:

partial refactoring check in with change for Linda.

File:
1 edited

Legend:

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

    r5429 r5431  
    5757    }
    5858
    59     virtual void allocateBuffer();
    60 
    61     virtual void releaseBuffer(llvm::Value * self) const;
    62 
    63     virtual llvm::Value * getStreamBlockPtr(llvm::Value * self, llvm::Value * streamIndex, llvm::Value * blockIndex, const bool readOnly) const;
    64 
    65     virtual llvm::Value * getStreamPackPtr(llvm::Value * self, llvm::Value * streamIndex, llvm::Value * blockIndex, llvm::Value * packIndex, const bool readOnly) const;
    66    
    67     virtual llvm::Value * getStreamSetCount(llvm::Value * self) const;
    68 
    69     llvm::Value * getRawItemPointer(llvm::Value * self, llvm::Value * streamIndex, llvm::Value * absolutePosition) const;
    70 
    71 
    72     virtual void setBaseAddress(llvm::Value * self, llvm::Value * addr) const;
    73 
    74     virtual void setBufferedSize(llvm::Value * self, llvm::Value * size) const;
    75 
    76     virtual llvm::Value * getBufferedSize(llvm::Value * self) const;
     59    virtual void allocateBuffer(IDISA::IDISA_Builder * const iBuilder);
     60
     61    virtual void releaseBuffer(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self) const;
     62
     63    virtual llvm::Value * getStreamBlockPtr(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * streamIndex, llvm::Value * blockIndex, const bool readOnly) const;
     64
     65    virtual llvm::Value * getStreamPackPtr(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * streamIndex, llvm::Value * blockIndex, llvm::Value * packIndex, const bool readOnly) const;
     66   
     67    virtual llvm::Value * getStreamSetCount(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self) const;
     68
     69    llvm::Value * getRawItemPointer(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * streamIndex, llvm::Value * absolutePosition) const;
     70
     71    virtual void setBaseAddress(IDISA::IDISA_Builder * const iBuilder, llvm::Value * addr, llvm::Value *) const;
     72
     73    virtual void setBufferedSize(IDISA::IDISA_Builder * const iBuilder, llvm::Value * size, llvm::Value *) const;
     74
     75    virtual llvm::Value * getBufferedSize(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self) const;
    7776
    7877    // The number of items that cam be linearly accessed from a given logical stream position.
    79     virtual llvm::Value * getLinearlyAccessibleItems(llvm::Value * self, llvm::Value * fromPosition) const;
    80 
    81     virtual llvm::Value * getLinearlyAccessibleBlocks(llvm::Value * self, llvm::Value * fromBlock) const;
    82 
    83     virtual void reserveBytes(llvm::Value * self, llvm::Value * requested) const;
     78    virtual llvm::Value * getLinearlyAccessibleItems(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * fromPosition) const;
     79
     80    virtual llvm::Value * getLinearlyAccessibleBlocks(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * fromBlock) const;
     81
     82    virtual void reserveBytes(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * requested) const;
    8483
    8584    virtual ~StreamSetBuffer() = 0;
     
    9594protected:
    9695
    97     StreamSetBuffer(BufferKind k, IDISA::IDISA_Builder * b, llvm::Type * baseType, llvm::Type * resolvedType, unsigned blocks, unsigned AddressSpace);
     96    StreamSetBuffer(BufferKind k, llvm::Type * baseType, llvm::Type * resolvedType, unsigned blocks, unsigned AddressSpace);
    9897
    9998    // Get the buffer pointer for a given block of the stream.
    100     virtual llvm::Value * getStreamSetBlockPtr(llvm::Value * self, llvm::Value * blockNo) const = 0;
     99    virtual llvm::Value * getStreamSetBlockPtr(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * blockNo) const = 0;
    101100
    102101    bool isCapacityGuaranteed(const llvm::Value * const index, const size_t capacity) const;
    103102
    104     llvm::Value * modByBufferBlocks(llvm::Value * const offset) const;
    105 
    106     virtual llvm::Value * getBaseAddress(llvm::Value * self) const;
     103    llvm::Value * modByBufferBlocks(IDISA::IDISA_Builder * const iBuilder, llvm::Value * const offset) const;
     104
     105    virtual llvm::Value * getBaseAddress(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self) const;
    107106
    108107    void setProducer(kernel::KernelBuilder * const producer) {
     
    118117protected:
    119118    const BufferKind                        mBufferKind;
    120     IDISA::IDISA_Builder * const            iBuilder;
    121119    llvm::Type * const                      mType;
    122120    const size_t                            mBufferBlocks;
     
    139137protected:
    140138
    141     llvm::Value * getStreamSetBlockPtr(llvm::Value * self, llvm::Value * blockNo) const override;
     139    llvm::Value * getStreamSetBlockPtr(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * blockNo) const override;
    142140};
    143141
     
    150148    SourceBuffer(IDISA::IDISA_Builder * b, llvm::Type * type, unsigned AddressSpace = 0);
    151149
    152     void setBaseAddress(llvm::Value * self, llvm::Value * addr) const override;
    153 
    154     void setBufferedSize(llvm::Value * self, llvm::Value * size) const override;
    155 
    156     llvm::Value * getBufferedSize(llvm::Value * self) const override;
    157 
    158     llvm::Value * getLinearlyAccessibleItems(llvm::Value * self, llvm::Value * fromPosition) const override;
    159 
    160 protected:
    161 
    162     llvm::Value * getBaseAddress(llvm::Value * self) const override;
    163 
    164     llvm::Value * getStreamSetBlockPtr(llvm::Value * self, llvm::Value * blockNo) const override;
     150    void setBaseAddress(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * addr) const override;
     151
     152    void setBufferedSize(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * size) const override;
     153
     154    llvm::Value * getBufferedSize(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self) const override;
     155
     156    llvm::Value * getLinearlyAccessibleItems(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * fromPosition) const override;
     157
     158protected:
     159
     160    llvm::Value * getBaseAddress(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self) const override;
     161
     162    llvm::Value * getStreamSetBlockPtr(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * blockNo) const override;
    165163
    166164};
     
    175173
    176174    // Can't allocate - raise an error. */
    177     void allocateBuffer() override;
    178 
    179     llvm::Value * getLinearlyAccessibleItems(llvm::Value * self, llvm::Value * fromPosition) const override;
    180 
    181 protected:
    182     llvm::Value * getStreamSetBlockPtr(llvm::Value * self, llvm::Value * blockNo) const override;
     175    void allocateBuffer(IDISA::IDISA_Builder * const iBuilder) override;
     176
     177    llvm::Value * getLinearlyAccessibleItems(IDISA::IDISA_Builder * const iBuilder, llvm::Value * fromPosition, llvm::Value *) const override;
     178
     179protected:
     180    llvm::Value * getStreamSetBlockPtr(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * blockNo) const override;
    183181};
    184182
     
    192190
    193191protected:
    194     llvm::Value * getStreamSetBlockPtr(llvm::Value * self, llvm::Value * blockIndex) const override;
     192    llvm::Value * getStreamSetBlockPtr(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * blockIndex) const override;
    195193};
    196194   
     
    209207    CircularCopybackBuffer(IDISA::IDISA_Builder * b, llvm::Type * type, size_t bufferBlocks, size_t overflowBlocks, unsigned AddressSpace = 0);
    210208
    211     void allocateBuffer() override;
     209    void allocateBuffer(IDISA::IDISA_Builder * const iBuilder) override;
    212210   
    213211    // Generate copyback code for the given number of overflowItems.
    214     void createCopyBack(llvm::Value * self, llvm::Value * overflowItems) const;
     212    void createCopyBack(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * overflowItems) const;
    215213       
    216214protected:
    217     llvm::Value * getStreamSetBlockPtr(llvm::Value * self, llvm::Value * blockIndex) const override;
     215    llvm::Value * getStreamSetBlockPtr(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * blockIndex) const override;
    218216private:
    219217    size_t mOverflowBlocks;
     
    227225    SwizzledCopybackBuffer(IDISA::IDISA_Builder * b, llvm::Type * type, size_t bufferBlocks, size_t overflowBlocks, unsigned fieldwidth = 64, unsigned AddressSpace = 0);
    228226   
    229     void allocateBuffer() override;
     227    void allocateBuffer(IDISA::IDISA_Builder * const iBuilder) override;
    230228   
    231229    // Generate copyback code for the given number of overflowItems.
    232     void createCopyBack(llvm::Value * self, llvm::Value * overflowItems) const;
    233 protected:
    234     llvm::Value * getStreamSetBlockPtr(llvm::Value * self, llvm::Value * blockIndex) const override;
     230    void createCopyBack(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * overflowItems) const;
     231protected:
     232    llvm::Value * getStreamSetBlockPtr(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * blockIndex) const override;
    235233private:
    236234    size_t mOverflowBlocks;
     
    248246    ExpandableBuffer(IDISA::IDISA_Builder * b, llvm::Type * type, size_t bufferBlocks, unsigned AddressSpace = 0);
    249247
    250     llvm::Value * getStreamBlockPtr(llvm::Value * self, llvm::Value * streamIndex, llvm::Value * blockIndex, const bool readOnly) const override;
    251 
    252     llvm::Value * getStreamPackPtr(llvm::Value * self, llvm::Value * streamIndex, llvm::Value * blockIndex, llvm::Value * packIndex, const bool readOnly) const override;
    253 
    254     llvm::Value * getLinearlyAccessibleItems(llvm::Value * self, llvm::Value * fromPosition) const override;
    255 
    256     void allocateBuffer() override;
    257 
    258     llvm::Value * getStreamSetCount(llvm::Value * self) const override;
    259 
    260     void releaseBuffer(llvm::Value * self) const override;
    261 
    262 protected:
    263 
    264     llvm::Value * getBaseAddress(llvm::Value * self) const override;
    265 
    266     llvm::Value * getStreamSetBlockPtr(llvm::Value * self, llvm::Value * blockIndex) const override;
    267 
    268 private:
    269 
    270     std::pair<llvm::Value *, llvm::Value *> getInternalStreamBuffer(llvm::Value * self, llvm::Value * streamIndex, llvm::Value * blockIndex, const bool readOnly) const;
     248    llvm::Value * getStreamBlockPtr(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * streamIndex, llvm::Value * blockIndex, const bool readOnly) const override;
     249
     250    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;
     251
     252    llvm::Value * getLinearlyAccessibleItems(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * fromPosition) const override;
     253
     254    void allocateBuffer(IDISA::IDISA_Builder * const iBuilder) override;
     255
     256    llvm::Value * getStreamSetCount(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self) const override;
     257
     258    void releaseBuffer(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self) const override;
     259
     260protected:
     261
     262    llvm::Value * getBaseAddress(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self) const override;
     263
     264    llvm::Value * getStreamSetBlockPtr(IDISA::IDISA_Builder * const iBuilder, llvm::Value * blockIndex, llvm::Value *) const override;
     265
     266private:
     267
     268    std::pair<llvm::Value *, llvm::Value *> getInternalStreamBuffer(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * streamIndex, llvm::Value * blockIndex, const bool readOnly) const;
    271269
    272270private:
Note: See TracChangeset for help on using the changeset viewer.