Ignore:
Timestamp:
Dec 21, 2017, 3:22:41 PM (15 months ago)
Author:
cameron
Message:

Adding Alphabet to CCs: initial check-in

File:
1 edited

Legend:

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

    r5793 r5795  
    4747using namespace parabix;
    4848using namespace llvm;
     49using namespace cc;
     50
    4951static cl::opt<int> Threads("t", cl::desc("Total number of threads."), cl::init(2));
    5052
     
    125127#define USE_MULTIPLEX_CC
    126128#ifdef USE_MULTIPLEX_CC
    127         std::tie<re::RE*, std::vector<re::CC *>>(REs[i], charclasses[i]) = multiplexing_passes(REs[i]);
    128         const auto numOfCharacterClasses = charclasses[i].size();
     129       
     130        REs[i] = multiplexing_prepasses(REs[i]);
     131        const std::vector<const re::CC *> UnicodeSets = re::collectUnicodeSets(REs[i]);
     132        std::unique_ptr<cc::MultiplexedAlphabet> mpx = make_unique<MultiplexedAlphabet>("mpx", UnicodeSets);
     133        REs[i] = multiplex(REs[i], UnicodeSets, mpx->getExclusiveSetIDs());
     134        std::vector<re::CC *> mpx_basis = mpx->getMultiplexedCCs();
     135        auto numOfCharacterClasses = mpx_basis.size();
    129136        StreamSetBuffer * CharClasses = mGrepDriver->addBuffer<CircularBuffer>(idb, idb->getStreamSetTy(numOfCharacterClasses), segmentSize * bufferSegments);
    130         kernel::Kernel * ccK = mGrepDriver->addKernelInstance<kernel::CharClassesKernel>(idb, std::move(charclasses[i]));
     137        kernel::Kernel * ccK = mGrepDriver->addKernelInstance<kernel::CharClassesKernel>(idb, std::move(mpx_basis));
    131138        mGrepDriver->makeKernelCall(ccK, {BasisBits}, {CharClasses});
    132139        StreamSetBuffer * MatchResults = mGrepDriver->addBuffer<CircularBuffer>(idb, idb->getStreamSetTy(1, 1), segmentSize * bufferSegments);
     
    409416
    410417bool GrepEngine::searchAllFiles() {
    411     const unsigned numOfThreads = Threads; // <- convert the command line value into an integer to allow stack allocation
    412     pthread_t threads[numOfThreads];
     418    const unsigned numOfThreads = std::min(static_cast<unsigned>(Threads), static_cast<unsigned>(inputFiles.size()));
     419    std::vector<pthread_t> threads(numOfThreads);
    413420
    414421    for(unsigned long i = 1; i < numOfThreads; ++i) {
     
    470477        pthread_exit(nullptr);
    471478    } else {
    472         return nullptr;
    473     }
    474 }
    475 
    476 }
     479        // Always perform one final cache cleanup step.
     480        mGrepDriver->performIncrementalCacheCleanupStep();
     481    }
     482}
     483
     484}
Note: See TracChangeset for help on using the changeset viewer.