Ignore:
Timestamp:
Jan 21, 2016, 5:15:33 PM (3 years ago)
Author:
nmedfort
Message:

Work on lowering + some timing and papi information that will be cleaned up later.

File:
1 edited

Legend:

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

    r4917 r4919  
    2525#include <llvm/Support/Host.h>
    2626#include <llvm/IR/Verifier.h>
    27 
    2827#include <kernels/s2p_gen.h>
    2928#include <kernels/scanmatchgen.h>
     
    3635#include <pablo/function.h>
    3736
    38 #include "do_grep.h"
     37#include <iostream>
     38
     39#include <do_grep.h>
     40#include <hrtime.h>
     41
     42#ifdef PRINT_TIMING_INFORMATION
     43#include "papi_helper.hpp"
     44#endif
    3945
    4046static cl::OptionCategory aRegexSourceOptions("Regular Expression Options",
     
    6167static cl::opt<std::string> IRFileName("precompiled", cl::desc("Use precompiled regular expression"), cl::value_desc("LLVM IR file"), cl::init(""), cl::cat(aRegexSourceOptions));
    6268
    63 
     69using namespace llvm;
    6470
    6571static unsigned firstInputFile = 1;  // Normal case when first positional arg is a regex.
     
    154160        re_ast = regular_expression_passes(encoding, re_ast);
    155161       
     162        #ifdef PRINT_TIMING_INFORMATION
     163        const timestamp_t regex_compilation_start = read_cycle_counter();
     164        #endif
    156165        pablo::PabloFunction * function = re2pablo_compiler(encoding, re_ast);
     166        #ifdef PRINT_TIMING_INFORMATION
     167        const timestamp_t regex_compilation_end = read_cycle_counter();
     168        std::cerr << "REGEX COMPILATION TIME: " << (regex_compilation_end - regex_compilation_start) << std::endl;
     169        #endif
    157170
    158171        pablo_function_passes(function);
    159        
    160172       
    161173        pablo::PabloCompiler pablo_compiler(M, idb);
     
    181193    llvm::Function * s2p_IR = M->getFunction("s2p_block");
    182194   
    183     llvm::Function * scanRoutine = M->getFunction("scan_matches_in_bitblock");
     195   // llvm::Function * scanRoutine = M->getFunction("scan_matches_in_bitblock");
    184196   
    185197    if (s2p_IR == nullptr) {
     
    200212    void * icgrep_MCptr = engine->getPointerToFunction(icgrep_IR);
    201213    void * s2p_MCptr = engine->getPointerToFunction(s2p_IR);
    202     void * scan_MCptr = engine->getPointerToFunction(scanRoutine);
     214    // void * scan_MCptr = engine->getPointerToFunction(scanRoutine);
    203215    if (s2p_MCptr == nullptr) {
    204216        std::cerr << "No s2p_MCptr!\n";
    205217        exit(1);
    206218    }
    207    
     219
    208220    if (icgrep_MCptr) {
    209221        GrepExecutor grepEngine(s2p_MCptr, icgrep_init_carry_ptr, icgrep_MCptr);
     
    215227            grepEngine.setShowFileNameOption();
    216228        }
     229        #ifdef PRINT_TIMING_INFORMATION
     230        papi::PapiCounter<4> papiCounters({PAPI_RES_STL, PAPI_STL_CCY, PAPI_FUL_CCY, PAPI_MEM_WCY});
     231        #endif
    217232        for (unsigned i = firstInputFile; i != inputFiles.size(); ++i) {
     233            #ifdef PRINT_TIMING_INFORMATION
     234            papiCounters.start();
     235            const timestamp_t execution_start = read_cycle_counter();
     236            #endif
    218237            grepEngine.doGrep(inputFiles[i]);
     238            #ifdef PRINT_TIMING_INFORMATION
     239            const timestamp_t execution_end = read_cycle_counter();
     240            papiCounters.stop();
     241            std::cerr << "EXECUTION TIME: " << inputFiles[i] << ":" << "CYCLES|" << (execution_end - execution_start) << papiCounters << std::endl;
     242            #endif
    219243        }
    220244    }
Note: See TracChangeset for help on using the changeset viewer.