Ignore:
Timestamp:
Nov 2, 2014, 5:06:13 PM (5 years ago)
Author:
cameron
Message:

Separate Advance Queue from Carry Queue

File:
1 edited

Legend:

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

    r4287 r4288  
    6767using namespace std;
    6868
    69 typedef void (*process_block_fcn)(const Basis_bits &basis_bits, BitBlock carry_q[], Output &output);
     69typedef void (*process_block_fcn)(const Basis_bits &basis_bits, BitBlock carry_q[], BitBlock advance_q[], Output &output);
    7070
    7171
    7272#define USE_MMAP
    7373#ifndef USE_MMAP
    74 void do_process(FILE *infile, FILE *outfile, int count_only_option, int carry_count, process_block_fcn process_block);
    75 #endif
    76 #ifdef USE_MMAP
    77 void do_process(char * infile_buffer, size_t infile_size, FILE *outfile, int count_only_option, int carry_count, process_block_fcn process_block);
     74void do_process(FILE *infile, FILE *outfile, int count_only_option, int carry_count, int advance_count, process_block_fcn process_block);
     75#endif
     76#ifdef USE_MMAP
     77void do_process(char * infile_buffer, size_t infile_size, FILE *outfile, int count_only_option, int carry_count, int advance_count, process_block_fcn process_block);
    7878#endif
    7979
     
    247247    if (llvm_codegen.process_block_fptr != 0)
    248248    {
    249         void (*FP)(const Basis_bits &basis_bits, BitBlock carry_q[], Output &output) = (void (*)(const Basis_bits &basis_bits, BitBlock carry_q[], Output &output))(void*)llvm_codegen.process_block_fptr;
    250 #ifndef USE_MMAP
    251         do_process(infile, outfile, count_only_option, llvm_codegen.carry_q_size, FP);
    252 #endif
    253 #ifdef USE_MMAP
    254         do_process(infile_buffer, infile_sb.st_size, outfile, count_only_option, llvm_codegen.carry_q_size, FP);
     249        void (*FP)(const Basis_bits &basis_bits, BitBlock carry_q[], BitBlock advance_q[], Output &output) = (void (*)(const Basis_bits &basis_bits, BitBlock carry_q[], BitBlock advance_q[], Output &output))(void*)llvm_codegen.process_block_fptr;
     250#ifndef USE_MMAP
     251        do_process(infile, outfile, count_only_option, llvm_codegen.carry_q_size, llvm_codegen.advance_q_size, FP);
     252#endif
     253#ifdef USE_MMAP
     254        do_process(infile_buffer, infile_sb.st_size, outfile, count_only_option, llvm_codegen.carry_q_size, llvm_codegen.advance_q_size, FP);
    255255#endif
    256256    }
     
    315315
    316316#ifndef USE_MMAP
    317 void do_process(FILE *infile, FILE *outfile, int count_only_option, int carry_count, process_block_fcn process_block) {
    318 #endif
    319 #ifdef USE_MMAP
    320 void do_process(char * infile_buffer, size_t infile_size, FILE *outfile, int count_only_option, int carry_count, process_block_fcn process_block) {
     317void do_process(FILE *infile, FILE *outfile, int count_only_option, int carry_count, int advance_count, process_block_fcn process_block) {
     318#endif
     319#ifdef USE_MMAP
     320void do_process(char * infile_buffer, size_t infile_size, FILE *outfile, int count_only_option, int carry_count, int advance_count, process_block_fcn process_block) {
    321321#endif
    322322
     
    325325    BitBlock match_vector;
    326326    BitBlock carry_q[carry_count];
     327    BitBlock advance_q[advance_count];
    327328    int match_count=0;
    328329    int blk = 0;
     
    342343    match_vector = simd<1>::constant<0>();
    343344    memset (carry_q, 0, sizeof(BitBlock) * carry_count);
     345    memset (advance_q, 0, sizeof(BitBlock) * advance_count);
    344346
    345347    char * buffer_ptr;
     
    380382            s2p_do_block((BytePack *) &infile_buffer[block_base], basis_bits);
    381383#endif
    382             process_block(basis_bits, carry_q, output);
     384            process_block(basis_bits, carry_q, advance_q, output);
    383385
    384386            LF_scanner.load_block(output.LF, blk);
     
    406408            copy_back_pos = LF_scanner.get_final_pos() + 1;
    407409            memset (carry_q, 0, sizeof(BitBlock) * carry_count);
     410            memset (advance_q, 0, sizeof(BitBlock) * advance_count);
    408411        }
    409412        else {
     
    461464        s2p_do_block((BytePack *) &infile_buffer[block_base], basis_bits);
    462465#endif
    463         process_block(basis_bits, carry_q, output);
     466        process_block(basis_bits, carry_q, advance_q, output);
    464467
    465468        LF_scanner.load_block(output.LF, blk);
     
    498501     s2p_do_final_block((BytePack *) &infile_buffer[block_base], basis_bits, EOF_mask);
    499502#endif
    500     process_block(basis_bits, carry_q, output);
     503    process_block(basis_bits, carry_q, advance_q, output);
    501504
    502505    if (count_only_option)
Note: See TracChangeset for help on using the changeset viewer.