Ignore:
Timestamp:
Jun 24, 2018, 1:28:20 AM (10 months ago)
Author:
xwa163
Message:

Remove S2PByPextKernel

File:
1 edited

Legend:

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

    r6089 r6112  
    242242}
    243243
    244 
    245 S2PByPextKernel::S2PByPextKernel(const std::unique_ptr<kernel::KernelBuilder> &b, cc::BitNumbering numbering, std::string prefix)
    246         : BlockOrientedKernel(prefix + "s2pByPext" + cc::numberingSuffix(numbering),
    247                            {Binding{b->getStreamSetTy(1, 8), "byteStream", FixedRate(), Principal()}},
    248                            {Binding{b->getStreamSetTy(8, 1), "basisBits"}}, {}, {}, {}),
    249     mBasisSetNumbering(numbering) {
    250 }
    251 
    252 void S2PByPextKernel::generateDoBlockMethod(const std::unique_ptr<KernelBuilder> &b) {
    253     Value* inputBasePtr = b->CreatePointerCast(b->getInputStreamBlockPtr("byteStream", b->getSize(0)), b->getInt64Ty()->getPointerTo());
    254     std::vector<Value*> outputPtrs(8, nullptr);
    255     for (unsigned i = 0; i < 8; i++) {
    256         outputPtrs[i] = b->CreatePointerCast(b->getOutputStreamBlockPtr("basisBits", b->getSize(i)), b->getInt64Ty()->getPointerTo());
    257     }
    258     uint64_t base_mask = 0x0101010101010101;
    259 
    260     Constant * pext = Intrinsic::getDeclaration(b->getModule(), Intrinsic::x86_bmi_pext_64);
    261 
    262     for (unsigned iBlockIndex = 0; iBlockIndex < 4; iBlockIndex++) {
    263         std::vector<Value*> tempValues(8, b->getInt64(0));
    264         for (size_t iDataIndex = 0; iDataIndex < 8; iDataIndex++) {
    265             Value* inputData = b->CreateLoad(b->CreateGEP(inputBasePtr, b->getSize(iDataIndex + iBlockIndex * 8)));
    266             for (unsigned iStreamIndex = 0; iStreamIndex < 8; iStreamIndex++) {
    267                 const unsigned bitIndex = mBasisSetNumbering == cc::BitNumbering::LittleEndian ? iStreamIndex : 7 - iStreamIndex;
    268                 Value* targetMask = b->getInt64(base_mask << bitIndex);
    269                 Value * const outputValue = b->CreateCall(pext, {inputData, targetMask});
    270                 tempValues[iStreamIndex] = b->CreateOr(tempValues[iStreamIndex], b->CreateShl(outputValue, b->getInt64(iDataIndex * 8)));
    271             }
    272         }
    273         for (int iStreamIndex = 0; iStreamIndex < 8; iStreamIndex++) {
    274             b->CreateStore(tempValues[iStreamIndex], b->CreateGEP(outputPtrs[iStreamIndex], b->getSize(iBlockIndex)));
    275         }
    276     }
    277 }
    278 }
     244}
Note: See TracChangeset for help on using the changeset viewer.