Changeset 5122


Ignore:
Timestamp:
Aug 9, 2016, 11:57:23 AM (3 years ago)
Author:
cameron
Message:

AddrSpace? parameter for external buffers

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

Legend:

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

    r5106 r5122  
    99#include <IDISA/idisa_builder.h>
    1010#include <llvm/IR/Type.h>
     11#include <iostream>
    1112   
    1213using namespace parabix;
     
    4445}
    4546
     47void ExternalUnboundedBuffer::setStreamSetBuffer(llvm::Value * ptr) {
     48    PointerType * t = PointerType::get(getStreamSetBlockType(), mAddrSpace);
     49   
     50    mStreamSetBufferPtr = iBuilder->CreatePointerBitCastOrAddrSpaceCast(ptr, t);
     51    std::cerr << "mStreamSetBufferPtr\n";
     52}
     53
    4654llvm::Value * ExternalUnboundedBuffer::allocateBuffer() {
    4755    throw std::runtime_error("External buffers cannot be allocated.");
     
    4957
    5058llvm::Value * ExternalUnboundedBuffer::getStreamSetBlockPointer(llvm::Value * bufferBasePtr, llvm::Value * blockNo) {
    51     return iBuilder->CreateGEP(getStreamSetBlockType(), bufferBasePtr, {blockNo});
     59    PointerType * t = PointerType::get(getStreamSetBlockType(), mAddrSpace);
     60    return iBuilder->CreateGEP(iBuilder->CreatePointerBitCastOrAddrSpaceCast(bufferBasePtr, t), {blockNo});
    5261}
    5362
  • icGREP/icgrep-devel/icgrep/kernels/streamset.h

    r5106 r5122  
    7777    static inline bool classof(const StreamSetBuffer * b) {return b->getBufferKind() == BufferKind::ExternalUnboundedBuffer;}
    7878   
    79     ExternalUnboundedBuffer(IDISA::IDISA_Builder * b, StreamSetType ss_type) :
     79    ExternalUnboundedBuffer(IDISA::IDISA_Builder * b, StreamSetType ss_type, unsigned AddressSpace = 0) :
    8080        StreamSetBuffer(BufferKind::ExternalUnboundedBuffer, b, ss_type) {
    8181            mBufferBlocks = 0;
     82            mAddrSpace = AddressSpace;
    8283        }
    8384   
    84     void setStreamSetBuffer(llvm::Value * ptr) {mStreamSetBufferPtr = ptr;}
     85    void setStreamSetBuffer(llvm::Value * ptr);
    8586   
    8687    size_t getBufferSize() override;
     
    8889    llvm::Value * allocateBuffer() override;
    8990    llvm::Value * getStreamSetBlockPointer(llvm::Value * bufferBasePtr, llvm::Value * blockNo) override;
     91
     92private:
     93    unsigned mAddrSpace;
    9094};
    9195
Note: See TracChangeset for help on using the changeset viewer.