Changeset 6147


Ignore:
Timestamp:
Aug 14, 2018, 4:40:55 AM (3 months ago)
Author:
xwa163
Message:

Fix bug of multiplexing grep kernel cause by cacheable (Since two multiplexed RE with them same representation “mpx_1” may have different alphabets, while for now GrepKernel? use the string representation of RE AST as cache key)

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

Legend:

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

    r6130 r6147  
    414414    //                kernel::Kernel * ccK = mGrepDriver->addKernelInstance<kernel::CharClassesKernel>(idb, std::move(mpx_basis), true);
    415415    //                mGrepDriver->makeKernelCall(ccK, {ByteStream}, {CharClasses});
    416                     kernel::Kernel * icgrepK = mGrepDriver->addKernelInstance<kernel::ICGrepKernel>(idb, mREs[i], externalStreamNames, std::vector<cc::Alphabet *>{mpx.get()}, cc::BitNumbering::LittleEndian);
     416                    kernel::ICGrepKernel * icgrepK = (kernel::ICGrepKernel*)mGrepDriver->addKernelInstance<kernel::ICGrepKernel>(idb, mREs[i], externalStreamNames, std::vector<cc::Alphabet *>{mpx.get()}, cc::BitNumbering::LittleEndian);
     417                    // Multiplexing Grep Kernel is not Cachable, since for now it use string representation of RE AST as cache key,
     418                    // whileit is possible that two multiplexed REs with the same name "mpx_1" have different alphabets
     419                    icgrepK->setCachable(false);
    417420                    icgrepInputSets.push_back(CharClasses);
    418421                    mGrepDriver->makeKernelCall(icgrepK, icgrepInputSets, {MatchResults});
  • icGREP/icgrep-devel/icgrep/kernels/grep_kernel.cpp

    r6133 r6147  
    230230: mRE(re_ast)
    231231, mSignature(Printer_RE::PrintRE(mRE)) {
    232    
     232
    233233}
    234234
     
    259259, mExternals(externals)
    260260, mAlphabets(alphabets)
    261 , mBasisSetNumbering(basisSetNumbering) {
     261, mBasisSetNumbering(basisSetNumbering)
     262, mIsCachable(true) {
    262263}
    263264
  • icGREP/icgrep-devel/icgrep/kernels/grep_kernel.h

    r6133 r6147  
    6464    ICGrepKernel(const std::unique_ptr<kernel::KernelBuilder> & iBuilder, re::RE * const re_ast, std::vector<std::string> externals, std::vector<cc::Alphabet *> alphabets = {}, cc::BitNumbering basisSetNumbering = cc::BitNumbering::LittleEndian);
    6565    std::string makeSignature(const std::unique_ptr<kernel::KernelBuilder> & iBuilder) override;
    66     bool isCachable() const override { return true; }
     66    bool isCachable() const override { return mIsCachable; }
     67    void setCachable(bool c){mIsCachable = c;}
    6768protected:
    6869    void generatePabloMethod() override;
     
    7071    std::vector<cc::Alphabet *> mAlphabets;
    7172    cc::BitNumbering mBasisSetNumbering;
     73private:
     74    bool mIsCachable;
    7275};
    7376
  • icGREP/icgrep-devel/icgrep/lz4/grep/lz4_grep_base_generator.cpp

    r6145 r6147  
    242242    StreamSetBuffer * const MatchResults = mGrepDriver->addBuffer<StaticBuffer>(idb, idb->getStreamSetTy(1, 1), baseBufferSize, 1);
    243243
    244 
     244    // Multiplexing Grep Kernel is not Cachable, since it is possible that two REs with name "mpx_1" have different alphabets
    245245    StreamSetBuffer * LineBreakStream = mPxDriver.addBuffer<StaticBuffer>(idb, idb->getStreamSetTy(1, 1), this->getDefaultBufferBlocks(), 1);
    246     kernel::Kernel * lineFeedGrepK = mGrepDriver->addKernelInstance<kernel::ICGrepKernel>(idb, transformCCs(mpx.get(), linefeedCC), externalStreamNames, std::vector<cc::Alphabet *>{mpx.get()}, cc::BitNumbering::BigEndian);
     246    ICGrepKernel * lineFeedGrepK = (ICGrepKernel *)mGrepDriver->addKernelInstance<kernel::ICGrepKernel>(idb, transformCCs(mpx.get(), linefeedCC), externalStreamNames, std::vector<cc::Alphabet *>{mpx.get()}, cc::BitNumbering::BigEndian);
     247    lineFeedGrepK->setCachable(false);
    247248    mGrepDriver->makeKernelCall(lineFeedGrepK, {fakeMatchCopiedBits, uncompressedCharClasses}, {LineBreakStream});
    248249
     
    250251    externalStreamNames.push_back("UTF8_nonfinal");
    251252
    252     kernel::Kernel * icgrepK = mGrepDriver->addKernelInstance<kernel::ICGrepKernel>(idb, mRE, externalStreamNames, std::vector<cc::Alphabet *>{mpx.get()}, cc::BitNumbering::BigEndian);
     253    ICGrepKernel * icgrepK = (ICGrepKernel *)mGrepDriver->addKernelInstance<kernel::ICGrepKernel>(idb, mRE, externalStreamNames, std::vector<cc::Alphabet *>{mpx.get()}, cc::BitNumbering::BigEndian);
     254    icgrepK->setCachable(false);
    253255    mGrepDriver->makeKernelCall(icgrepK, {fakeMatchCopiedBits, u8NoFinalStream, uncompressedCharClasses}, {MatchResults});
    254256    MatchResultsBufs[0] = MatchResults;
Note: See TracChangeset for help on using the changeset viewer.