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

Parabix driver can take ownership and allocate buffers

File:
1 edited

Legend:

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

    r5402 r5409  
    150150    Value * const fileIdx = &*(args++);
    151151    fileIdx->setName("fileIdx");
    152    
    153     ExternalFileBuffer ByteStream(iBuilder, iBuilder->getStreamSetTy(1, 8));
    154 
    155     SingleBlockBuffer BasisBits(iBuilder, iBuilder->getStreamSetTy(8, 1));
    156152    iBuilder->SetInsertPoint(BasicBlock::Create(m->getContext(), "entry", main,0));
     153
     154    StreamSetBuffer * ByteStream = pxDriver.addExternalBuffer(make_unique<ExternalFileBuffer>(iBuilder, iBuilder->getStreamSetTy(1, 8)), inputStream);
     155
     156    StreamSetBuffer * BasisBits = pxDriver.addBuffer(make_unique<SingleBlockBuffer>(iBuilder, iBuilder->getStreamSetTy(8, 1)));
    157157
    158158    MMapSourceKernel mmapK(iBuilder);
    159159    mmapK.setInitialArguments({fileSize});
    160     pxDriver.addKernelCall(mmapK, {}, {&ByteStream});
     160    pxDriver.addKernelCall(mmapK, {}, {ByteStream});
    161161
    162162    S2PKernel  s2pk(iBuilder);
    163     pxDriver.addKernelCall(s2pk, {&ByteStream}, {&BasisBits});
     163    pxDriver.addKernelCall(s2pk, {ByteStream}, {BasisBits});
    164164   
    165165    PabloKernel wck(iBuilder, "Parabix:wc",
     
    171171    wc_gen(&wck);
    172172    pablo_function_passes(&wck);
    173     pxDriver.addKernelCall(wck, {&BasisBits}, {});
    174 
    175     ByteStream.setStreamSetBuffer(inputStream);
    176     BasisBits.allocateBuffer();
     173    pxDriver.addKernelCall(wck, {BasisBits}, {});
     174
    177175
    178176    pxDriver.generatePipelineIR();
Note: See TracChangeset for help on using the changeset viewer.