Ignore:
Timestamp:
Apr 15, 2017, 4:42:33 PM (2 years ago)
Author:
nmedfort
Message:

First attempt to allow Kernels to wait for consumers to finish processing before performing a realloc.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/kernels/grep_kernel.cpp

    r5404 r5408  
    1515using namespace llvm;
    1616
    17 static std::string sha1sum(const std::string & str) {
     17inline static std::string sha1sum(const std::string & str) {
    1818    char buffer[41];    // 40 hex-digits and the terminating null
    19     unsigned int digest[5];     // 160 bits in total
    20    
     19    uint32_t digest[5]; // 160 bits in total
    2120    boost::uuids::detail::sha1 sha1;
    2221    sha1.process_bytes(str.c_str(), str.size());
     
    2726}
    2827
    29 ICgrepKernelBuilder::ICgrepKernelBuilder (IDISA::IDISA_Builder * iBuilder, RE * re_ast, bool CountOnly)
     28inline std::string makeSignature(RE * const re_ast, const bool CountOnly) {
     29    std::string signature = Printer_RE::PrintRE(re_ast);
     30    if (CountOnly) {
     31        signature += "-c";
     32    }
     33    return signature;
     34}
     35
     36ICgrepKernelBuilder::ICgrepKernelBuilder (IDISA::IDISA_Builder * const iBuilder, RE * const re_ast, const bool CountOnly)
    3037: PabloKernel(iBuilder, "",
    3138              {Binding{iBuilder->getStreamSetTy(8), "basis"}, Binding{iBuilder->getStreamSetTy(1, 1), "linebreak"}},
    3239              CountOnly ? std::vector<Binding>{} : std::vector<Binding>{Binding{iBuilder->getStreamSetTy(1, 1), "matches"}},
    3340              {},
    34               CountOnly ? std::vector<Binding>{Binding{iBuilder->getSizeTy(), "matchedLineCount"}} : std::vector<Binding>{}),
    35   mCountOnly(CountOnly),
    36   mRE(re_ast) {
    37    
    38     mSignature = Printer_RE::PrintRE(re_ast);
    39     if (CountOnly) {
    40         mSignature += "-c";
    41     }
    42     std::string uniqueID = sha1sum(mSignature);
    43     setName("Parabix:" + uniqueID);
     41              CountOnly ? std::vector<Binding>{Binding{iBuilder->getSizeTy(), "matchedLineCount"}} : std::vector<Binding>{})
     42, mCountOnly(CountOnly)
     43, mRE(re_ast)
     44, mSignature(makeSignature(re_ast, CountOnly)) {
     45    setName("Parabix:" + sha1sum(mSignature));
    4446}
    4547
Note: See TracChangeset for help on using the changeset viewer.