Ignore:
Timestamp:
May 6, 2017, 4:05:05 PM (2 years ago)
Author:
nmedfort
Message:

Continued refactoring work.

File:
1 edited

Legend:

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

    r5429 r5435  
    4949
    5050
    51 std::unique_ptr<PabloKernel> u8u16_pablo(IDISA::IDISA_Builder * iBuilder) {
     51std::unique_ptr<PabloKernel> u8u16_pablo(const std::unique_ptr<IDISA::IDISA_Builder> & iBuilder) {
    5252
    5353    auto kernel = std::unique_ptr<PabloKernel>(new PabloKernel(iBuilder, "u8u16",
     
    5757                           Binding{iBuilder->getStreamSetTy(1, 1), "errMask"}}, {}));
    5858   
     59    kernel->setBuilder(iBuilder.get());
     60
    5961    //  input: 8 basis bit streams
    6062   
     
    262264void u8u16PipelineAVX2Gen(ParabixDriver & pxDriver) {
    263265
    264     IDISA::IDISA_Builder * iBuilder = pxDriver.getIDISA_Builder();
     266    auto & iBuilder = pxDriver.getBuilder();
    265267    Module * mod = iBuilder->getModule();
    266268    const unsigned segmentSize = codegen::SegmentSize;
     
    287289    StreamSetBuffer * ByteStream = pxDriver.addBuffer(make_unique<SourceBuffer>(iBuilder, iBuilder->getStreamSetTy(1, 8)));
    288290   
    289     KernelBuilder * mmapK = pxDriver.addKernelInstance(make_unique<MMapSourceKernel>(iBuilder, segmentSize));
     291    Kernel * mmapK = pxDriver.addKernelInstance(make_unique<MMapSourceKernel>(iBuilder, segmentSize));
    290292    mmapK->setInitialArguments({fileDecriptor});
    291293    pxDriver.makeKernelCall(mmapK, {}, {ByteStream});
     
    294296    StreamSetBuffer * BasisBits = pxDriver.addBuffer(make_unique<CircularBuffer>(iBuilder, iBuilder->getStreamSetTy(8, 1), segmentSize * bufferSegments));
    295297   
    296     KernelBuilder * s2pk = pxDriver.addKernelInstance(make_unique<S2PKernel>(iBuilder));
     298    Kernel * s2pk = pxDriver.addKernelInstance(make_unique<S2PKernel>(iBuilder));
    297299    pxDriver.makeKernelCall(s2pk, {ByteStream}, {BasisBits});
    298300   
     
    302304    StreamSetBuffer * ErrorMask = pxDriver.addBuffer(make_unique<CircularBuffer>(iBuilder, iBuilder->getStreamSetTy(), segmentSize * bufferSegments));
    303305   
    304     KernelBuilder * u8u16k = pxDriver.addKernelInstance(u8u16_pablo(iBuilder));
     306    Kernel * u8u16k = pxDriver.addKernelInstance(u8u16_pablo(iBuilder));
    305307    pxDriver.makeKernelCall(u8u16k, {BasisBits}, {U8u16Bits, DelMask, ErrorMask});
    306308   
     
    313315    StreamSetBuffer * DeletionCounts = pxDriver.addBuffer(make_unique<CircularBuffer>(iBuilder, iBuilder->getStreamSetTy(), segmentSize * bufferSegments));
    314316   
    315     KernelBuilder * delK = pxDriver.addKernelInstance(make_unique<DeleteByPEXTkernel>(iBuilder, 64, 16, true));
     317    Kernel * delK = pxDriver.addKernelInstance(make_unique<DeleteByPEXTkernel>(iBuilder, 64, 16, true));
    316318    pxDriver.makeKernelCall(delK, {U8u16Bits, DelMask}, {SwizzleFields0, SwizzleFields1, SwizzleFields2, SwizzleFields3, DeletionCounts});
    317319   
     
    322324    StreamSetBuffer * u16Swizzle3 = pxDriver.addBuffer(make_unique<SwizzledCopybackBuffer>(iBuilder, iBuilder->getStreamSetTy(4), segmentSize * (bufferSegments+2), 1));
    323325   
    324     KernelBuilder * compressK = pxDriver.addKernelInstance(make_unique<SwizzledBitstreamCompressByCount>(iBuilder, 16));
     326    Kernel * compressK = pxDriver.addKernelInstance(make_unique<SwizzledBitstreamCompressByCount>(iBuilder, 16));
    325327    pxDriver.makeKernelCall(compressK, {DeletionCounts, SwizzleFields0, SwizzleFields1, SwizzleFields2, SwizzleFields3},
    326328                           {u16Swizzle0, u16Swizzle1, u16Swizzle2, u16Swizzle3});
     
    329331    StreamSetBuffer * u16bits = pxDriver.addBuffer(make_unique<CircularBuffer>(iBuilder, iBuilder->getStreamSetTy(16), segmentSize * bufferSegments));
    330332   
    331     KernelBuilder * unSwizzleK = pxDriver.addKernelInstance(make_unique<SwizzleGenerator>(iBuilder, 16, 1, 4));
     333    Kernel * unSwizzleK = pxDriver.addKernelInstance(make_unique<SwizzleGenerator>(iBuilder, 16, 1, 4));
    332334    pxDriver.makeKernelCall(unSwizzleK, {u16Swizzle0, u16Swizzle1, u16Swizzle2, u16Swizzle3}, {u16bits});
    333335   
    334     KernelBuilder * p2sk = pxDriver.addKernelInstance(make_unique<P2S16Kernel>(iBuilder));
    335    
    336     KernelBuilder * outK = pxDriver.addKernelInstance(make_unique<FileSink>(iBuilder, 16));
     336    Kernel * p2sk = pxDriver.addKernelInstance(make_unique<P2S16Kernel>(iBuilder));
     337   
     338    Kernel * outK = pxDriver.addKernelInstance(make_unique<FileSink>(iBuilder, 16));
    337339    Value * fName = iBuilder->CreatePointerCast(iBuilder->CreateGlobalString(outputFile.c_str()), iBuilder->getInt8PtrTy());
    338340    outK->setInitialArguments({fName});
     
    357359void u8u16PipelineGen(ParabixDriver & pxDriver) {
    358360   
    359     auto iBuilder = pxDriver.getIDISA_Builder();
     361    auto & iBuilder = pxDriver.getBuilder();
    360362    Module * mod = iBuilder->getModule();
    361363   
     
    380382    StreamSetBuffer * ByteStream = pxDriver.addBuffer(make_unique<SourceBuffer>(iBuilder, iBuilder->getStreamSetTy(1, 8)));
    381383   
    382     KernelBuilder * mmapK = pxDriver.addKernelInstance(make_unique<MMapSourceKernel>(iBuilder, segmentSize));
     384    Kernel * mmapK = pxDriver.addKernelInstance(make_unique<MMapSourceKernel>(iBuilder, segmentSize));
    383385    mmapK->setInitialArguments({fileDecriptor});
    384386    pxDriver.makeKernelCall(mmapK, {}, {ByteStream});
     
    387389    StreamSetBuffer * BasisBits = pxDriver.addBuffer(make_unique<CircularBuffer>(iBuilder, iBuilder->getStreamSetTy(8, 1), segmentSize * bufferSegments));
    388390   
    389     KernelBuilder * s2pk = pxDriver.addKernelInstance(make_unique<S2PKernel>(iBuilder));
     391    Kernel * s2pk = pxDriver.addKernelInstance(make_unique<S2PKernel>(iBuilder));
    390392    pxDriver.makeKernelCall(s2pk, {ByteStream}, {BasisBits});
    391393   
     
    395397    StreamSetBuffer * ErrorMask = pxDriver.addBuffer(make_unique<CircularBuffer>(iBuilder, iBuilder->getStreamSetTy(), segmentSize * bufferSegments));
    396398   
    397     KernelBuilder * u8u16k = pxDriver.addKernelInstance(u8u16_pablo(iBuilder));
     399    Kernel * u8u16k = pxDriver.addKernelInstance(u8u16_pablo(iBuilder));
    398400    pxDriver.makeKernelCall(u8u16k, {BasisBits}, {U8u16Bits, DelMask, ErrorMask});
    399401   
     
    402404    StreamSetBuffer * DeletionCounts = pxDriver.addBuffer(make_unique<CircularBuffer>(iBuilder, iBuilder->getStreamSetTy(), segmentSize * bufferSegments));
    403405
    404     KernelBuilder * delK = pxDriver.addKernelInstance(make_unique<DeletionKernel>(iBuilder, iBuilder->getBitBlockWidth()/16, 16));
     406    Kernel * delK = pxDriver.addKernelInstance(make_unique<DeletionKernel>(iBuilder, iBuilder->getBitBlockWidth()/16, 16));
    405407    pxDriver.makeKernelCall(delK, {U8u16Bits, DelMask}, {U16Bits, DeletionCounts});
    406408   
    407     KernelBuilder * p2sk = pxDriver.addKernelInstance(make_unique<P2S16KernelWithCompressedOutput>(iBuilder));
    408    
    409     KernelBuilder * outK = pxDriver.addKernelInstance(make_unique<FileSink>(iBuilder, 16));
     409    Kernel * p2sk = pxDriver.addKernelInstance(make_unique<P2S16KernelWithCompressedOutput>(iBuilder));
     410   
     411    Kernel * outK = pxDriver.addKernelInstance(make_unique<FileSink>(iBuilder, 16));
    410412    Value * fName = iBuilder->CreatePointerCast(iBuilder->CreateGlobalString(outputFile.c_str()), iBuilder->getInt8PtrTy());
    411413    outK->setInitialArguments({fName});
Note: See TracChangeset for help on using the changeset viewer.