Ignore:
Timestamp:
May 22, 2017, 12:14:19 PM (2 years ago)
Author:
nmedfort
Message:

Restructuring work for the Driver classes. Start of work to eliminate the memory leaks with the ExecutionEngine?. Replaced custom AlignedMalloc? with backend call to std::aligned_malloc. Salvaged some work on DistributionPass? for reevaluation.

File:
1 edited

Legend:

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

    r5462 r5464  
    77#ifndef NVPTXDRIVER_H
    88#define NVPTXDRIVER_H
    9 #include <string>
    10 #include <IR_Gen/FunctionTypeBuilder.h>
    11 #include <kernels/kernel.h>
    12 #include <kernels/streamset.h>
    139
    14 namespace llvm { class ExecutionEngine; }
    15 namespace llvm { class Function; }
    16 namespace llvm { class Module; }
    17 namespace llvm { class TargetMachine; }
    18 namespace llvm { class formatted_raw_ostream; }
    19 namespace llvm { namespace cl { class OptionCategory; } }
    20 namespace kernel { class Kernel; }
    21 namespace kernel { class KernelBuilder; }
    22 namespace IDISA { class IDISA_Builder; }
     10#include "driver.h"
    2311
    24 class NVPTXDriver {
     12class NVPTXDriver final : public Driver {
    2513    friend class CBuilder;
    2614public:
     
    2816
    2917    ~NVPTXDriver();
     18
     19    void generatePipelineIR() override;
    3020   
    31     const std::unique_ptr<kernel::KernelBuilder> & getBuilder();
    32    
    33     parabix::ExternalBuffer * addExternalBuffer(std::unique_ptr<parabix::ExternalBuffer> b);
    34    
    35     parabix::StreamSetBuffer * addBuffer(std::unique_ptr<parabix::StreamSetBuffer> b);
    36    
    37     kernel::Kernel * addKernelInstance(std::unique_ptr<kernel::Kernel> kb);
    38    
    39     void addKernelCall(kernel::Kernel & kb, const std::vector<parabix::StreamSetBuffer *> & inputs, const std::vector<parabix::StreamSetBuffer *> & outputs);
    40 
    41     void makeKernelCall(kernel::Kernel * kb, const std::vector<parabix::StreamSetBuffer *> & inputs, const std::vector<parabix::StreamSetBuffer *> & outputs);
    42    
    43     void generatePipelineIR();
    44    
    45     template <typename ExternalFunctionType>
    46     llvm::Function * LinkFunction(kernel::Kernel & kb, llvm::StringRef name, ExternalFunctionType * functionPtr) const;
     21    void makeKernelCall(kernel::Kernel * kb, const std::vector<parabix::StreamSetBuffer *> & inputs, const std::vector<parabix::StreamSetBuffer *> & outputs) override;
    4722
    4823    void finalizeAndCompile(llvm::Function * mainFunc, std::string PTXFilename);
    49    
     24
    5025    void * getPointerToMain();
    5126
    52 protected:
     27private:
    5328
    54     llvm::Function * LinkFunction(llvm::Module * mod, llvm::StringRef name, llvm::FunctionType * type, void * functionPtr) const;
     29    llvm::Function * addLinkFunction(llvm::Module * mod, llvm::StringRef name, llvm::FunctionType * type, void * functionPtr) const override;
    5530
    56 private:
    57     std::unique_ptr<llvm::LLVMContext>                      mContext;
    58     llvm::Module * const                                    mMainModule;
    59     std::unique_ptr<kernel::KernelBuilder>                  iBuilder;
    60     llvm::TargetMachine *                                   mTarget;
    61     llvm::ExecutionEngine *                                 mEngine;
    62 
    63     std::vector<kernel::Kernel *>                           mPipeline;
    64     // Owned kernels and buffers that will persist with this ParabixDriver instance.
    65     std::vector<std::unique_ptr<kernel::Kernel>>            mOwnedKernels;
    66     std::vector<std::unique_ptr<parabix::StreamSetBuffer>>  mOwnedBuffers;
    6731};
    6832
Note: See TracChangeset for help on using the changeset viewer.