Ignore:
Timestamp:
Jul 31, 2017, 12:41:52 PM (21 months ago)
Author:
xuedongx
Message:

use multiplexed character classes as the input to grep kernel, restructure the icGrep pipeline: Matches = RE_compiler<regexp>(CharacterClasses?, LineBreaks?)

File:
1 edited

Legend:

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

    r5574 r5585  
    1111#include <UCD/UnicodeNameData.h>
    1212#include <UCD/resolve_properties.h>
     13#include <kernels/charclasses.h>
    1314#include <kernels/cc_kernel.h>
    1415#include <kernels/grep_kernel.h>
     
    2526#include <re/re_toolchain.h>
    2627#include <toolchain/toolchain.h>
     28#include <re/re_name_resolve.h>   
     29#include <re/re_collect_unicodesets.h>
     30#include <re/re_multiplex.h>
    2731#include <toolchain/cpudriver.h>
    2832#include <toolchain/NVPTXDriver.h>
     
    322326    const auto n = REs.size();
    323327   
     328    std::vector<std::vector<UCD::UnicodeSet>> charclasses;
     329
     330    for (unsigned i = 0; i < n; i++) {
     331        std::vector<UCD::UnicodeSet> UnicodeSets;
     332        REs[i] = resolveNames(REs[i]);
     333        re::collect_UnicodeSets(REs[i], UnicodeSets);
     334        std::vector<std::vector<unsigned>> exclusiveSetIDs;
     335        std::vector<UCD::UnicodeSet> multiplexedCCs;
     336
     337        doMultiplexCCs(UnicodeSets, exclusiveSetIDs, multiplexedCCs);
     338
     339        REs[i] = multiplex(REs[i], UnicodeSets, exclusiveSetIDs, multiplexedCCs);
     340        charclasses.push_back(multiplexedCCs);
     341    }
     342
    324343    std::vector<StreamSetBuffer *> MatchResultsBufs(n);
    325    
     344
    326345    for(unsigned i = 0; i < n; ++i){
     346        StreamSetBuffer * CharClasses = grepDriver->addBuffer(make_unique<CircularBuffer>(idb, idb->getStreamSetTy(charclasses[i].size()), segmentSize * bufferSegments));
     347        kernel::Kernel * ccK = grepDriver->addKernelInstance(make_unique<kernel::CharClassesKernel>(idb, charclasses[i]));
     348        grepDriver->makeKernelCall(ccK, {BasisBits}, {CharClasses});
    327349        StreamSetBuffer * MatchResults = grepDriver->addBuffer(make_unique<CircularBuffer>(idb, idb->getStreamSetTy(1, 1), segmentSize * bufferSegments));
    328         kernel::Kernel * icgrepK = grepDriver->addKernelInstance(make_unique<kernel::ICGrepKernel>(idb, REs[i]));
    329         grepDriver->makeKernelCall(icgrepK, {BasisBits, LineBreakStream, RequiredStreams}, {MatchResults});
     350        kernel::Kernel * icgrepK = grepDriver->addKernelInstance(make_unique<kernel::ICGrepKernel>(idb, REs[i], true, charclasses[i].size()));
     351        grepDriver->makeKernelCall(icgrepK, {CharClasses, LineBreakStream, RequiredStreams}, {MatchResults});
    330352        MatchResultsBufs[i] = MatchResults;
    331353    }
Note: See TracChangeset for help on using the changeset viewer.