Changeset 5184 for icGREP/icgrep-devel


Ignore:
Timestamp:
Oct 6, 2016, 9:21:59 AM (3 years ago)
Author:
cameron
Message:

Streamset refactoring

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

Legend:

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

    r5109 r5184  
    7474    Value * counts = partial_sum_popcount(iBuilder, mDeletionFieldWidth, iBuilder->simd_not(del_mask));
    7575    iBuilder->CreateBlockAlignedStore(iBuilder->bitCast(counts), delCountBlock, {iBuilder->getInt32(0), iBuilder->getInt32(0)});
    76    
     76    /* Stream deletion has only been applied within fields; the actual number of data items
     77     * has not yet changed.   */
     78    Value * produced = getProducedItemCount(self);
     79    produced = iBuilder->CreateAdd(produced, ConstantInt::get(iBuilder->getSizeTy(), iBuilder->getStride()));
     80    setProducedItemCount(self, produced);   
    7781    iBuilder->CreateRetVoid();
    7882    iBuilder->restoreIP(savePoint);
     
    98102    iBuilder->CreateBlockAlignedStore(iBuilder->CreateOr(EOF_del, delmaskVal), delmaskPtr);
    99103    iBuilder->CreateCall(doBlockFunction, {self});
     104    /* Adjust the produced item count */
     105    Value * produced = getProducedItemCount(self);
     106    produced = iBuilder->CreateSub(produced, ConstantInt::get(iBuilder->getSizeTy(), iBuilder->getStride()));
     107    setProducedItemCount(self, iBuilder->CreateAdd(produced, remainingBytes));
     108
    100109    iBuilder->CreateRetVoid();
    101110    iBuilder->restoreIP(savePoint);
  • icGREP/icgrep-devel/icgrep/kernels/streamset.cpp

    r5174 r5184  
    2121
    2222llvm::PointerType * StreamSetBuffer::getStreamBufferPointerType() {
    23     return PointerType::get(mStreamSetType.getStreamSetBlockType(iBuilder), 0);
     23    return PointerType::get(mStreamSetType.getStreamSetBlockType(iBuilder), mAddrSpace);
    2424}
    2525
     
    101101}
    102102
    103 llvm::PointerType * ExternalFileBuffer::getStreamBufferPointerType() {
    104     return PointerType::get(mStreamSetType.getStreamSetBlockType(iBuilder), mAddrSpace);
    105 }
    106 
    107103llvm::Value * ExternalFileBuffer::allocateBuffer() {
    108104    throw std::runtime_error("External buffers cannot be allocated.");
  • icGREP/icgrep-devel/icgrep/kernels/streamset.h

    r5175 r5184  
    3636    inline StreamSetType& getBufferStreamSetType() {return mStreamSetType;}
    3737
    38     virtual llvm::PointerType * getStreamBufferPointerType();
     38    llvm::PointerType * getStreamBufferPointerType();
    3939
    4040    virtual size_t getBufferSize() = 0;
     
    6464   
    6565protected:
    66     StreamSetBuffer(BufferKind k, IDISA::IDISA_Builder * b, StreamSetType ss_type) :
    67         mBufferKind(k), iBuilder(b), mStreamSetType(ss_type), mBufferBlocks(1), mAddrSpace(0), mStreamSetBufferPtr(nullptr) {
     66    StreamSetBuffer(BufferKind k, IDISA::IDISA_Builder * b, StreamSetType ss_type, int AddressSpace = 0) :
     67        mBufferKind(k), iBuilder(b), mStreamSetType(ss_type), mBufferBlocks(1), mAddrSpace(AddressSpace), mStreamSetBufferPtr(nullptr) {
     68            mStreamSetStructType =
     69                StructType::get(iBuilder->getContext(),
     70                                std::vector<Type *>({iBuilder->getSizeTy(),
     71                                                    iBuilder->getSizeTy(),
     72                                                    iBuilder->getInt8Ty(),
     73                                                    PointerType::get(mStreamSetType.getStreamSetBlockType(iBuilder), AddressSpace)}));
    6874    }
     75   
    6976    const BufferKind       mBufferKind;
    7077    IDISA::IDISA_Builder * iBuilder;
     
    7582    llvm::Value * mStreamSetStructPtr;
    7683    llvm::Type * mStreamSetStructType;
    77 
    7884};   
    7985   
     
    8490   
    8591    SingleBlockBuffer(IDISA::IDISA_Builder * b, StreamSetType ss_type) :
    86     StreamSetBuffer(BufferKind::BlockBuffer, b, ss_type) {
    87         mStreamSetStructType = StructType::get(iBuilder->getContext(),
    88                                                std::vector<Type *>({iBuilder->getSizeTy(),
    89                                                                     iBuilder->getSizeTy(),
    90                                                                     iBuilder->getInt8Ty(),
    91                                                                     getStreamBufferPointerType()}));
    92 
    93     }
     92    StreamSetBuffer(BufferKind::BlockBuffer, b, ss_type, 0) { }
    9493   
    9594    size_t getBufferSize() override;
     
    102101    static inline bool classof(const StreamSetBuffer * b) {return b->getBufferKind() == BufferKind::ExternalFileBuffer;}
    103102   
    104     ExternalFileBuffer(IDISA::IDISA_Builder * b, StreamSetType ss_type, unsigned AddressSpace = 0) :
    105         StreamSetBuffer(BufferKind::ExternalFileBuffer, b, ss_type) {
    106             mBufferBlocks = 0;
    107             mAddrSpace = AddressSpace;
    108             mStreamSetStructType = StructType::get(iBuilder->getContext(),
    109                                                    std::vector<Type *>({iBuilder->getSizeTy(),
    110                                                                         iBuilder->getSizeTy(),
    111                                                                         iBuilder->getInt8Ty(),
    112                                                                         getStreamBufferPointerType()}));
    113         }
    114     llvm::PointerType * getStreamBufferPointerType() override;
     103    ExternalFileBuffer(IDISA::IDISA_Builder * b, StreamSetType ss_type, int AddressSpace = 0) :
     104        StreamSetBuffer(BufferKind::ExternalFileBuffer, b, ss_type, AddressSpace) {}
    115105
    116106    void setStreamSetBuffer(llvm::Value * ptr, llvm::Value * fileSize);
     
    121111    llvm::Value * getStreamSetBlockPointer(llvm::Value * bufferBasePtr, llvm::Value * blockNo) override;
    122112
    123 private:
    124     unsigned mAddrSpace;
    125113};
    126114
     
    135123                throw std::runtime_error("CircularStreamSetBuffer: number of blocks must be a power of 2!");
    136124            }
    137             mStreamSetStructType = StructType::get(iBuilder->getContext(),
    138                                                    std::vector<Type *>({iBuilder->getSizeTy(),
    139                                                                         iBuilder->getSizeTy(),
    140                                                                         iBuilder->getInt8Ty(),
    141                                                                         getStreamBufferPointerType()}));
    142  
    143125        }
    144126
Note: See TracChangeset for help on using the changeset viewer.