Changeset 2141 for trunk/symbol_table


Ignore:
Timestamp:
May 23, 2012, 5:09:56 PM (7 years ago)
Author:
ksherdy
Message:

Fixed 64 bit machine copyback. Updated default to index at follows pos w/o Makefile preprocessor define.

Location:
trunk/symbol_table
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/symbol_table/main_template.cpp

    r2140 r2141  
    7979    uint8_t * COPYBACK;
    8080    uint8_t * src_buffer;
    81     ALLOC_STATIC_ALIGNED_BYTE_BUFFER(COPYBACK, src_buffer);
     81//    ALLOC_STATIC_ALIGNED_BYTE_BUFFER(COPYBACK, src_buffer);
     82        ATTRIBUTE_SIMD_ALIGN BitBlock aligned_base[BUFFER_SIZE];
     83        COPYBACK = (uint8_t *)aligned_base;
     84        memset(COPYBACK,0,COPYBACK_SIZE);
     85        src_buffer = &COPYBACK[COPYBACK_SIZE];
    8286
    8387    // hash 0
     
    159163        gid_type gid;
    160164
    161         #ifdef INDEX_AT_FOLLOWS
     165        #ifdef INDEX_AT_STARTS
     166            ForwardScanner<BitBlock, scanword_t> scanner(&(groups[blk].starts));
     167        #else
    162168            ForwardScanner<BitBlock, scanword_t> scanner(&(groups[blk].follows));
    163         #else
    164             ForwardScanner<BitBlock, scanword_t> scanner(&(groups[blk].starts));
    165169        #endif
    166170
     
    222226        gid_type gid;
    223227
    224         #ifdef INDEX_AT_FOLLOWS
     228        #ifdef INDEX_AT_STARTS
     229            ForwardScanner<BitBlock, scanword_t> scanner(&(groups[blk].starts));
     230        #else
    225231            ForwardScanner<BitBlock, scanword_t> scanner(&(groups[blk].follows));
    226         #else
    227             ForwardScanner<BitBlock, scanword_t> scanner(&(groups[blk].starts));
    228232        #endif
    229233
  • trunk/symbol_table/src/Makefile

    r2119 r2141  
    2121###########################################################################
    2222id: basis_bits.hpp buffer.hpp byte_pool.hpp hash_strms.hpp  hash_table.hpp ../lib/hash.hpp  group_strms.hpp  symbol_table.hpp  main.cpp  marker_strms.hpp symbol_table.hpp transpose.hpp
    23         $(CC) -o id main.cpp $(AFLAGS) -DID_STRATEGY -DBUFFER_PROFILING #-DID_SYMBOL_TABLE_TEMPLATE_HPP_DEBUG #-DHASH_TABLE_HPP_DEBUG
     23        $(CC) -o id main.cpp $(AFLAGS) -DID_STRATEGY -DBUFFER_PROFILING  #-DID_SYMBOL_TABLE_TEMPLATE_HPP_DEBUG #-DHASH_TABLE_HPP_DEBUG
    2424
    2525div2: basis_bits.hpp buffer.hpp byte_pool.hpp hash_strms.hpp  hash_table.hpp ../lib/hash.hpp  group_strms.hpp  symbol_table.hpp  main.cpp  marker_strms.hpp symbol_table.hpp transpose.hpp
    26         $(CC) -o div2 main.cpp $(AFLAGS) -DDIV2_STRATEGY -DBUFFER_PROFILING #-DHASH_TABLE_HPP_DEBUG #-DID_SYMBOL_TABLE_TEMPLATE_HPP_DEBUG
     26        $(CC) -o div2 main.cpp $(AFLAGS) -DDIV2_STRATEGY -DBUFFER_PROFILING  #-DHASH_TABLE_HPP_DEBUG #-DID_SYMBOL_TABLE_TEMPLATE_HPP_DEBUG
    2727
    2828logbase2: basis_bits.hpp buffer.hpp byte_pool.hpp hash_strms.hpp  hash_table.hpp ../lib/hash.hpp  group_strms.hpp  symbol_table.hpp  main.cpp  marker_strms.hpp symbol_table.hpp transpose.hpp
    29         $(CC) -o logbase2 main.cpp $(AFLAGS) -DLOGBASE2_STRATEGY -DBUFFER_PROFILING #-DID_SYMBOL_TABLE_TEMPLATE_HPP_DEBUG  #-DHASH_TABLE_HPP_DEBUG
     29        $(CC) -o logbase2 main.cpp $(AFLAGS) -DLOGBASE2_STRATEGY -DBUFFER_PROFILING  #-DID_SYMBOL_TABLE_TEMPLATE_HPP_DEBUG  #-DHASH_TABLE_HPP_DEBUG
    3030
    3131div2_logbase2: basis_bits.hpp buffer.hpp byte_pool.hpp hash_strms.hpp  hash_table.hpp ../lib/hash.hpp  group_strms.hpp  symbol_table.hpp  main.cpp  marker_strms.hpp symbol_table.hpp transpose.hpp
    32         $(CC) -o div2_logbase2 main.cpp $(AFLAGS) -DDIV2_LOGBASE2_STRATEGY -DBUFFER_PROFILING #-DID_SYMBOL_TABLE_TEMPLATE_HPP_DEBUG  #-DHASH_TABLE_HPP_DEBUG
     32        $(CC) -o div2_logbase2 main.cpp $(AFLAGS) -DDIV2_LOGBASE2_STRATEGY -DBUFFER_PROFILING  #-DID_SYMBOL_TABLE_TEMPLATE_HPP_DEBUG  #-DHASH_TABLE_HPP_DEBUG
    3333
    3434bit_byte: basis_bits.hpp buffer.hpp byte_pool.hpp hash_strms.hpp  hash_table.hpp ../lib/hash.hpp  group_strms.hpp  symbol_table.hpp  main.cpp  marker_strms.hpp symbol_table.hpp transpose.hpp
    35         $(CC) -o bit_byte main.cpp $(AFLAGS) -DBIT_BYTE_STRATEGY -DBUFFER_PROFILING #-DID_SYMBOL_TABLE_TEMPLATE_HPP_DEBUG  #-DHASH_TABLE_HPP_DEBUG
     35        $(CC) -o bit_byte main.cpp $(AFLAGS) -DBIT_BYTE_STRATEGY -DBUFFER_PROFILING  #-DID_SYMBOL_TABLE_TEMPLATE_HPP_DEBUG  #-DHASH_TABLE_HPP_DEBUG
    3636
    3737###########################################################################
     
    3939###########################################################################
    4040id_diff_test: id
    41         $(CC) -o id main.cpp $(AFLAGS) -DID_STRATEGY -DIDENTITY_TEST -DINDEX_AT_FOLLOWS
     41        $(CC) -o id main.cpp $(AFLAGS) -DID_STRATEGY -DIDENTITY_TEST
    4242        python $(TEST_SCRIPT) id -d
    4343        diff -rq --exclude=".svn" $(TEST_SRC_DIR) $(TEST_DST_DIR) || exit 0
    4444
    4545div2_diff_test: div2
    46         $(CC) -o div2 main.cpp $(AFLAGS) -DDIV2_STRATEGY -DIDENTITY_TEST -DINDEX_AT_FOLLOWS
     46        $(CC) -o div2 main.cpp $(AFLAGS) -DDIV2_STRATEGY -DIDENTITY_TEST
    4747        python $(TEST_SCRIPT) div2 -d
    4848        diff -rq --exclude=".svn" $(TEST_SRC_DIR) $(TEST_DST_DIR) || exit 0
    4949
    5050logbase2_diff_test: logbase2
    51         $(CC) -o logbase2 main.cpp $(AFLAGS) -DLOGBASE2_STRATEGY -DIDENTITY_TEST -DINDEX_AT_FOLLOWS
     51        $(CC) -o logbase2 main.cpp $(AFLAGS) -DLOGBASE2_STRATEGY -DIDENTITY_TEST
    5252        python $(TEST_SCRIPT) logbase2 -d
    5353        diff -rq --exclude=".svn" $(TEST_SRC_DIR) $(TEST_DST_DIR) || exit 0
    5454
    5555div2_logbase2_diff_test: div2_logbase2
    56         $(CC) -o div2_logbase2 main.cpp $(AFLAGS) -DDIV2_LOGBASE2_STRATEGY -DIDENTITY_TEST -DINDEX_AT_FOLLOWS
     56        $(CC) -o div2_logbase2 main.cpp $(AFLAGS) -DDIV2_LOGBASE2_STRATEGY -DIDENTITY_TEST
    5757        python $(TEST_SCRIPT) div2_logbase2 -d
    5858        diff -rq --exclude=".svn" $(TEST_SRC_DIR) $(TEST_DST_DIR) || exit 0
    5959
    6060bit_byte_diff_test: bit_byte
    61         $(CC) -o bit_byte main.cpp $(AFLAGS) -DBIT_BYTE_STRATEGY -DIDENTITY_TEST -DINDEX_AT_FOLLOWS
     61        $(CC) -o bit_byte main.cpp $(AFLAGS) -DBIT_BYTE_STRATEGY -DIDENTITY_TEST
    6262        python $(TEST_SCRIPT) bit_byte -d
    6363        diff -rq --exclude=".svn" $(TEST_SRC_DIR) $(TEST_DST_DIR) || exit 0
     
    6767###########################################################################
    6868id_gid_test:
    69         $(CC) -o id main.cpp $(AFLAGS) -DID_STRATEGY -DGID_TEST
     69        $(CC) -o id main.cpp $(AFLAGS) -DID_STRATEGY -DGID_TEST 
    7070        python $(TEST_SCRIPT) id -g
    7171
    7272div2_gid_test:
    73         $(CC) -o div2 main.cpp $(AFLAGS) -DDIV2_STRATEGY -DGID_TEST
     73        $(CC) -o div2 main.cpp $(AFLAGS) -DDIV2_STRATEGY -DGID_TEST 
    7474        python $(TEST_SCRIPT) div2 -g
    7575
    7676logbase2_gid_test:
    77         $(CC) -o logbase2 main.cpp $(AFLAGS) -DLOGBASE2_STRATEGY -DGID_TEST
     77        $(CC) -o logbase2 main.cpp $(AFLAGS) -DLOGBASE2_STRATEGY -DGID_TEST 
    7878        python $(TEST_SCRIPT) logbase2 -g
    7979
    8080div2_logbase2_gid_test:
    81         $(CC) -o div2_logbase2 main.cpp $(AFLAGS) -DDIV2_LOGBASE2_STRATEGY -DGID_TEST
     81        $(CC) -o div2_logbase2 main.cpp $(AFLAGS) -DDIV2_LOGBASE2_STRATEGY -DGID_TEST 
    8282        python $(TEST_SCRIPT) div2_logbase2 -g
    8383
    8484bit_byte_gid_test:
    85         $(CC) -o bit_byte main.cpp $(AFLAGS) -DBIT_BYTE_STRATEGY -DGID_TEST
     85        $(CC) -o bit_byte main.cpp $(AFLAGS) -DBIT_BYTE_STRATEGY -DGID_TEST 
    8686        python $(TEST_SCRIPT) bit_byte -g
    8787
  • trunk/symbol_table/src/buffer.hpp

    r2140 r2141  
    1111#define PADDING_BLOCKS 0
    1212#define PADDING_SIZE (BLOCK_SIZE * PADDING_BLOCKS)
    13 #define COPYBACK_BLOCKS 10
     13#define COPYBACK_BLOCKS 2
    1414#define COPYBACK_SIZE (BLOCK_SIZE * COPYBACK_BLOCKS)
    15 #define SEGMENT_BLOCKS  1000
     15#define SEGMENT_BLOCKS  2
    1616#define SEGMENT_SIZE (BLOCK_SIZE * SEGMENT_BLOCKS)
    1717#define BUFFER_SIZE (COPYBACK_SIZE + SEGMENT_SIZE + PADDING_SIZE)
     
    4242
    4343#define COPY_BACK_BYTE_BUFFER(copyback, base) \
    44 do {    void * src = copyback;\
    45         void * dest = (uint8_t *)base + (SEGMENT_SIZE - COPYBACK_SIZE);\
     44do {    void * dest = copyback;\
     45        void * src = (uint8_t *)base + (SEGMENT_SIZE - COPYBACK_SIZE);\
    4646        assert_bitblock_align(src);\
    4747        assert_bitblock_align(dest);\
    48         memmove(src, dest, COPYBACK_SIZE);\
     48        memmove(dest, src, COPYBACK_SIZE);\
    4949} while(0)
    5050
    5151#define COPY_BACK_BITBLOCK_BUFFER(copyback, base) \
    52 do {    void * src = copyback;\
    53         void * dest = (uint8_t *)base + ((SEGMENT_SIZE - COPYBACK_SIZE)/8);\
     52do {    void * dest = copyback;\
     53        void * src = (uint8_t *)base + ((SEGMENT_SIZE - COPYBACK_SIZE)/8);\
    5454        assert_bitblock_align(src);\
    5555        assert_bitblock_align(dest);\
    56         memmove(src, dest, COPYBACK_SIZE/8);\
     56        memmove(dest, src, COPYBACK_SIZE/8);\
    5757} while(0)
    5858
  • trunk/symbol_table/src/symbol_table.hpp

    r2140 r2141  
    327327                        gid = h_table.lookup_or_insert(buffer_base, spos, lgth, h0_base, h1_base, gid_factory, gid_data); // WARNING: spos must be >= 0
    328328
    329                         #ifdef INDEX_AT_FOLLOWS
     329                        #ifdef INDEX_AT_STARTS
     330                            gids.at[blk_offset + fpos - gid_data.get_bytes_lgth(gid)] = gid;
     331                        #else
    330332                            gids.at[blk_offset + fpos] = gid;
    331                         #else
    332                             gids.at[blk_offset + fpos - gid_data.get_bytes_lgth(gid)] = gid;
    333333                        #endif
    334334
     
    399399                gid = h_table.lookup_or_insert(buffer_base, spos, lgth, h0_base, h1_base, gid_factory, gid_data);
    400400
    401                 #ifdef INDEX_AT_FOLLOWS
     401                #ifdef INDEX_AT_STARTS
     402                    gids.at[blk_offset + fpos - lgth] = gid;
     403                #else // INDEX_AT_FOLLOWS
    402404                    gids.at[blk_offset + fpos] = gid;
    403                 #else
    404                     gids.at[blk_offset + fpos - lgth] = gid;
    405405                #endif
    406406
  • trunk/symbol_table/test/run_tests.py

    r2114 r2141  
    114114                print "All pass."
    115115            else:
    116                 print "Fail."
     116                print "Fail. Potential cauase: Insufficient COPYBACK_BLOCKS (buffer.hpp)."
    117117       
Note: See TracChangeset for help on using the changeset viewer.