Ignore:
Timestamp:
Jun 25, 2016, 9:07:07 AM (3 years ago)
Author:
cameron
Message:

Kernel infrastructure: move common logic into KernelBuilder? base class; demo linking in wc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/kernels/deletion.cpp

    r5071 r5074  
    4949
    5050
    51 void deletionKernel::generateKernel() {
     51void deletionKernel::generateDoBlockMethod() {
    5252    IDISA::IDISA_Builder::InsertPoint savePoint = iBuilder->saveIP();
    53     if (mKernelStateType == nullptr) finalizeKernelStateType();
    54     KernelBuilder::generateKernel();
     53    Module * m = iBuilder->getModule();
    5554   
    56     Module * m = iBuilder->getModule();
    57     unsigned blockSize = iBuilder->getBitBlockWidth();
    5855    Function * doBlockFunction = m->getFunction(mKernelName + doBlock_suffix);
    59     Function * finalBlockFunction = m->getFunction(mKernelName + finalBlock_suffix);
    6056   
    6157    iBuilder->SetInsertPoint(BasicBlock::Create(iBuilder->getContext(), "entry", doBlockFunction, 0));
     
    6864   
    6965    std::vector<Value *> move_masks = parallel_prefix_deletion_masks(iBuilder, mDeletionFieldWidth, del_mask);
    70        
     66   
    7167    for (unsigned j = 0; j < mStreamCount; ++j) {
    7268        Value * input = iBuilder->CreateBlockAlignedLoad(inputStreamBlock, {iBuilder->getInt32(0), iBuilder->getInt32(j)});
     
    7672    Value * counts = partial_sum_popcount(iBuilder, mDeletionFieldWidth, iBuilder->simd_not(del_mask));
    7773    iBuilder->CreateBlockAlignedStore(iBuilder->bitCast(counts), delCountBlock, {iBuilder->getInt32(0), iBuilder->getInt32(0)});
    78                                          
     74   
    7975    iBuilder->CreateRetVoid();
     76    iBuilder->restoreIP(savePoint);
     77}
     78
     79void deletionKernel::generateFinalBlockMethod() {
     80    IDISA::IDISA_Builder::InsertPoint savePoint = iBuilder->saveIP();
     81    Module * m = iBuilder->getModule();
    8082   
     83    unsigned blockSize = iBuilder->getBitBlockWidth();
     84    Function * doBlockFunction = m->getFunction(mKernelName + doBlock_suffix);
     85    Function * finalBlockFunction = m->getFunction(mKernelName + finalBlock_suffix);
     86
    8187    iBuilder->SetInsertPoint(BasicBlock::Create(iBuilder->getContext(), "entry", finalBlockFunction, 0));
    8288    Value * remainingBytes = getParameter(finalBlockFunction, "remainingBytes");
    83     inputStreamBlock = getParameter(finalBlockFunction, "inputStreamSet");
    84     outputStreamBlock = getParameter(finalBlockFunction, "outputStreamSet");
    85     delCountBlock = getParameter(finalBlockFunction, "deletionCounts");
     89    Value * inputStreamBlock = getParameter(finalBlockFunction, "inputStreamSet");
    8690    Value * remaining = iBuilder->CreateZExt(remainingBytes, iBuilder->getIntNTy(blockSize));
    8791    Value * EOF_del = iBuilder->bitCast(iBuilder->CreateShl(Constant::getAllOnesValue(iBuilder->getIntNTy(blockSize)), remaining));
Note: See TracChangeset for help on using the changeset viewer.