Changeset 4984 for icGREP


Ignore:
Timestamp:
Mar 22, 2016, 7:01:54 AM (3 years ago)
Author:
cameron
Message:

Refactor IDISA, re, pablo toolchain components

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

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/CMakeLists.txt

    r4974 r4984  
    5252find_package(Boost 1.46 COMPONENTS system iostreams filesystem REQUIRED)
    5353
    54 SET(PABLO_SRC pablo/pabloAST.cpp pablo/ps_if.cpp pablo/ps_while.cpp pablo/function.cpp pablo/codegenstate.cpp pablo/builder.cpp pablo/symbol_generator.cpp pablo/printer_pablos.cpp)
    55 SET(PABLO_SRC ${PABLO_SRC} pablo/pablo_compiler.cpp pablo/carry_manager.cpp pablo/carry_data.cpp IDISA/idisa_builder.cpp IDISA/idisa_avx_builder.cpp IDISA/idisa_i64_builder.cpp IDISA/idisa_sse_builder.cpp kernels/s2p_kernel.cpp kernels/scanmatchgen.cpp kernels/kernel.cpp kernels/pipeline.cpp)
     54SET(PABLO_SRC pablo/pabloAST.cpp pablo/ps_if.cpp pablo/ps_while.cpp pablo/function.cpp pablo/codegenstate.cpp pablo/builder.cpp pablo/symbol_generator.cpp pablo/printer_pablos.cpp pablo/pablo_toolchain.cpp)
     55SET(PABLO_SRC ${PABLO_SRC} pablo/pablo_compiler.cpp pablo/carry_manager.cpp pablo/carry_data.cpp IDISA/idisa_builder.cpp IDISA/idisa_avx_builder.cpp IDISA/idisa_i64_builder.cpp IDISA/idisa_sse_builder.cpp IDISA/idisa_target.cpp kernels/s2p_kernel.cpp kernels/scanmatchgen.cpp kernels/kernel.cpp kernels/pipeline.cpp)
    5656SET(PABLO_SRC ${PABLO_SRC} pablo/analysis/pabloverifier.cpp)
    5757SET(PABLO_SRC ${PABLO_SRC} pablo/optimizers/pablo_simplifier.cpp pablo/optimizers/codemotionpass.cpp)
     
    6363add_library(PabloADT ${PABLO_SRC})
    6464add_library(RegExpADT re/re_re.cpp re/re_cc.cpp re/re_rep.cpp re/re_diff.cpp re/re_intersect.cpp re/printer_re.cpp)
    65 add_library(RegExpCompiler re/re_parser.cpp re/parsefailure.cpp re/re_nullable.cpp re/re_simplifier.cpp re/re_compiler.cpp re/re_analysis.cpp)
     65add_library(RegExpCompiler re/re_parser.cpp re/parsefailure.cpp re/re_nullable.cpp re/re_simplifier.cpp re/re_compiler.cpp re/re_analysis.cpp re/re_toolchain.cpp)
    6666add_library(CCADT cc/cc_compiler.cpp utf8_encoder.cpp UCD/CaseFolding_txt.cpp)
    6767add_library(UCDlib UCD/unicode_set.cpp UCD/ucd_compiler.cpp UCD/PropertyObjects.cpp UCD/resolve_properties.cpp UCD/UnicodeNameData.cpp)
  • icGREP/icgrep-devel/icgrep/grep_engine.cpp

    r4974 r4984  
    66
    77#include <grep_engine.h>
     8#include <IDISA/idisa_builder.h>
     9#include <IDISA/idisa_target.h>
     10#include <re/re_toolchain.h>
     11#include <pablo/pablo_toolchain.h>
    812#include <toolchain.h>
    913#include <utf_encoding.h>
     
    119123    re_ast = regular_expression_passes(encoding, re_ast);   
    120124    pablo::PabloFunction * function = re2pablo_compiler(encoding, re_ast);
     125   
    121126
    122127    pipelineBuilder.CreateKernels(function, isNameExpression);
  • icGREP/icgrep-devel/icgrep/toolchain.cpp

    r4983 r4984  
    88#include <iostream>
    99#include <fstream>
     10#include <sstream>
    1011
    1112#include <llvm/IR/Function.h>
     
    1920#include <llvm/Support/TargetSelect.h>
    2021#include <llvm/Support/Host.h>
    21 
    22 #include <IDISA/idisa_avx_builder.h>
    23 #include <IDISA/idisa_sse_builder.h>
    24 #include <IDISA/idisa_i64_builder.h>
    25 #ifndef DISABLE_PREGENERATED_UCD_FUNCTIONS
    26 #include <UCD/precompiled_properties.h>
    27 #endif
    28 #include <re/re_cc.h>
    29 #include <re/re_nullable.h>
    30 #include <re/re_simplifier.h>
    31 #include <re/re_alt.h>
    32 #include <re/parsefailure.h>
    33 #include <re/re_parser.h>
    34 #include <re/re_compiler.h>
    35 #include <utf8_encoder.h>
    36 #include <cc/cc_compiler.h>
    37 #include <pablo/pablo_compiler.h>
    38 #include <pablo/optimizers/pablo_simplifier.hpp>
    39 #include <pablo/optimizers/codemotionpass.h>
    40 #include <pablo/passes/flattenassociativedfg.h>
    41 #include <pablo/passes/factorizedfg.h>
    42 #ifdef ENABLE_MULTIPLEXING
    43 #include <pablo/optimizers/pablo_automultiplexing.hpp>
    44 #include <pablo/optimizers/pablo_bddminimization.h>
    45 #include <pablo/optimizers/distributivepass.h>
    46 #include <pablo/optimizers/schedulingprepass.h>
    47 #endif
    48 #include <pablo/function.h>
    49 #include <pablo/analysis/pabloverifier.hpp>
    50 #include <re/printer_re.h>
    51 #include <pablo/printer_pablos.h>
    52 #include <object_cache.h>
     22#include <llvm/Support/raw_ostream.h>
     23
    5324// Dynamic processor detection
    5425#define ISPC_LLVM_VERSION ISPC_LLVM_3_6
    5526#include <util/ispc.cpp>
    56 #include <sstream>
    57 
    58 using namespace pablo;
     27
     28#include <re/re_cc.h>
     29#include <object_cache.h>
    5930
    6031static cl::OptionCategory bGrepOutputOptions("Output Options",
     
    7243
    7344
    74 static cl::OptionCategory cRegexOutputOptions("Regex Dump Options",
    75                                               "These options control printing of intermediate regular expression structures.");
    76 static cl::opt<bool> PrintAllREs("print-REs", cl::init(false), cl::desc("print regular expression passes"), cl::cat(cRegexOutputOptions));
    77 static cl::opt<bool> PrintParsedREs("print-parsed-REs", cl::init(false), cl::desc("print out parsed regular expressions"), cl::cat(cRegexOutputOptions));
    78 static cl::opt<bool> PrintStrippedREs("print-stripped-REs", cl::init(false), cl::desc("print out REs with nullable prefixes/suffixes removed"), cl::cat(cRegexOutputOptions));
    79 static cl::opt<bool> PrintNamedREs("print-named-REs", cl::init(false), cl::desc("print out named REs"), cl::cat(cRegexOutputOptions));
    80 static cl::opt<bool> PrintUTF8REs("print-utf8-REs", cl::init(false), cl::desc("print out UTF-8 REs"), cl::cat(cRegexOutputOptions));
    81 static cl::opt<bool> PrintSimplifiedREs("print-simplified-REs", cl::init(false), cl::desc("print out final simplified REs"), cl::cat(cRegexOutputOptions));
    82 
    83 static cl::OptionCategory dPabloDumpOptions("Pablo Dump Options", "These options control printing of intermediate Pablo code.");
    84 
    85 static cl::opt<bool> PrintOptimizedREcode("print-pablo", cl::init(false), cl::desc("print final optimized Pablo code"), cl::cat(dPabloDumpOptions));
    86 static cl::opt<bool> PrintCompiledCCcode("print-CC-pablo", cl::init(false), cl::desc("print Pablo output from character class compiler"), cl::cat(dPabloDumpOptions));
    87 static cl::opt<bool> PrintCompiledREcode("print-RE-pablo", cl::init(false), cl::desc("print Pablo output from the regular expression compiler"), cl::cat(dPabloDumpOptions));
    88 static cl::opt<std::string> PabloOutputFilename("print-pablo-output", cl::init(""), cl::desc("output Pablo filename"), cl::cat(dPabloDumpOptions));
    8945
    9046static cl::OptionCategory cMachineCodeOptimization("Machine Code Optimizations", "These options control back-end compilier optimization levels.");
     
    9450                              cl::cat(cMachineCodeOptimization), cl::Prefix, cl::ZeroOrMore, cl::init('0'));
    9551
    96 static cl::OptionCategory cPabloOptimizationsOptions("Pablo Optimizations", "These options control Pablo optimization passes.");
    97 
    98 static cl::opt<bool> DisableSimplification("disable-simplification", cl::init(false),
    99                                      cl::desc("Disable Pablo Simplification pass (not recommended)"),
    100                                      cl::cat(cPabloOptimizationsOptions));
    101 
    102 static cl::opt<bool> PabloSinkingPass("sinking", cl::init(false),
    103                                       cl::desc("Moves all instructions into the innermost legal If-scope so that they are only executed when needed."),
    104                                       cl::cat(cPabloOptimizationsOptions));
    105 
    106 #ifdef ENABLE_MULTIPLEXING
    107 static cl::opt<bool> PrintUnloweredCode("print-unlowered-pablo", cl::init(false), cl::desc("print Pablo output prior to lowering. "), cl::cat(dPabloDumpOptions));
    108 
    109 static cl::opt<bool> EnableMultiplexing("multiplexing", cl::init(false),
    110                                         cl::desc("combine Advances whose inputs are mutual exclusive into the fewest number of advances possible (expensive)."),
    111                                         cl::cat(cPabloOptimizationsOptions));
    112 
    113 static cl::opt<bool> EnableLowering("lowering", cl::init(false),
    114                                          cl::desc("coalesce associative functions prior to optimization passes."),
    115                                          cl::cat(cPabloOptimizationsOptions));
    116 
    117 static cl::opt<bool> EnablePreDistribution("pre-dist", cl::init(false),
    118                                          cl::desc("apply distribution law optimization prior to multiplexing."),
    119                                          cl::cat(cPabloOptimizationsOptions));
    120 
    121 static cl::opt<bool> EnablePostDistribution("post-dist", cl::init(false),
    122                                          cl::desc("apply distribution law optimization after multiplexing."),
    123                                          cl::cat(cPabloOptimizationsOptions));
    124 
    125 static cl::opt<bool> EnablePrePassScheduling("pre-pass-scheduling", cl::init(false),
    126                                          cl::desc("apply pre-pass scheduling prior to LLVM IR generation."),
    127                                          cl::cat(cPabloOptimizationsOptions));
    128 #endif
    129 
    130 static cl::OptionCategory dCodeGenOptions("Code Generation Options", "These options control code generation.");
    131 
    132 static cl::opt<bool> DisableAVX2("disable-AVX2", cl::init(false), cl::desc("disable AVX2 instruction set."), cl::cat(dCodeGenOptions));
    133 
    134 static cl::opt<int> BlockSize("BlockSize", cl::init(0), cl::desc("specify a block size (defaults to widest SIMD register width in bits)."), cl::cat(dCodeGenOptions));
    135 
    13652
    13753static cl::OptionCategory cObjectCache("Object Caching", "These options control back-end object caching behaviours.");
     
    14056
    14157static cl::opt<std::string> ObjectCacheDir("object-cache-dir", cl::init(""), cl::desc("Path to the object cache diretory"), cl::cat(cObjectCache));
    142 
    143 re::RE * regular_expression_passes(const Encoding encoding, re::RE * re_ast)  {
    144     if (PrintAllREs || PrintParsedREs) {
    145         std::cerr << "Parser:" << std::endl << Printer_RE::PrintRE(re_ast) << std::endl;
    146     }
    147 
    148     //Optimization passes to simplify the AST.
    149     re_ast = re::RE_Nullable::removeNullablePrefix(re_ast);
    150     if (PrintAllREs || PrintStrippedREs) {
    151         std::cerr << "RemoveNullablePrefix:" << std::endl << Printer_RE::PrintRE(re_ast) << std::endl;
    152     }
    153     re_ast = re::RE_Nullable::removeNullableSuffix(re_ast);
    154     if (PrintAllREs || PrintStrippedREs) {
    155         std::cerr << "RemoveNullableSuffix:" << std::endl << Printer_RE::PrintRE(re_ast) << std::endl;
    156     }
    157 
    158     re_ast = re::RE_Simplifier::simplify(re_ast);
    159     if (PrintAllREs || PrintSimplifiedREs) {
    160         //Print to the terminal the AST that was generated by the simplifier.
    161         std::cerr << "Simplifier:" << std::endl << Printer_RE::PrintRE(re_ast) << std::endl;
    162     }
    163     return re_ast;
    164 }
    165    
    166 PabloFunction * re2pablo_compiler(const Encoding encoding, re::RE * re_ast) {
    167     PabloFunction * function = PabloFunction::Create("process_block", 8, 2);
    168     cc::CC_Compiler cc_compiler(*function, encoding);
    169     re::RE_Compiler re_compiler(*function, cc_compiler);
    170     re_compiler.initializeRequiredStreams();
    171     re_compiler.compileUnicodeNames(re_ast);
    172     re_compiler.finalizeMatchResult(re_compiler.compile(re_ast));
    173 
    174     if (PrintCompiledREcode) {
    175         //Print to the terminal the AST that was generated by the pararallel bit-stream compiler.
    176         llvm::raw_os_ostream cerr(std::cerr);
    177         cerr << "Initial Pablo AST:\n";
    178         PabloPrinter::print(*function, cerr);
    179     }
    180     #ifndef NDEBUG
    181     PabloVerifier::verify(*function, "creation");
    182     #endif
    183     return function;
    184 }
    185 
    186 #ifdef PRINT_TIMING_INFORMATION
    187 #define READ_CYCLE_COUNTER(name) name = read_cycle_counter();
    188 #else
    189 #define READ_CYCLE_COUNTER(name)
    190 #endif
    191 
    192 #ifdef PRINT_TIMING_INFORMATION
    193 unsigned COUNT_STATEMENTS(const PabloFunction * const entry) {
    194     std::stack<const Statement *> scope;
    195     unsigned statements = 0;
    196     // Scan through and collect all the advances, calls, scanthrus and matchstars ...
    197     for (const Statement * stmt = entry->getEntryBlock()->front(); ; ) {
    198         while ( stmt ) {
    199             ++statements;
    200             if (LLVM_UNLIKELY(isa<If>(stmt) || isa<While>(stmt))) {
    201                 // Set the next statement to be the first statement of the inner scope and push the
    202                 // next statement of the current statement into the scope stack.
    203                 const PabloBlock * const nested = isa<If>(stmt) ? cast<If>(stmt)->getBody() : cast<While>(stmt)->getBody();
    204                 scope.push(stmt->getNextNode());
    205                 stmt = nested->front();
    206                 assert (stmt);
    207                 continue;
    208             }
    209             stmt = stmt->getNextNode();
    210         }
    211         if (scope.empty()) {
    212             break;
    213         }
    214         stmt = scope.top();
    215         scope.pop();
    216     }
    217     return statements;
    218 }
    219 
    220 unsigned COUNT_ADVANCES(const PabloFunction * const entry) {
    221 
    222     std::stack<const Statement *> scope;
    223     unsigned advances = 0;
    224 
    225     // Scan through and collect all the advances, calls, scanthrus and matchstars ...
    226     for (const Statement * stmt = entry->getEntryBlock()->front(); ; ) {
    227         while ( stmt ) {
    228             if (isa<Advance>(stmt)) {
    229                 ++advances;
    230             }
    231             else if (LLVM_UNLIKELY(isa<If>(stmt) || isa<While>(stmt))) {
    232                 // Set the next statement to be the first statement of the inner scope and push the
    233                 // next statement of the current statement into the scope stack.
    234                 const PabloBlock * const nested = isa<If>(stmt) ? cast<If>(stmt)->getBody() : cast<While>(stmt)->getBody();
    235                 scope.push(stmt->getNextNode());
    236                 stmt = nested->front();
    237                 assert (stmt);
    238                 continue;
    239             }
    240             stmt = stmt->getNextNode();
    241         }
    242         if (scope.empty()) {
    243             break;
    244         }
    245         stmt = scope.top();
    246         scope.pop();
    247     }
    248     return advances;
    249 }
    250 
    251 using DistributionMap = boost::container::flat_map<unsigned, unsigned>;
    252 
    253 DistributionMap SUMMARIZE_VARIADIC_DISTRIBUTION(const PabloFunction * const entry) {
    254     std::stack<const Statement *> scope;
    255     DistributionMap distribution;
    256     // Scan through and collect all the advances, calls, scanthrus and matchstars ...
    257     for (const Statement * stmt = entry->getEntryBlock()->front(); ; ) {
    258         while ( stmt ) {
    259             if (isa<Variadic>(stmt)) {
    260                 auto f = distribution.find(stmt->getNumOperands());
    261                 if (f == distribution.end()) {
    262                     distribution.emplace(stmt->getNumOperands(), 1);
    263                 } else {
    264                     f->second += 1;
    265                 }
    266             }
    267             else if (LLVM_UNLIKELY(isa<If>(stmt) || isa<While>(stmt))) {
    268                 // Set the next statement to be the first statement of the inner scope and push the
    269                 // next statement of the current statement into the scope stack.
    270                 const PabloBlock * const nested = isa<If>(stmt) ? cast<If>(stmt)->getBody() : cast<While>(stmt)->getBody();
    271                 scope.push(stmt->getNextNode());
    272                 stmt = nested->front();
    273                 assert (stmt);
    274                 continue;
    275             }
    276             stmt = stmt->getNextNode();
    277         }
    278         if (scope.empty()) {
    279             break;
    280         }
    281         stmt = scope.top();
    282         scope.pop();
    283     }
    284     return distribution;
    285 }
    286 #endif
    287 
    288 void pablo_function_passes(PabloFunction * function) {
    289     // Scan through the pablo code and perform DCE and CSE
    290 
    291 #ifdef PRINT_TIMING_INFORMATION
    292     timestamp_t simplification_start = 0, simplification_end = 0;
    293     timestamp_t coalescing_start = 0, coalescing_end = 0;
    294     timestamp_t sinking_start = 0, sinking_end = 0;
    295     timestamp_t pre_distribution_start = 0, pre_distribution_end = 0;
    296     timestamp_t multiplexing_start = 0, multiplexing_end = 0;
    297     timestamp_t post_distribution_start = 0, post_distribution_end = 0;
    298     timestamp_t lowering_start = 0, lowering_end = 0;
    299     timestamp_t scheduling_start = 0, scheduling_end = 0;
    300     DistributionMap distribution;
    301     const timestamp_t optimization_start = read_cycle_counter();
    302 #endif
    303     if (!DisableSimplification) {
    304         READ_CYCLE_COUNTER(simplification_start);
    305         Simplifier::optimize(*function);
    306         READ_CYCLE_COUNTER(simplification_end);
    307     }
    308 #ifdef ENABLE_MULTIPLEXING
    309     if (EnableLowering || EnablePreDistribution || EnablePostDistribution) {
    310         READ_CYCLE_COUNTER(coalescing_start);
    311         CanonicalizeDFG::transform(*function);
    312         READ_CYCLE_COUNTER(coalescing_end);
    313     }
    314     if (EnablePreDistribution) {
    315         READ_CYCLE_COUNTER(pre_distribution_start);
    316         DistributivePass::optimize(*function);
    317         READ_CYCLE_COUNTER(pre_distribution_end);
    318     }
    319     if (EnableMultiplexing) {
    320         READ_CYCLE_COUNTER(multiplexing_start);
    321         MultiplexingPass::optimize(*function);
    322         READ_CYCLE_COUNTER(multiplexing_end);
    323         if (EnableLowering || EnablePreDistribution || EnablePostDistribution) {
    324             CanonicalizeDFG::transform(*function);
    325         }
    326     }
    327     if (EnablePostDistribution) {
    328         READ_CYCLE_COUNTER(post_distribution_start);
    329         DistributivePass::optimize(*function);
    330         READ_CYCLE_COUNTER(post_distribution_end);
    331     }
    332 #endif
    333     if (PabloSinkingPass) {
    334         READ_CYCLE_COUNTER(sinking_start);
    335         CodeMotionPass::optimize(*function);
    336         READ_CYCLE_COUNTER(sinking_end);
    337     }
    338 #ifdef ENABLE_MULTIPLEXING
    339     if (PrintUnloweredCode) {
    340         //Print to the terminal the AST that was generated by the pararallel bit-stream compiler.
    341         llvm::raw_os_ostream cerr(std::cerr);
    342         cerr << "Unlowered Pablo AST:\n";
    343         PabloPrinter::print(*function, cerr);
    344     }
    345     #ifdef PRINT_TIMING_INFORMATION
    346     distribution = SUMMARIZE_VARIADIC_DISTRIBUTION(function);
    347     #endif
    348     if (EnableLowering || EnablePreDistribution || EnablePostDistribution) {
    349         READ_CYCLE_COUNTER(lowering_start);
    350         FactorizeDFG::transform(*function);
    351         READ_CYCLE_COUNTER(lowering_end);
    352     }
    353     if (EnablePrePassScheduling) {
    354         READ_CYCLE_COUNTER(scheduling_start);
    355         SchedulingPrePass::optimize(*function);
    356         READ_CYCLE_COUNTER(scheduling_end);
    357     }
    358 #endif
    359 #ifdef PRINT_TIMING_INFORMATION
    360     const timestamp_t optimization_end = read_cycle_counter();
    361 #endif
    362     if (PrintOptimizedREcode) {
    363         if (PabloOutputFilename.empty()) {
    364             //Print to the terminal the AST that was generated by the pararallel bit-stream compiler.
    365             llvm::raw_os_ostream cerr(std::cerr);
    366             cerr << "Final Pablo AST:\n";
    367             PabloPrinter::print(*function, cerr);
    368         } else {
    369             std::error_code error;
    370             llvm::raw_fd_ostream out(PabloOutputFilename, error, sys::fs::OpenFlags::F_None);
    371             PabloPrinter::print(*function, out);
    372         }
    373     }
    374 #ifdef PRINT_TIMING_INFORMATION
    375     std::cerr << "PABLO OPTIMIZATION TIME: " << (optimization_end - optimization_start) << std::endl;
    376     std::cerr << "  SIMPLIFICATION TIME: " << (simplification_end - simplification_start) << std::endl;
    377     std::cerr << "  COALESCING TIME: " << (coalescing_end - coalescing_start) << std::endl;
    378     std::cerr << "  SINKING TIME: " << (sinking_end - sinking_start) << std::endl;
    379     std::cerr << "  PRE-DISTRIBUTION TIME: " << (pre_distribution_end - pre_distribution_start) << std::endl;
    380     std::cerr << "  MULTIPLEXING TIME: " << (multiplexing_end - multiplexing_start) << std::endl;
    381     std::cerr << "  MULTIPLEXING SEED: " << MultiplexingPass::SEED << std::endl;
    382     std::cerr << "  MULTIPLEXING NODES USED: " << MultiplexingPass::NODES_USED << std::endl;
    383     std::cerr << "  MULTIPLEXING NODES ALLOCATED: " << MultiplexingPass::NODES_ALLOCATED << std::endl;
    384     std::cerr << "  LOWERING TIME: " << (lowering_end - lowering_start) << std::endl;
    385     std::cerr << "  POST-DISTRIBUTION TIME: " << (post_distribution_end - post_distribution_start) << std::endl;
    386     std::cerr << "  SCHEDULING TIME: " << (scheduling_end - scheduling_start) << std::endl;
    387     std::cerr << "PABLO STATEMENTS: " << COUNT_STATEMENTS(function) << std::endl;
    388     std::cerr << "PABLO ADVANCES: " << COUNT_ADVANCES(function) << std::endl;
    389     std::cerr << "PRE-LOWERING VARIADIC DISTRIBUTION: ";
    390     bool join = false;
    391     for (auto dist : distribution) {
    392         if (join) {
    393             std::cerr << ';';
    394         }
    395         std::cerr << dist.first << '|' << dist.second;
    396         join = true;
    397     }
    398     std::cerr << std::endl;
    399 #endif
    400 }
    401 
    402 
    403 IDISA::IDISA_Builder * GetIDISA_Builder(Module * mod) {
    404     bool hasAVX2 = (strncmp(lGetSystemISA(), "avx2", 4) == 0);
    405    
    406     unsigned theBlockSize = BlockSize;  // from command line
    407    
    408     if (theBlockSize == 0) {  // No BlockSize override: use processor SIMD width
    409         theBlockSize = hasAVX2 ? 256 : 128;
    410     }
    411     Type * bitBlockType = VectorType::get(IntegerType::get(getGlobalContext(), 64), theBlockSize/64);
    412    
    413     int blockSize = bitBlockType->isIntegerTy() ? cast<IntegerType>(bitBlockType)->getIntegerBitWidth() : cast<VectorType>(bitBlockType)->getBitWidth();
    414     if (blockSize >= 256) {
    415         if (hasAVX2) {
    416             return new IDISA::IDISA_AVX2_Builder(mod, bitBlockType);
    417         }
    418         else{
    419             return new IDISA::IDISA_SSE2_Builder(mod, bitBlockType);
    420         }
    421     }
    422     else if (blockSize == 64)
    423         return new IDISA::IDISA_I64_Builder(mod, bitBlockType); 
    424     return new IDISA::IDISA_SSE2_Builder(mod, bitBlockType);
    425 }
    42658
    42759
     
    45284    builder.setOptLevel(optLevel);
    45385
    454     if (!DisableAVX2 && (strncmp(lGetSystemISA(), "avx2", 4) == 0)) {
     86    if ((strncmp(lGetSystemISA(), "avx2", 4) == 0)) {
    45587            std::vector<std::string> attrs;
    45688            attrs.push_back("avx2");
  • icGREP/icgrep-devel/icgrep/toolchain.h

    r4967 r4984  
    1616#include <re/re_re.h>
    1717#include <pablo/function.h>
    18 #include <IDISA/idisa_builder.h>
    19 
    20 IDISA::IDISA_Builder * GetIDISA_Builder(Module * m);
    2118
    2219re::RE * regular_expression_passes(const Encoding encoding, re::RE * re_ast);
Note: See TracChangeset for help on using the changeset viewer.