Ignore:
Timestamp:
Oct 13, 2016, 11:05:03 AM (3 years ago)
Author:
cameron
Message:

mmap and posix_memalign buffering options for u8u16

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

Legend:

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

    r5190 r5191  
    99#include <IDISA/idisa_builder.h>
    1010#include <llvm/IR/Type.h>
    11 #include <iostream>
    12    
     11
    1312using namespace parabix;
    1413
     
    8887}
    8988
     89llvm::Value * StreamSetBuffer::getStreamSetBlockPointer(llvm::Value * bufferStructPtr, llvm::Value * blockNo) {
     90    Value * handle = iBuilder->CreateGEP(bufferStructPtr, {iBuilder->getInt32(0), iBuilder->getInt32(iBuffer_ptr)});
     91    return iBuilder->CreateGEP(iBuilder->CreateLoad(handle), {blockNo});
     92}
     93
     94
     95
     96
    9097// Single Block Buffer
    9198// For a single block buffer, the block pointer is always the buffer base pointer.
     
    96103
    97104
    98 // External Unbounded Buffer
     105// External File Buffer
    99106
    100107void ExternalFileBuffer::setStreamSetBuffer(llvm::Value * ptr, Value * fileSize) {
     
    137144}
    138145
    139 
    140146// Circular Stack Allocated Buffer
    141147
     
    149155}
    150156
    151 llvm::Value * LinearBuffer::getStreamSetBlockPointer(llvm::Value * bufferStructPtr, llvm::Value * blockNo) {
     157llvm::Value * LinearCopybackBuffer::getStreamSetBlockPointer(llvm::Value * bufferStructPtr, llvm::Value * blockNo) {
    152158    Constant * blockWidth = ConstantInt::get(iBuilder->getSizeTy(), iBuilder->getStride());
    153159    Value * consumerPos_ptr = iBuilder->CreateGEP(bufferStructPtr, {iBuilder->getInt32(0), iBuilder->getInt32(iConsumer_pos)});
     
    160166}
    161167
    162 void LinearBuffer::setConsumerPos(Value * bufferStructPtr, Value * new_consumer_pos) {
     168void LinearCopybackBuffer::setConsumerPos(Value * bufferStructPtr, Value * new_consumer_pos) {
    163169    Type * const i1 = iBuilder->getInt1Ty();
    164170    Type * const i8 = iBuilder->getInt8Ty();
  • icGREP/icgrep-devel/icgrep/kernels/streamset.h

    r5190 r5191  
    1111#include <IDISA/idisa_builder.h>
    1212#include <llvm/IR/Type.h>
    13    
     13
    1414namespace parabix {
    1515   
     
    4141class StreamSetBuffer {
    4242public:
    43     enum class BufferKind : unsigned {BlockBuffer, ExternalFileBuffer, CircularBuffer, LinearBuffer, ExpandingBuffer};
     43    enum class BufferKind : unsigned {BlockBuffer, ExternalFileBuffer, CircularBuffer, LinearCopybackBuffer};
    4444    inline BufferKind getBufferKind() const {return mBufferKind;}
    4545    inline StreamSetType& getBufferStreamSetType() {return mStreamSetType;}
     
    120120
    121121};
    122 
     122   
    123123class CircularBuffer : public StreamSetBuffer {
    124124public:
     
    137137// offset of the block containing the current consumer position is always zero.
    138138//
    139 class LinearBuffer : public StreamSetBuffer {
     139class LinearCopybackBuffer : public StreamSetBuffer {
    140140public:
    141     static inline bool classof(const StreamSetBuffer * b) {return b->getBufferKind() == BufferKind::LinearBuffer;}
     141    static inline bool classof(const StreamSetBuffer * b) {return b->getBufferKind() == BufferKind::LinearCopybackBuffer;}
    142142   
    143     LinearBuffer(IDISA::IDISA_Builder * b, StreamSetType ss_type, size_t bufferBlocks, unsigned AddressSpace = 0) :
    144         StreamSetBuffer(BufferKind::CircularBuffer, b, ss_type, bufferBlocks, AddressSpace) {}
     143    LinearCopybackBuffer(IDISA::IDISA_Builder * b, StreamSetType ss_type, size_t bufferBlocks, unsigned AddressSpace = 0) :
     144        StreamSetBuffer(BufferKind::LinearCopybackBuffer, b, ss_type, bufferBlocks, AddressSpace) {}
    145145   
    146146    llvm::Value * getStreamSetBlockPointer(llvm::Value * bufferStructPtr, llvm::Value * blockNo) override;
Note: See TracChangeset for help on using the changeset viewer.