Changeset 5824


Ignore:
Timestamp:
Jan 9, 2018, 2:52:07 PM (5 months ago)
Author:
cameron
Message:

Test case for compileCCfromCodeUnitStream using DirectLineFeedBuilder?

Location:
icGREP/icgrep-devel/icgrep
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/grep_engine.cpp

    r5819 r5824  
    9797//
    9898// All engines share a common pipeline to compute a stream of Matches from a given input Bytestream.
     99//#define USE_DIRECT_LF_BUILDER 1
    99100
    100101std::pair<StreamSetBuffer *, StreamSetBuffer *> GrepEngine::grepPipeline(std::vector<re::RE *> & REs, StreamSetBuffer * ByteStream) {
     
    109110
    110111    StreamSetBuffer * LineFeedStream = mGrepDriver->addBuffer<CircularBuffer>(idb, idb->getStreamSetTy(1, 1), segmentSize * bufferSegments);
     112#ifdef USE_DIRECT_LF_BUILDER
     113    kernel::Kernel * linefeedK = mGrepDriver->addKernelInstance<kernel::DirectLineFeedBuilder>(idb);
     114    mGrepDriver->makeKernelCall(linefeedK, {ByteStream}, {LineFeedStream});
     115#else
    111116    kernel::Kernel * linefeedK = mGrepDriver->addKernelInstance<kernel::LineFeedKernelBuilder>(idb, encodingBits);
    112117    mGrepDriver->makeKernelCall(linefeedK, {BasisBits}, {LineFeedStream});
     118#endif
    113119
    114120    StreamSetBuffer * LineBreakStream = mGrepDriver->addBuffer<CircularBuffer>(idb, idb->getStreamSetTy(1, 1), segmentSize * bufferSegments);
     
    122128
    123129    const auto n = REs.size();
    124     std::vector<std::vector<re::CC *>> charclasses(n);
    125130    std::vector<StreamSetBuffer *> MatchResultsBufs(n);
    126131
     
    128133        REs[i] = resolveModesAndExternalSymbols(REs[i]);
    129134        REs[i] = excludeUnicodeLineBreak(REs[i]);
     135        REs[i] = regular_expression_passes(REs[i]);
    130136#define USE_MULTIPLEX_CC
    131137#ifdef USE_MULTIPLEX_CC
    132         REs[i] = regular_expression_passes(REs[i]);
    133138        const std::vector<const re::CC *> UnicodeSets = re::collectUnicodeSets(REs[i]);
    134139        if (UnicodeSets.size() <= 1) {
     
    152157        }
    153158#else
    154         REs[i] = regular_expression_passes(REs[i]);
    155159        StreamSetBuffer * MatchResults = mGrepDriver->addBuffer<CircularBuffer>(idb, idb->getStreamSetTy(1, 1), segmentSize * bufferSegments);
    156160        kernel::Kernel * icgrepK = mGrepDriver->addKernelInstance<kernel::ICGrepKernel>(idb, REs[i]);
  • icGREP/icgrep-devel/icgrep/kernels/linebreak_kernel.cpp

    r5797 r5824  
    2121using namespace re;
    2222using namespace llvm;
     23
     24
     25DirectLineFeedBuilder::DirectLineFeedBuilder(const std::unique_ptr<kernel::KernelBuilder> & b)
     26: PabloKernel(b, "lf_byte",
     27// input
     28{Binding{b->getStreamSetTy(1, 8), "codeUnitStream", FixedRate(), Principal()}},
     29// output
     30{Binding{b->getStreamSetTy(1), "lf"}}) {
     31
     32}
     33
     34void DirectLineFeedBuilder::generatePabloMethod() {
     35    PabloBuilder pb(getEntryBlock());
     36    PabloAST * LF = compileCCfromCodeUnitStream(makeByte(0x0A), getInput(0), pb);
     37    pb.createAssign(pb.createExtract(getOutput(0), pb.getInteger(0)), LF);
     38}
    2339
    2440
  • icGREP/icgrep-devel/icgrep/kernels/linebreak_kernel.h

    r5782 r5824  
    1111
    1212namespace kernel {
     13
     14class DirectLineFeedBuilder final : public pablo::PabloKernel {
     15public:
     16    DirectLineFeedBuilder(const std::unique_ptr<KernelBuilder> & b);
     17    bool isCachable() const override { return true; }
     18    bool hasSignature() const override { return false; }
     19protected:
     20    void generatePabloMethod() override;
     21};
     22
    1323
    1424class LineFeedKernelBuilder final : public pablo::PabloKernel {
Note: See TracChangeset for help on using the changeset viewer.