Ignore:
Timestamp:
May 24, 2017, 12:06:43 PM (2 years ago)
Author:
nmedfort
Message:

Eliminated ExecutionEngine? memory leak. Intentionally broke compatibility with prior versions to ensure unchecked in projects are restructured.

Location:
icGREP/icgrep-devel/icgrep/toolchain
Files:
7 edited

Legend:

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

    r5464 r5474  
    195195}
    196196
    197 void NVPTXDriver::finalizeAndCompile(Function * mainFunc, std::string PTXFilename) {
     197void NVPTXDriver::finalizeObject() {
    198198
    199199    legacy::PassManager PM;
     
    209209    }
    210210
     211    Function * mainFunc = mMainModule->getFunction("Main");
     212
    211213    MDNode * Node = MDNode::get(mMainModule->getContext(),
    212214                                {llvm::ValueAsMetadata::get(mainFunc),
     
    222224    }
    223225
     226    const auto PTXFilename = mMainModule->getModuleIdentifier() + ".ptx";
     227
    224228    llvm2ptx(mMainModule, PTXFilename);
    225229}
    226230
     231void * NVPTXDriver::getMain() {
     232    report_fatal_error("NVPTX must be executed by calling RunPTX");
     233}
     234
    227235NVPTXDriver::~NVPTXDriver() {
    228236}
  • icGREP/icgrep-devel/icgrep/toolchain/NVPTXDriver.h

    r5464 r5474  
    2121    void makeKernelCall(kernel::Kernel * kb, const std::vector<parabix::StreamSetBuffer *> & inputs, const std::vector<parabix::StreamSetBuffer *> & outputs) override;
    2222
    23     void finalizeAndCompile(llvm::Function * mainFunc, std::string PTXFilename);
     23    void finalizeObject() override;
    2424
    25     void * getPointerToMain();
     25    void * getMain() override; // "main" exists until the driver is deleted
    2626
    2727private:
  • icGREP/icgrep-devel/icgrep/toolchain/cpudriver.cpp

    r5464 r5474  
    137137}
    138138
    139 void ParabixDriver::linkAndFinalize() {
     139void ParabixDriver::finalizeObject() {
    140140
    141141    legacy::PassManager PM;
     
    219219}
    220220
    221 void * ParabixDriver::getPointerToMain() {
     221void * ParabixDriver::getMain() {
    222222    return mEngine->getPointerToNamedFunction("Main");
    223223}
    224224
    225225ParabixDriver::~ParabixDriver() {
    226 //    delete mEngine;
     226    delete mEngine;
    227227    delete mCache;
    228228    delete mTarget;
  • icGREP/icgrep-devel/icgrep/toolchain/cpudriver.h

    r5464 r5474  
    1919    void makeKernelCall(kernel::Kernel * kb, const std::vector<parabix::StreamSetBuffer *> & inputs, const std::vector<parabix::StreamSetBuffer *> & outputs) override;
    2020
    21     void linkAndFinalize();
     21    void finalizeObject() override;
    2222
    23     void * getPointerToMain();
     23    void * getMain() override; // "main" exists until the driver is deleted
    2424
    2525private:
  • icGREP/icgrep-devel/icgrep/toolchain/driver.cpp

    r5464 r5474  
    3333    return mOwnedKernels.back().get();
    3434}
     35
  • icGREP/icgrep-devel/icgrep/toolchain/driver.h

    r5464 r5474  
    4040    llvm::Function * LinkFunction(kernel::Kernel & kb, llvm::StringRef name, ExternalFunctionType * functionPtr) const;
    4141
    42     llvm::GenericValue getPointerToMain(llvm::Function * f, const std::vector<llvm::GenericValue> & ArgValues);
     42    virtual void finalizeObject() = 0;
     43
     44    virtual void * getMain() = 0; // "main" exists until the driver is deleted
    4345
    4446protected:
  • icGREP/icgrep-devel/icgrep/toolchain/pipeline.cpp

    r5464 r5474  
    7777    }
    7878    Value * const segOffset = iBuilder->CreateLoad(iBuilder->CreateGEP(threadStruct, {iBuilder->getInt32(0), iBuilder->getInt32(1)}));
    79 
    80 
    81 
    8279
    8380    BasicBlock * segmentLoop = BasicBlock::Create(iBuilder->getContext(), "segmentLoop", threadFunc);
Note: See TracChangeset for help on using the changeset viewer.