Changeset 5819


Ignore:
Timestamp:
Jan 1, 2018, 8:17:29 AM (9 months ago)
Author:
cameron
Message:

Bug fix for multiplexed alphabet mode

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

Legend:

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

    r5817 r5819  
    128128        REs[i] = resolveModesAndExternalSymbols(REs[i]);
    129129        REs[i] = excludeUnicodeLineBreak(REs[i]);
    130 //#define USE_MULTIPLEX_CC
     130#define USE_MULTIPLEX_CC
    131131#ifdef USE_MULTIPLEX_CC
    132132        REs[i] = regular_expression_passes(REs[i]);
  • icGREP/icgrep-devel/icgrep/kernels/grep_kernel.cpp

    r5816 r5819  
    1919#include <cc/cc_compiler.h>         // for CC_Compiler
    2020#include <cc/alphabet.h>
     21#include <cc/multiplex_CCs.h>
    2122#include <re/re_compiler.h>
    2223#include <llvm/Support/raw_ostream.h>
     
    176177}
    177178
    178 inline static unsigned ceil_log2(const unsigned v) {
    179     assert ("log2(0) is undefined!" && v != 0);
    180     return (sizeof(unsigned) * CHAR_BIT) - __builtin_clz(v - 1U);
    181 }
    182 
    183179// Helper to compute stream set inputs to pass into PabloKernel constructor.
    184180std::vector<Binding> icGrepInputs(const std::unique_ptr<kernel::KernelBuilder> & iBuilder, std::vector<cc::Alphabet *> alphabets) {
     
    188184        Binding{iBuilder->getStreamSetTy(3, 1), "required"}};
    189185    for (unsigned i = 0; i < alphabets.size(); i++) {
    190         unsigned basis_size = ceil_log2(alphabets[i]->getSize());
    191         streamSetInputs.push_back(Binding{iBuilder->getStreamSetTy(basis_size, 1), "basisSet" + std::to_string(i)});
     186        unsigned basis_size = cast<cc::MultiplexedAlphabet>(alphabets[i])->getMultiplexedCCs().size();
     187        streamSetInputs.push_back(Binding{iBuilder->getStreamSetTy(basis_size, 1), alphabets[i]->getName() + "_basis"});
    192188    }
    193189    return streamSetInputs;
     
    213209    RE_Compiler re_compiler(this, cc_compiler);
    214210    for (unsigned i = 0; i < mAlphabets.size(); i++) {
    215         auto basis = getInputStreamVar("basisSet" + std::to_string(i));
     211        auto basis = getInputStreamVar(mAlphabets[i]->getName() + "_basis");
    216212        re_compiler.addAlphabet(mAlphabets[i], basis);
    217213    }
  • icGREP/icgrep-devel/icgrep/re/re_collect_unicodesets.cpp

    r5796 r5819  
    3030        if (CC * cc = dyn_cast<CC>(re)) {
    3131            if (cc->getAlphabet() == &cc::Unicode) {
    32                 UnicodeSets.push_back(cc);
     32                const auto index = find(UnicodeSets.begin(), UnicodeSets.end(), cc) - UnicodeSets.begin();
     33                if (index == UnicodeSets.size()) UnicodeSets.push_back(cc);
    3334            }
    3435        } else if (isa<Name>(re)) {
Note: See TracChangeset for help on using the changeset viewer.