Ignore:
Timestamp:
Apr 24, 2018, 2:57:34 PM (14 months ago)
Author:
nmedfort
Message:

Restructured MultiBlock? kernel. Removal of Swizzled buffers. Inclusion of PopCount? rates / non-linear access. Modifications to several kernels to better align them with the kernel and pipeline changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/pablo/pablo_kernel.cpp

    r5843 r5985  
    145145#endif
    146146
    147 void PabloKernel::generateFinalBlockMethod(const std::unique_ptr<KernelBuilder> & iBuilder, Value * const remainingBytes) {
     147void PabloKernel::generateFinalBlockMethod(const std::unique_ptr<KernelBuilder> & b, Value * const remainingBytes) {
    148148    // Standard Pablo convention for final block processing: set a bit marking
    149149    // the position just past EOF, as well as a mask marking all positions past EOF.
    150     iBuilder->setScalarField("EOFbit", iBuilder->bitblock_set_bit(remainingBytes));
    151     iBuilder->setScalarField("EOFmask", iBuilder->bitblock_mask_from(remainingBytes));
    152     CreateDoBlockMethodCall(iBuilder);
     150    b->setScalarField("EOFbit", b->bitblock_set_bit(remainingBytes));
     151    b->setScalarField("EOFmask", b->bitblock_mask_from(remainingBytes));
     152    CreateDoBlockMethodCall(b);
     153
     154//    // TODO: clean this up. what if we have a subclass of block oriented kernels that has hooks for inserting code
     155//    // before/after calling the do block logic? it would simplify the logic and hopefully allow easier use. Moreover
     156//    // we may be able to convert some of the final block only scalars to stack oriented ones
     157
     158//    Value * const baseOutputItems = getRemainingItems(b);
     159//    // clear all of the outputs past the EOF mark
     160//    for (unsigned i = 0; i < mStreamSetOutputs.size(); ++i) {
     161//        const Binding & output = mStreamSetOutputs[i];
     162//        // TODO: test if this is a bitstream output
     163//        Value * outputItems = baseOutputItems;
     164//        for (const kernel::Attribute & attr : output.getAttributes()) {
     165//            if (attr.isAdd()) {
     166//                outputItems = b->CreateAdd(outputItems, b->getSize(attr.amount()));
     167//                break;
     168//            }
     169//        }
     170//        Value * const inFileMask = b->CreateNot(b->bitblock_mask_from(outputItems));
     171//        BasicBlock * const zeroOutEntry = b->GetInsertBlock();
     172//        BasicBlock * const zeroOutLoop = b->CreateBasicBlock();
     173//        BasicBlock * const zeroOutExit = b->CreateBasicBlock();
     174//        Value * const n = b->getOutputStreamSetCount(output.getName());
     175//        b->CreateBr(zeroOutLoop);
     176
     177//        b->SetInsertPoint(zeroOutLoop);
     178//        PHINode * const streamIndex = b->CreatePHI(b->getSizeTy(), 2);
     179//        streamIndex->addIncoming(b->getSize(0), zeroOutEntry);
     180//        Value * const ptr = b->getOutputStreamBlockPtr(output.getName(), streamIndex);
     181//        Value * const value = b->CreateBlockAlignedLoad(ptr);
     182//        b->CreateBlockAlignedStore(b->CreateAnd(value, inFileMask), ptr);
     183//        Value * const nextStreamIndex = b->CreateAdd(streamIndex, b->getSize(1));
     184//        streamIndex->addIncoming(nextStreamIndex, zeroOutLoop);
     185//        b->CreateCondBr(b->CreateICmpNE(nextStreamIndex, n), zeroOutLoop, zeroOutExit);
     186
     187//        b->SetInsertPoint(zeroOutExit);
     188//    }
     189
    153190}
    154191
Note: See TracChangeset for help on using the changeset viewer.