Ignore:
Timestamp:
Feb 2, 2018, 2:49:08 PM (15 months ago)
Author:
nmedfort
Message:

Revised pipeline structure to better control I/O rates

File:
1 edited

Legend:

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

    r5771 r5856  
    6262
    6363    //Round up to a multiple of 3.
    64     const unsigned initSegSize = ((codegen::SegmentSize + 2)/3) * 3;
    65     const unsigned bufferSize = (4 * initSegSize * codegen::BufferSegments) / 3;
     64    const auto bufferSize = ((codegen::SegmentSize * codegen::BufferSegments * codegen::ThreadNum + 2) / 3) * 3;
    6665
    6766    StreamSetBuffer * ByteStream = pxDriver.addBuffer<SourceBuffer>(iBuilder, iBuilder->getStreamSetTy(1, 8));
    68 
    69     Kernel * mmapK = pxDriver.addKernelInstance<MMapSourceKernel>(iBuilder, initSegSize);
     67    Kernel * mmapK = pxDriver.addKernelInstance<MMapSourceKernel>(iBuilder);
    7068    mmapK->setInitialArguments({fileDescriptor});
    7169    pxDriver.makeKernelCall(mmapK, {}, {ByteStream});
    7270   
    73     StreamSetBuffer * Expanded3_4Out = pxDriver.addBuffer<DynamicBuffer>(iBuilder, iBuilder->getStreamSetTy(1, 8), bufferSize);
     71    const auto outputBufferSize = ((bufferSize + 2) / 3) * 4;
     72
     73    StreamSetBuffer * Expanded3_4Out = pxDriver.addBuffer<DynamicBuffer>(iBuilder, iBuilder->getStreamSetTy(1, 8), outputBufferSize);
    7474    Kernel * expandK = pxDriver.addKernelInstance<expand3_4Kernel>(iBuilder);
    7575    pxDriver.makeKernelCall(expandK, {ByteStream}, {Expanded3_4Out});
    7676   
    77     StreamSetBuffer * Radix64out = pxDriver.addBuffer<DynamicBuffer>(iBuilder, iBuilder->getStreamSetTy(1, 8), bufferSize);
     77    StreamSetBuffer * Radix64out = pxDriver.addBuffer<DynamicBuffer>(iBuilder, iBuilder->getStreamSetTy(1, 8), outputBufferSize);
    7878    Kernel * radix64K = pxDriver.addKernelInstance<radix64Kernel>(iBuilder);
    7979    pxDriver.makeKernelCall(radix64K, {Expanded3_4Out}, {Radix64out});
     
    8383        Kernel * base64K = pxDriver.addKernelInstance<base64Kernel>(iBuilder);
    8484        pxDriver.makeKernelCall(base64K, {Radix64out}, {Base64out});
    85     }
    86     else {
    87         StreamSetBuffer * Base64out = pxDriver.addBuffer<DynamicBuffer>(iBuilder, iBuilder->getStreamSetTy(1, 8), bufferSize);
     85    } else {
     86        StreamSetBuffer * Base64out = pxDriver.addBuffer<DynamicBuffer>(iBuilder, iBuilder->getStreamSetTy(1, 8), outputBufferSize);
    8887        Kernel * base64K = pxDriver.addKernelInstance<base64Kernel>(iBuilder);
    89         pxDriver.makeKernelCall(base64K, {Radix64out}, {Base64out});
    90        
     88        pxDriver.makeKernelCall(base64K, {Radix64out}, {Base64out});       
    9189        Kernel * outK = pxDriver.addKernelInstance<StdOutKernel>(iBuilder, 8);
    9290        pxDriver.makeKernelCall(outK, {Base64out}, {});
Note: See TracChangeset for help on using the changeset viewer.