Ignore:
Timestamp:
Jul 28, 2016, 11:31:36 AM (3 years ago)
Author:
cameron
Message:

u8u16 pipeline

File:
1 edited

Legend:

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

    r5101 r5109  
    219219
    220220using namespace kernel;
     221using namespace parabix;
    221222
    222223const unsigned u16OutputBlocks = 64;
     
    224225Function * u8u16Pipeline(Module * mMod, IDISA::IDISA_Builder * iBuilder, pablo::PabloFunction * function) {
    225226    Type * mBitBlockType = iBuilder->getBitBlockType();
    226     s2pKernel  s2pk(iBuilder);
     227
     228   
     229    ExternalUnboundedBuffer ByteStream(iBuilder, StreamSetType(1, i8));
     230    SingleBlockBuffer BasisBits(iBuilder, StreamSetType(8, i1));
     231    SingleBlockBuffer U8u16Bits(iBuilder, StreamSetType(18, i1));
     232    SingleBlockBuffer U16Bits(iBuilder, StreamSetType(16, i1));
     233    SingleBlockBuffer DeletionCounts(iBuilder, StreamSetType(1, i1));
     234    CircularBuffer U16out(iBuilder, StreamSetType(1, i16), u16OutputBlocks);
     235
     236    s2pKernel  s2pk(iBuilder, ByteStream, BasisBits);
    227237    s2pk.generateKernel();
    228238   
    229239    pablo_function_passes(function);
    230     pablo::PabloKernel  u8u16k(iBuilder, "u8u16", function, {});
     240    pablo::PabloKernel  u8u16k(iBuilder, "u8u16", function, BasisBits, U8u16Bits, {});
    231241    u8u16k.generateKernel();
    232242   
    233     deletionKernel delK(iBuilder, iBuilder->getBitBlockWidth()/16, 16);
     243    deletionKernel delK(iBuilder, iBuilder->getBitBlockWidth()/16, 16, U8u16Bits, U16Bits, DeletionCounts);
    234244    delK.generateKernel();
    235245   
    236     p2s_16Kernel_withCompressedOutput p2sk(iBuilder);   
     246    p2s_16Kernel_withCompressedOutput p2sk(iBuilder, U16Bits, DeletionCounts, U16out);
    237247    p2sk.generateKernel();
    238248   
    239     stdOutKernel stdOutK(iBuilder, 16);
    240     stdOutK.generateKernel();
    241    
    242     Type * const int64ty = iBuilder->getInt64Ty();
     249    Type * const size_ty = iBuilder->getSizeTy();
    243250    Type * i16PtrTy = PointerType::get(iBuilder->getInt16Ty(), 0);
    244251    Type * const voidTy = Type::getVoidTy(mMod->getContext());
    245252    Type * const inputType = PointerType::get(ArrayType::get(ArrayType::get(mBitBlockType, 8), 1), 0);
    246253   
    247     Function * const main = cast<Function>(mMod->getOrInsertFunction("Main", voidTy, inputType, int64ty, nullptr));
     254    Function * const main = cast<Function>(mMod->getOrInsertFunction("Main", voidTy, inputType, size_ty, nullptr));
    248255    main->setCallingConv(CallingConv::C);
    249256    Function::arg_iterator args = main->arg_begin();
     
    256263    iBuilder->SetInsertPoint(BasicBlock::Create(mMod->getContext(), "entry", main,0));
    257264       
    258     kernel::StreamSetBuffer ByteStream(iBuilder, StreamSetType(1, 8), 0);
    259     kernel::StreamSetBuffer BasisBits(iBuilder, StreamSetType(8, 1), 1);
    260     kernel::StreamSetBuffer U8u16Bits(iBuilder, StreamSetType(18, 1), 1);
    261     kernel::StreamSetBuffer U16Bits(iBuilder, StreamSetType(16, 1), 1);
    262     kernel::StreamSetBuffer DeletionCounts(iBuilder, StreamSetType(1, 1), 1);
    263     kernel::StreamSetBuffer U16out(iBuilder, StreamSetType(1, 16), u16OutputBlocks);
    264265
    265266    ByteStream.setStreamSetBuffer(inputStream);
     
    268269    U16Bits.allocateBuffer();
    269270    DeletionCounts.allocateBuffer();
    270     Value * u16out = U16out.allocateBuffer();
    271    
     271    U16out.allocateBuffer();
     272
    272273    Value * s2pInstance = s2pk.createInstance({}, {&ByteStream}, {&BasisBits});
    273274    Value * u8u16Instance = u8u16k.createInstance({}, {&BasisBits}, {&U8u16Bits});
    274275    Value * delInstance = delK.createInstance({}, {&U8u16Bits}, {&U16Bits, &DeletionCounts});
    275276    Value * p2sInstance = p2sk.createInstance({}, {&U16Bits, &DeletionCounts}, {&U16out});
    276     Value * stdOutInstance = stdOutK.createInstance({u16out, iBuilder->CreateGEP(u16out, {iBuilder->getInt32(u16OutputBlocks-2)})}, {&U16out}, {});
    277    
    278     generatePipelineLoop(iBuilder, {&s2pk, &u8u16k, &delK, &p2sk, &stdOutK}, {s2pInstance, u8u16Instance, delInstance, p2sInstance, stdOutInstance}, fileSize);
     277   
     278    generatePipelineLoop(iBuilder, {&s2pk, &u8u16k, &delK, &p2sk}, {s2pInstance, u8u16Instance, delInstance, p2sInstance}, fileSize);
    279279   
    280280    iBuilder->CreateRetVoid();
Note: See TracChangeset for help on using the changeset viewer.