Ignore:
Timestamp:
Jan 7, 2018, 1:45:23 PM (17 months ago)
Author:
cameron
Message:

s2p written using proposed Pablo PackL and PackH operations

File:
1 edited

Legend:

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

    r5793 r5822  
    212212    }
    213213}
    214 }
     214#ifdef PABLO_PACKING
     215void S2P_PabloKernel::generatePabloMethod() {
     216    auto pb = this->getEntryBlock();
     217    const unsigned steps = std::log2(mCodeUnitWidth);
     218    std::vector<PabloAST *> streamSet[steps + 1];
     219    streamSet[0].push_back(pb->createExtract(getInputStreamVar("codeUnitStream"), pb->getInteger(0)));
     220    unsigned streamWidth = mCodeUnitWidth;
     221    for (unsigned step = 1; step <= steps; step++) {
     222        for (auto strm : streamSet[i-1]) {
     223            streamSet[i].push_back(pb.createPackL(streamWidth, strm));
     224            streamSet[i].push_back(pb.createPackH(streamWidth, strm));
     225        }
     226        streamWidth = streamWidth/2;
     227    }
     228    for (unsigned bit = 0; bit <= mCodeUnitWidth, bit++) {
     229        pb.createAssign(pb.createExtract(getInputStreamVar("basisBits"), pb.getInteger(bit)), streamSet[steps][bit]);
     230    }
     231}
     232
     233S2P_PabloKernel::S2P_PabloKernel(const std::unique_ptr<kernel::KernelBuilder> & b, const unsigned codeUnitWidth)
     234: PabloKernel(b, "s2p_pablo" + std::to_string(codeUnitWidth),
     235    {Binding{b->getStreamSetTy(1, codeUnitWidth), "codeUnitStream"}},
     236    {Binding{b->getStreamSetTy(codeUnitWidth, 1), "basisBits"}}, {}, {}, {}),
     237  mCodeUnitWidth(codeUnitWidth) {
     238}
     239
     240#endif
     241
     242}
Note: See TracChangeset for help on using the changeset viewer.