Ignore:
Timestamp:
Jun 12, 2017, 5:51:28 PM (2 years ago)
Author:
cameron
Message:

Update base64 main

File:
1 edited

Legend:

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

    r5486 r5504  
    5757    Value * const outputStream = &*(args++);
    5858    outputStream->setName("outputStream");
     59    iBuilder->SetInsertPoint(BasicBlock::Create(mod->getContext(), "entry", main,0));
    5960
    6061    //Round up to a multiple of 3.
    61     const unsigned segmentSize = ((codegen::SegmentSize + 2)/3) * 3;
     62    const unsigned initSegSize = ((codegen::SegmentSize + 2)/3) * 3;
     63    const unsigned bufferSize = initSegSize * 4/3 * codegen::BufferSegments;
     64
     65    StreamSetBuffer * ByteStream = pxDriver.addBuffer(make_unique<SourceBuffer>(iBuilder, iBuilder->getStreamSetTy(1, 8)));
     66
     67    Kernel * mmapK = pxDriver.addKernelInstance(make_unique<MMapSourceKernel>(iBuilder, initSegSize));
     68    mmapK->setInitialArguments({fileDescriptor});
     69    pxDriver.makeKernelCall(mmapK, {}, {ByteStream});
    6270   
    63     const unsigned bufferSegments = codegen::BufferSegments;
     71    StreamSetBuffer * Expanded3_4Out = pxDriver.addBuffer(make_unique<CircularBuffer>(iBuilder, iBuilder->getStreamSetTy(1, 8), bufferSize));
     72    Kernel * expandK = pxDriver.addKernelInstance(make_unique<expand3_4Kernel>(iBuilder));
     73    pxDriver.makeKernelCall(expandK, {ByteStream}, {Expanded3_4Out});
    6474   
    65     SourceBuffer ByteStream(iBuilder, iBuilder->getStreamSetTy(1, 8));
    66 
    67     CircularBuffer Expanded3_4Out(iBuilder, iBuilder->getStreamSetTy(1, 8), segmentSize * 4/3 * bufferSegments);
    68     CircularBuffer Radix64out(iBuilder, iBuilder->getStreamSetTy(1, 8), segmentSize * 4/3 * bufferSegments);
    69     CircularCopybackBuffer Base64out(iBuilder, iBuilder->getStreamSetTy(1, 8), segmentSize * 4/3 * bufferSegments, 1);
     75    StreamSetBuffer * Radix64out = pxDriver.addBuffer(make_unique<CircularBuffer>(iBuilder, iBuilder->getStreamSetTy(1, 8), bufferSize));
     76    Kernel * radix64K = pxDriver.addKernelInstance(make_unique<radix64Kernel>(iBuilder));
     77    pxDriver.makeKernelCall(radix64K, {Expanded3_4Out}, {Radix64out});
    7078   
    71     MMapSourceKernel mmapK(iBuilder, segmentSize);
    72     mmapK.setInitialArguments({fileDescriptor});
    73     pxDriver.addKernelCall(mmapK, {}, {&ByteStream});
     79    StreamSetBuffer * Base64out = pxDriver.addBuffer(make_unique<CircularBuffer>(iBuilder, iBuilder->getStreamSetTy(1, 8), bufferSize));
     80    Kernel * base64K = pxDriver.addKernelInstance(make_unique<base64Kernel>(iBuilder));
     81    pxDriver.makeKernelCall(base64K, {Radix64out}, {Base64out});
    7482   
    75     expand3_4Kernel expandK(iBuilder);
    76     pxDriver.addKernelCall(expandK, {&ByteStream}, {&Expanded3_4Out});
    77 
    78     radix64Kernel radix64K(iBuilder);
    79     pxDriver.addKernelCall(radix64K, {&Expanded3_4Out}, {&Radix64out});
    80 
    81     base64Kernel base64K(iBuilder);
    82     pxDriver.addKernelCall(base64K, {&Radix64out}, {&Base64out});
     83    Kernel * outK = pxDriver.addKernelInstance(make_unique<StdOutKernel>(iBuilder, 8));
     84    pxDriver.makeKernelCall(outK, {Base64out}, {});
    8385   
    84     StdOutKernel stdoutK(iBuilder, 8);
    85     pxDriver.addKernelCall(stdoutK, {&Base64out}, {});
    86    
    87     iBuilder->SetInsertPoint(BasicBlock::Create(mod->getContext(), "entry", main,0));
    88 
    89     ByteStream.allocateBuffer(iBuilder);
    90     Expanded3_4Out.allocateBuffer(iBuilder);
    91     Radix64out.allocateBuffer(iBuilder);
    92     Base64out.allocateBuffer(iBuilder);
    93 
    9486    pxDriver.generatePipelineIR();
    9587
Note: See TracChangeset for help on using the changeset viewer.