Ignore:
Timestamp:
Apr 16, 2017, 9:44:17 AM (2 years ago)
Author:
cameron
Message:

Parabix driver can take ownership and allocate buffers

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

Legend:

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

    r5408 r5409  
    3535
    3636using namespace llvm;
     37using namespace parabix;
    3738
    3839namespace codegen {
     
    210211    }
    211212}
     213
     214ExternalFileBuffer * ParabixDriver::addExternalBuffer(std::unique_ptr<ExternalFileBuffer> b, Value * externalBuf) {
     215    ExternalFileBuffer * rawBuf = b.get();
     216    mOwnedBuffers.push_back(std::move(b));
     217    rawBuf->setStreamSetBuffer(externalBuf);
     218    return rawBuf;
     219}
     220
     221StreamSetBuffer * ParabixDriver::addBuffer(std::unique_ptr<StreamSetBuffer> b) {
     222    b->allocateBuffer();
     223    mOwnedBuffers.push_back(std::move(b));
     224    return mOwnedBuffers.back().get();
     225}
     226
    212227
    213228void ParabixDriver::addKernelCall(kernel::KernelBuilder & kb, const std::vector<parabix::StreamSetBuffer *> & inputs, const std::vector<parabix::StreamSetBuffer *> & outputs) {
  • icGREP/icgrep-devel/icgrep/kernels/toolchain.h

    r5402 r5409  
    1919namespace IDISA { class IDISA_Builder; }
    2020namespace kernel { class KernelBuilder; }
    21 namespace parabix { class StreamSetBuffer; }
     21//namespace parabix { class StreamSetBuffer; }
     22#include <kernels/streamset.h>
    2223class ParabixObjectCache;
    2324
     
    6768    IDISA::IDISA_Builder * getIDISA_Builder() {return iBuilder;}
    6869   
     70    parabix::ExternalFileBuffer * addExternalBuffer(std::unique_ptr<parabix::ExternalFileBuffer> b, llvm::Value * externalBuf);
     71   
     72    parabix::StreamSetBuffer * addBuffer(std::unique_ptr<parabix::StreamSetBuffer> b);
     73   
    6974    void addKernelCall(kernel::KernelBuilder & kb, const std::vector<parabix::StreamSetBuffer *> & inputs, const std::vector<parabix::StreamSetBuffer *> & outputs);
    7075   
     
    8792    ParabixObjectCache *                    mCache;
    8893    std::vector<kernel::KernelBuilder *>    mKernelList;
     94    // Owned kernels and buffers that will persist with this ParabixDriver instance.
     95    std::vector<std::unique_ptr<kernel::KernelBuilder>> mOwnedKernels;
     96    std::vector<std::unique_ptr<parabix::StreamSetBuffer>> mOwnedBuffers;
    8997    ModuleMap                               mModuleMap;
    9098};
Note: See TracChangeset for help on using the changeset viewer.