Ignore:
Timestamp:
Nov 18, 2016, 1:46:55 PM (2 years ago)
Author:
nmedfort
Message:

Merged PabloFunction? and PabloKernel? classes. Updated projects where necessary.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/wc.cpp

    r5202 r5217  
    2525#include <re/re_cc.h>
    2626#include <cc/cc_compiler.h>
    27 #include <pablo/function.h>
     27#include <pablo/prototype.h>
    2828#include <pablo/pablo_kernel.h>
    2929#include <IDISA/idisa_builder.h>
     
    4343
    4444#include <fcntl.h>
    45 using namespace pablo;
    4645
    4746static cl::OptionCategory wcFlags("Command Flags", "wc options");
     
    8079uint64_t TotalBytes = 0;
    8180
     81using namespace pablo;
     82using namespace kernel;
     83using namespace parabix;
    8284
    8385//  The callback routine that records counts in progress.
     
    99101//
    100102
    101 PabloFunction * wc_gen() {
     103void wc_gen(PabloKernel * kernel) {
    102104    //  input: 8 basis bit streams
    103105    //  output: 3 counters
    104106   
    105     PabloFunction * function = PabloFunction::Create("wc"); // , 8, 0
    106     cc::CC_Compiler ccc(*function);
     107    cc::CC_Compiler ccc(kernel);
    107108   
    108109    PabloBuilder & pb = ccc.getBuilder();
    109     // const std::vector<Parameter *> u8_bits = ccc.getBasisBits();
    110 
    111     Var * lc = function->addResult("lineCount", getScalarTy());
    112     Var * wc = function->addResult("wordCount", getScalarTy());
    113     Var * cc = function->addResult("charCount", getScalarTy());
     110
     111    Var * lc = kernel->addOutput("lineCount", kernel->getSizeTy());
     112    Var * wc = kernel->addOutput("wordCount", kernel->getSizeTy());
     113    Var * cc = kernel->addOutput("charCount", kernel->getSizeTy());
    114114
    115115    if (CountLines) {
     
    133133        pb.createAssign(cc, pb.createCount(u8Begin));
    134134    }
    135     return function;
    136 }
    137 
    138 using namespace kernel;
    139 using namespace parabix;
    140 
    141 
    142 Function * wcPipeline(Module * mMod, IDISA::IDISA_Builder * iBuilder, PabloFunction * function) {
     135}
     136
     137Function * wcPipeline(Module * mMod, IDISA::IDISA_Builder * iBuilder) {
    143138    Type * mBitBlockType = iBuilder->getBitBlockType();
    144139   
    145     ExternalFileBuffer ByteStream(iBuilder, StreamSetType(iBuilder,1, 8));
    146     SingleBlockBuffer BasisBits(iBuilder, StreamSetType(iBuilder,8, 1));
    147     //CircularBuffer BasisBits(iBuilder, StreamSetType(iBuilder,8, 1), codegen::SegmentSize * codegen::BufferSegments);
     140    ExternalFileBuffer ByteStream(iBuilder, iBuilder->getStreamSetTy(1, 8));
     141
     142    SingleBlockBuffer BasisBits(iBuilder, iBuilder->getStreamSetTy(8, 1));
    148143
    149144    s2pKernel  s2pk(iBuilder);
    150145    std::unique_ptr<Module> s2pM = s2pk.createKernelModule({&ByteStream}, {&BasisBits});
    151146   
    152     pablo_function_passes(function);
    153     PabloKernel wck(iBuilder, "wc", function);
     147    PabloKernel wck(iBuilder, "wc");
     148    wc_gen(&wck);
     149    pablo_function_passes(&wck);
    154150   
    155151    std::unique_ptr<Module> wcM = wck.createKernelModule({&BasisBits}, {});
     
    209205    IDISA::IDISA_Builder * idb = IDISA::GetIDISA_Builder(M);
    210206
    211     PabloFunction * function = wc_gen();
    212     llvm::Function * main_IR = wcPipeline(M, idb, function);
     207    llvm::Function * main_IR = wcPipeline(M, idb);
    213208
    214209    wcEngine = JIT_to_ExecutionEngine(M);
Note: See TracChangeset for help on using the changeset viewer.