Changeset 1649


Ignore:
Timestamp:
Nov 2, 2011, 8:17:37 PM (6 years ago)
Author:
vla24
Message:

SymbolTable?: Integrated symbol table with the new IDISA architecture

Location:
trunk/symtab
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/symtab/Makefile

    r1517 r1649  
    33CFLAGS= $(SSE) -O3
    44SRCFILE=ls_symbol_table.cxx hash_symbol_table.cpp symtab.cxx bitstream_hash_table.cpp
    5 INCLUDES_IDISA = -I../../../../trunk/libgen/idisa_lib/
     5INCLUDES_IDISA = -I../lib/
    66
    77PAPI_DIR=/usr/local/papi-4.0.0
     
    2222        ar -rs libsymtab.a *.o  # $(AFLAGS) $(PAPI)
    2323
    24 lib_idisa:obj_idisa
    25         ar -rs libsymtab.a *.o    # $(AFLAGS) $(PAPI)
    26 
    2724obj:    $(SRCFILE)
    28         $(CC) -c $(SRCFILE) # $(AFLAGS) $(PAPI)
    29 
    30 obj_idisa:$(SRCFILE)
    3125        $(CC) $(INCLUDES_IDISA) -c $(SRCFILE) -DUSE_IDISA   # $(AFLAGS) $(PAPI)
    3226
  • trunk/symtab/library_conversion.h

    r1517 r1649  
    22#define LIBRARY_CONVERSION_H
    33
    4 #ifdef USE_IDISA
    54#define USE_SSE2
    65#include <idisa.hpp>
    7 #else
    8 #define TEMPLATED_SIMD_LIB
    9 #include "../lib_simd.h"
    10 #endif
     6#include <stdio.h>
     7#define SIMD_type BitBlock
    118
    12 template <int fw>
    13         class simdLibConvert
    14 {
    15 public:
    16     static inline SIMD_type splat(SIMD_type v);
    17     static inline SIMD_type mergel(SIMD_type r1, SIMD_type r2);
    18     static inline SIMD_type mergeh(SIMD_type r1, SIMD_type r2);
    19     static inline SIMD_type pack(SIMD_type r1, SIMD_type r2);
    20     static inline int movemask(SIMD_type v);
    21     static inline void print_simd_register(const char * var_name, SIMD_type v);
    22 };
     9#define sisd_load_aligned(x) bitblock::load_aligned((SIMD_type*)x)
     10#define simd_mask_eq_8(v1, v2, hex_mask) ((hsimd<8>::signmask(simd<8>::eq(v1, v2)) & hex_mask) == hex_mask)
     11#define sisd_load_unaligned(x) bitblock::load_unaligned(x)
     12#define simd_all_true(r) hsimd<8>::signmask(r) == 0xFFFF
     13#define simd_all_eq_8(v1, v2) simd_all_true(simd<8>::eq(v1, v2))
    2314
    24 template <int fw>
    25         inline SIMD_type simdLibConvert<fw>::splat(SIMD_type v)
    26 {
    27 #ifdef USE_IDISA
    28     return mvmd<fw>::template splat<0>(v);
    29 #else
    30   return simd<fw>::splat(v);
    31 #endif
    32 }
    33 
    34 template <int fw>
    35         inline SIMD_type simdLibConvert<fw>::mergel(SIMD_type r1, SIMD_type r2)
    36 {
    37 #ifdef USE_IDISA
    38   return esimd<fw>::mergel(r1, r2);
    39 #else
    40   return simd<fw>::mergel(r1, r2);
    41 #endif
    42 }
    43 
    44 template <int fw>
    45         inline SIMD_type simdLibConvert<fw>::mergeh(SIMD_type r1, SIMD_type r2)
    46 {
    47 #ifdef USE_IDISA
    48   return esimd<fw>::mergeh(r1, r2);
    49 #else
    50   return simd<fw>::mergeh(r1, r2);
    51 #endif
    52 }
    53 
    54 template <int fw>
    55         inline SIMD_type simdLibConvert<fw>::pack(SIMD_type r1, SIMD_type r2)
    56 {
    57 #ifdef USE_IDISA
    58   return hsimd<fw>::packl(r1, r2);
    59 #else
    60   return simd<fw>::pack(r1, r2);
    61 #endif
    62 }
    63 
    64 template <>
    65         inline int simdLibConvert<8>::movemask(SIMD_type v)
    66 {
    67 #ifdef USE_IDISA
    68     return hsimd<8>::signmask(v);
    69 #else
    70   return simd<8>::movemask(v);
    71 #endif
     15/* Prints the SIMD register representation of a SIMD value. */
     16static void print_simd_register(const char * var_name, SIMD_type v) {
     17  union {SIMD_type vec; unsigned char elems[sizeof(SIMD_type)];} x;
     18  x.vec = v;
     19  unsigned char c;
     20  printf("%30s = ", var_name);
     21  for(int i=sizeof(SIMD_type)-1; i>=0; i--) {
     22    c = x.elems[i];
     23    printf("%02X ", c);
     24  }
     25  printf("\n");
    7226}
    7327#endif // LIBRARY_CONVERSION_H
  • trunk/symtab/ls_symbol_table.cxx

    r1462 r1649  
    888888
    889889                        result_gid = simd_or(result_gid, simd_and(cmp_eq_mask_128, crt_gid_mask_128));
    890                         done_mask_16 |= simdLibConvert<8>::movemask(cmp_eq_mask_128);
     890                        done_mask_16 |= hsimd<8>::signmask(cmp_eq_mask_128);
    891891
    892892#ifdef SYMBOL_TABLE_DEBUG
     
    975975#endif
    976976                        result_gid = simd_or(result_gid, simd_and(cmp_eq_mask_128, crt_gid_mask_128));
    977                         done_mask_16 |= simdLibConvert<8>::movemask(cmp_eq_mask_128);
     977                        done_mask_16 |= hsimd<8>::signmask(cmp_eq_mask_128);
    978978                                               
    979979                        if(exit_cond_mask_16 == done_mask_16) {
     
    12501250        SIMD_type lo, hi;
    12511251
    1252         lo = simdLibConvert<fw<1>::value>::mergel(simd<1>::constant<0>(), value);
    1253         hi = simdLibConvert<fw<1>::value>::mergeh(simd<1>::constant<0>(), value);
     1252        lo = esimd<fw<1>::value>::mergel(simd<1>::constant<0>(), value);
     1253        hi = esimd<fw<1>::value>::mergeh(simd<1>::constant<0>(), value);
    12541254
    12551255        SIMD_type v[4];
    12561256
    1257         v[0] = simdLibConvert<fw<2>::value>::mergel(simd<2>::constant<0>(), lo);
    1258         v[1] = simdLibConvert<fw<2>::value>::mergeh(simd<2>::constant<0>(), lo);
    1259         v[2] = simdLibConvert<fw<2>::value>::mergel(simd<2>::constant<0>(), hi);
    1260         v[3] = simdLibConvert<fw<2>::value>::mergeh(simd<2>::constant<0>(), hi);
     1257        v[0] = esimd<fw<2>::value>::mergel(simd<2>::constant<0>(), lo);
     1258        v[1] = esimd<fw<2>::value>::mergeh(simd<2>::constant<0>(), lo);
     1259        v[2] = esimd<fw<2>::value>::mergel(simd<2>::constant<0>(), hi);
     1260        v[3] = esimd<fw<2>::value>::mergeh(simd<2>::constant<0>(), hi);
    12611261
    12621262        uint32_t push_count;
     
    12711271        SIMD_type v[2];
    12721272
    1273         v[0] = simdLibConvert<fw<2>::value>::mergel(simd<2>::constant<0>(), value);
    1274         v[1] = simdLibConvert<fw<2>::value>::mergeh(simd<2>::constant<0>(), value);
     1273        v[0] = esimd<fw<2>::value>::mergel(simd<2>::constant<0>(), value);
     1274        v[1] = esimd<fw<2>::value>::mergeh(simd<2>::constant<0>(), value);
    12751275
    12761276        uint32_t push_count;
     
    12931293template<>
    12941294inline void LSSymbolTable::push_gid<5>(const SIMD_type value, const uint32_t count) {
    1295         SIMD_type t1 = simdLibConvert<64>::pack(simd<1>::constant<0>(), value);
     1295        SIMD_type t1 = hsimd<64>::packl(simd<1>::constant<0>(), value);
    12961296        packed_gids_->push_back(5, (uint32_t *) (&t1), count);
    12971297}
     
    12991299template<>
    13001300inline void LSSymbolTable::push_gid<6>(const SIMD_type value, const uint32_t count) {
    1301         SIMD_type t1 = simdLibConvert<64>::pack(simd<1>::constant<0>(), value);
     1301        SIMD_type t1 = hsimd<64>::packl(simd<1>::constant<0>(), value);
    13021302        packed_gids_->push_back(6, (uint32_t *) (&t1), count);
    13031303}
     
    13051305template<>
    13061306inline void LSSymbolTable::push_gid<7>(const SIMD_type value, const uint32_t count) {
    1307         SIMD_type t1 = simdLibConvert<64>::pack(simd<1>::constant<0>(), value);
     1307        SIMD_type t1 = hsimd<64>::packl(simd<1>::constant<0>(), value);
    13081308        packed_gids_->push_back(7, (uint32_t *) (&t1), count);
    13091309}
     
    13111311template<>
    13121312inline void LSSymbolTable::push_gid<8>(const SIMD_type value, const uint32_t count) {
    1313         SIMD_type t1 = simdLibConvert<64>::pack(simd<1>::constant<0>(), value);
     1313        SIMD_type t1 = hsimd<64>::packl(simd<1>::constant<0>(), value);
    13141314        packed_gids_->push_back(8, (uint32_t *) (&t1), count);
    13151315}
  • trunk/symtab/ls_symbol_table_compare.h

    r1428 r1649  
    2929//#define LOW_BYTE_SHIFT 0
    3030//#define HIGH_BYTE_SHIFT 8
    31 
    32 #define simd_mask_eq_8(v1, v2, hex_mask) simd_mask_true<8>(_mm_cmpeq_epi8(v1, v2), hex_mask)
    3331//#define simd_mask_eq_8(v1, v2, hex_mask) (_mm_movemask_epi8(_mm_cmpeq_epi8(v1, v2)) & hex_mask) == hex_mask
    3432//#define simd_all_eq_8(v1, v2) simd_all_true<8>(_mm_cmpeq_epi8(v1, v2))
  • trunk/symtab/ls_symbol_table_util.h

    r1427 r1649  
    241241inline SIMD_type key_mask_splat<8>(const unsigned char * p) {
    242242  uint8_t temp = convert<8>(p);
    243   return simdLibConvert<8>::splat(sisd_load_unaligned((SIMD_type *) &temp));
     243  return mvmd<8>::splat<0>(sisd_load_unaligned((SIMD_type *) &temp));
    244244}
    245245
     
    247247inline SIMD_type key_mask_splat<16>(const unsigned char * p) {
    248248  uint16_t temp = convert<16>(p);
    249   return simdLibConvert<16>::splat(sisd_load_unaligned((SIMD_type *) &temp));
     249  return mvmd<16>::splat<0>(sisd_load_unaligned((SIMD_type *) &temp));
    250250}
    251251
     
    253253inline SIMD_type key_mask_splat<32>(const unsigned char * p) {
    254254  uint32_t temp = convert<32>(p);
    255   return simdLibConvert<32>::splat(sisd_load_unaligned((SIMD_type *) &temp));
     255  return mvmd<32>::splat<0>(sisd_load_unaligned((SIMD_type *) &temp));
    256256}
    257257
     
    259259inline SIMD_type key_mask_splat<64>(const unsigned char * p) {
    260260  uint64_t temp = convert<64>(p);
    261   return simdLibConvert<64>::splat(sisd_load_unaligned((SIMD_type *) &temp));
     261  return mvmd<64>::splat<0>(sisd_load_unaligned((SIMD_type *) &temp));
    262262}
    263263
Note: See TracChangeset for help on using the changeset viewer.