Changeset a5873bd
- Timestamp:
- Jun 10, 2020, 12:13:18 PM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 97392b69
- Parents:
- 6089f4d (diff), 5f259f3 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- doc/theses/thierry_delisle_PhD/code
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/theses/thierry_delisle_PhD/code/relaxed_list.hpp
r6089f4d ra5873bd 222 222 if(maski == 0 && maskj == 0) continue; 223 223 224 unsigned bi = rand_bit(ri >> snzm.depth, maski); 225 unsigned bj = rand_bit(rj >> snzm.depth, maskj); 226 227 assertf(bi < 64, "%zu %u", maski, bi); 228 assertf(bj < 64, "%zu %u", maskj, bj); 224 #if defined(__BMI2__) 225 uint64_t idxsi = _pext_u64(snzm.indexes, maski); 226 uint64_t idxsj = _pext_u64(snzm.indexes, maskj); 227 228 auto pi = __builtin_popcountll(maski); 229 auto pj = __builtin_popcountll(maskj); 230 231 ri = pi ? ri & ((pi >> 3) - 1) : 0; 232 rj = pj ? rj & ((pj >> 3) - 1) : 0; 233 234 unsigned bi = (idxsi >> (ri << 3)) & 0xff; 235 unsigned bj = (idxsj >> (rj << 3)) & 0xff; 236 #else 237 unsigned bi = rand_bit(ri >> snzm.depth, maski); 238 unsigned bj = rand_bit(rj >> snzm.depth, maskj); 239 #endif 229 240 230 241 i = (bi << snzm.depth) | wdxi; 231 242 j = (bj << snzm.depth) | wdxj; 232 243 233 assertf(i < numLists, "%u %u", bj, wdxi);234 assertf(j < numLists, "%u %u", bj, wdxj);244 /* paranoid */ assertf(i < numLists, "%u %u", bj, wdxi); 245 /* paranoid */ assertf(j < numLists, "%u %u", bj, wdxj); 235 246 } 236 247 -
doc/theses/thierry_delisle_PhD/code/snzm.hpp
r6089f4d ra5873bd 12 12 std::unique_ptr<snzm_t::node[]> nodes; 13 13 14 #if defined(__BMI2__) 15 const uint64_t indexes = 0x0706050403020100; 16 #endif 17 14 18 snzm_t(unsigned numLists); 15 19 … … 28 32 } 29 33 30 size_t masks( unsigned node ) {34 uint64_t masks( unsigned node ) { 31 35 /* paranoid */ assert( (node & mask) == node ); 32 return nodes[node].mask; 36 #if defined(__BMI2__) 37 return nodes[node].mask_all; 38 #else 39 return nodes[node].mask; 40 #endif 33 41 } 34 42 … … 140 148 private: 141 149 volatile val_t value; 142 volatile size_t mask = 0; 150 #if defined(__BMI2__) 151 union __attribute__((packed)) { 152 volatile uint8_t mask[8]; 153 volatile uint64_t mask_all; 154 }; 155 #else 156 volatile size_t mask = 0; 157 #endif 158 143 159 class node * parent = nullptr; 144 160 bool is_leaf = false; … … 151 167 void arrive( int bit ) { 152 168 /* paranoid */ assert( is_leaf ); 153 /* paranoid */ assert( (mask & ( 1 << bit )) == 0 );154 169 155 170 arrive_h(); 156 __atomic_fetch_add( &mask, 1 << bit, __ATOMIC_RELAXED ); 157 // bts( (std::atomic_size_t&)mask, bit ); 171 #if defined(__BMI2__) 172 /* paranoid */ assert( bit < 8 ); 173 mask[bit] = 0xff; 174 #else 175 /* paranoid */ assert( (mask & ( 1 << bit )) == 0 ); 176 __atomic_fetch_add( &mask, 1 << bit, __ATOMIC_RELAXED ); 177 #endif 158 178 159 179 } … … 161 181 void depart( int bit ) { 162 182 /* paranoid */ assert( is_leaf ); 163 /* paranoid */ assert( (mask & ( 1 << bit )) != 0 ); 164 165 // btr( (std::atomic_size_t&)mask, bit ); 166 __atomic_fetch_sub( &mask, 1 << bit, __ATOMIC_RELAXED ); 183 184 #if defined(__BMI2__) 185 /* paranoid */ assert( bit < 8 ); 186 mask[bit] = 0x00; 187 #else 188 /* paranoid */ assert( (mask & ( 1 << bit )) != 0 ); 189 __atomic_fetch_sub( &mask, 1 << bit, __ATOMIC_RELAXED ); 190 #endif 167 191 depart_h(); 168 192 }
Note: See TracChangeset
for help on using the changeset viewer.