Changeset 5822


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

s2p written using proposed Pablo PackL and PackH operations

Location:
icGREP/icgrep-devel/icgrep/kernels
Files:
2 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}
  • icGREP/icgrep-devel/icgrep/kernels/s2p_kernel.h

    r5690 r5822  
    77
    88#include "kernel.h"  // for KernelBuilder
     9
     10#ifdef PABLO_PACKING
     11#include <pablo/pablo_kernel.h>
     12#endif
     13
    914namespace IDISA { class IDISA_Builder; }  // lines 14-14
    1015namespace llvm { class Value; }
     
    3136};
    3237
     38#ifdef PABLO_PACKING
     39
     40class S2P_PabloKernel final : public pablo::PabloKernel {
     41public:
     42    S2P_PabloKernel(const std::unique_ptr<KernelBuilder> & b, unsigned codeUnitWidth);
     43    bool isCachable() const override { return true; }
     44    bool hasSignature() const override { return false; }
     45protected:
     46    void generatePabloMethod() override;
     47    unsigned mCodeUnitWidth;
     48};
     49#endif
     50
    3351}
    3452#endif
Note: See TracChangeset for help on using the changeset viewer.