Changeset 938 for proto/parabix2


Ignore:
Timestamp:
Mar 11, 2011, 4:48:12 PM (8 years ago)
Author:
cameron
Message:

New pablo template with @final_block_stmts

Location:
proto/parabix2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • proto/parabix2/pablo_template.cpp

    r936 r938  
    324324@stream_stmts
    325325
    326   while(1){
    327 
     326/* Full Buffers */
     327
     328    while (chars_avail == BUFFER_SIZE) {
     329      PERF_SEC_START(parser_timer);
     330      for (int blk = 0; blk < SEGMENT_BLOCKS; blk++) {
     331          block_base = blk*BLOCK_SIZE;
     332          s2p_do_block((BytePack *) &srcbuf[block_base], basis_bits);
     333          @block_stmts
     334          postprocess_do_block(lex, ctCDPI_Callouts, ref_Callouts, check_streams, chars_avail);
     335      }
     336      matcher.StreamScan(chars_avail);
     337      matcher.Advance_buffer();
     338      tracker.Advance_buffer();
     339      PERF_SEC_END(parser_timer, chars_avail);
     340           
     341      int bytes_left = chars_read - chars_avail;
     342      memmove(srcbuf, &srcbuf[BUFFER_SIZE], bytes_left);
     343      chars_read = fread(&srcbuf[bytes_left],1, BUFFER_SIZE + OVERLAP_BUFSIZE - bytes_left, infile) + bytes_left;
     344      chars_avail = min(chars_read, BUFFER_SIZE);
     345      buf_pos += chars_avail;
     346      buffer_base = buf_pos;
     347    }
     348/* Final Partial Buffer */
    328349    PERF_SEC_START(parser_timer);
    329350
    330351    block_pos = 0;
    331 
    332     if(chars_avail < BUFFER_SIZE){
    333 
    334                 while (block_pos <= chars_avail || @any_carry){
    335 
    336                         int bytes = chars_avail - block_pos;
    337                         block_base = block_pos;
    338 
    339                         if(bytes < BLOCK_SIZE){
    340                           EOF_mask = sisd_srl(simd_const_1(1),sisd_from_int(BLOCK_SIZE-bytes));
    341                         }
    342 
    343                         s2p_do_final_block((BytePack *) &srcbuf[block_pos], basis_bits, EOF_mask);
    344 
    345                         @block_stmts
    346 
    347                         postprocess_do_block(lex, ctCDPI_Callouts, ref_Callouts, check_streams, chars_avail);
    348 
    349                         block_pos += BLOCK_SIZE;
    350                 }
     352    int remaining = chars_avail;
     353/* Full Blocks */
     354    while (remaining >= BLOCK_SIZE) {
     355          block_base = block_pos;
     356          s2p_do_block((BytePack *) &srcbuf[block_pos], basis_bits);
     357          @block_stmts
     358          postprocess_do_block(lex, ctCDPI_Callouts, ref_Callouts, check_streams, chars_avail);
     359          block_pos += BLOCK_SIZE;
     360          remaining -= BLOCK_SIZE;
    351361    }
    352     else{
    353       while (block_pos < chars_avail){
    354 
    355           block_base = block_pos;
    356 
    357           s2p_do_block((BytePack *) &srcbuf[block_pos], basis_bits);
    358 
    359 
    360                   @block_stmts
    361 
    362                   postprocess_do_block(lex, ctCDPI_Callouts, ref_Callouts, check_streams, chars_avail);
    363 
    364                   block_pos += BLOCK_SIZE;
    365       }
     362    if (remaining > 0 || @any_carry) {
     363          EOF_mask = sisd_srl(simd_const_1(1),sisd_from_int(BLOCK_SIZE-remaining));
     364          s2p_do_final_block((BytePack *) &srcbuf[block_pos], basis_bits, EOF_mask);
     365          @final_block_stmts
     366          postprocess_do_block(lex, ctCDPI_Callouts, ref_Callouts, check_streams, chars_avail);
    366367    }
    367 
     368    buf_pos += chars_avail;
     369    buffer_base = buf_pos;
    368370
    369371    matcher.StreamScan(chars_avail);
     
    373375
    374376    PERF_SEC_END(parser_timer, chars_avail);
    375 
    376     buf_pos += chars_avail;
    377     buffer_base = buf_pos;
    378     if(chars_avail!=chars_read){
    379       int bytes_left = chars_read-chars_avail;
    380       memmove(srcbuf, &srcbuf[BUFFER_SIZE], bytes_left);
    381       chars_read = fread(&srcbuf[bytes_left],1, BUFFER_SIZE , infile)+bytes_left;
    382       chars_avail = min(chars_read,BUFFER_SIZE);
     377    if (matcher.depth != 0) {
     378      fprintf(stderr, "tag matching error (depth %i) at position %i\n", matcher.depth, buffer_base);
     379      exit(-1);
    383380    }
    384     else
    385       break;
    386   }
    387   if(matcher.depth!=0){
    388     fprintf(stderr, "tag matching error (depth %i) at position %i\n", matcher.depth, buffer_base);
    389     exit(-1);
    390   }
    391 
    392381}
    393382
  • proto/parabix2/src/perf_script.py

    r897 r938  
    66testfile_home = "../../../trunk/QA/TD/"
    77#programs = ['xmlwf','expat','Xerces_SAX','Xerces_DOM']
    8 programs = ['xmlwf']
     8programs = ['xmlwf', 'xmlwf_MT']
    99testfiles = ['dew.xml','jaw.xml','roads-2.gml','po.xml','soap.xml']
    1010#testfiles = ['dew.u16','jaw.u16','po.u16','roads-2.u16','soap.u16']
Note: See TracChangeset for help on using the changeset viewer.