Changeset 5930


Ignore:
Timestamp:
Mar 23, 2018, 9:26:50 AM (11 months ago)
Author:
cameron
Message:

Auto RE grouping/threading

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

Legend:

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

    r5913 r5930  
    3939static cl::opt<bool> ByteMode("enable-byte-mode", cl::desc("Process regular expressions in byte mode"));
    4040
    41 static cl::opt<bool> MultiGrepKernels("enable-multigrep-kernels", cl::desc("Construct separated kernels for each regular expression"));
    42 static cl::opt<int> REsPerGroup("re-num", cl::desc("Number of regular expressions processed by each kernel."), cl::init(1));
     41static cl::opt<int> REsPerGroup("re-num", cl::desc("Number of regular expressions processed by each kernel."), cl::init(0));
    4342
    4443static re::ModeFlagSet globalFlags = re::MULTILINE_MODE_FLAG;
     
    7473    }
    7574
    76     if (MultiGrepKernels) {
     75   
     76    // If there are multiple REs, combine them into groups.
     77    // A separate kernel will be created for each group.
     78    if (REs.size() > 1) {
     79        codegen::SegmentPipelineParallel = true;
     80        if (REsPerGroup == 0) {
     81            // If no grouping factor is specified, we use a default formula.
     82            REsPerGroup = (REs.size() + codegen::ThreadNum) / (codegen::ThreadNum + 1);
     83        }
    7784        std::vector<re::RE *> groups;
    7885        auto start = REs.begin();
     
    8895            groups.push_back(*start);
    8996        }
    90         REs.swap(groups);
    91     } else if (REs.size() > 1) {
    92         REs.assign({re::makeAlt(REs.begin(), REs.end())});
    93     }
    94 
     97    REs.swap(groups);
     98    }
    9599    for (re::RE *& re_ast : REs) {
    96100        assert (re_ast);
  • icGREP/icgrep-devel/icgrep/pablo/analysis/pabloverifier.cpp

    r5836 r5930  
    339339        auto f = mAssignment.find(expr);
    340340        if (LLVM_LIKELY(f == mAssignment.end())) {
    341             mAssignment.insert(std::move(std::make_pair(expr, SmallBitVector(n, true))));
     341            mAssignment.insert(std::make_pair(expr, SmallBitVector(n, true)));
    342342        } else {
    343343            f->second.resize(n, true);
  • icGREP/icgrep-devel/icgrep/toolchain/toolchain.cpp

    r5841 r5930  
    11/*
    2  *  Copyright (c) 2017 International Characters.
     2 *  Copyright (c) 2018 International Characters.
    33 *  This software is licensed to the public under the Open Software License 3.0.
    44 *  icgrep is a trademark of International Characters.
     
    2121namespace codegen {
    2222
     23const unsigned DEFAULT_SEGMENT_SIZE = 64;
     24   
    2325static cl::OptionCategory CodeGenOptions("Code Generation Options", "These options control code generation.");
    2426
     
    6668
    6769
    68 static cl::opt<unsigned, true> SegmentSizeOption("segment-size", cl::location(SegmentSize), cl::init(8),
     70static cl::opt<unsigned, true> SegmentSizeOption("segment-size", cl::location(SegmentSize), cl::init(DEFAULT_SEGMENT_SIZE),
    6971                                            cl::desc("Segment Size"), cl::value_desc("positive integer"));
    7072
Note: See TracChangeset for help on using the changeset viewer.