Browse Source

fixed an issue in sylvan refiner when not reusing block numbers

tempestpy_adaptions
dehnert 7 years ago
parent
commit
6638984b8e
  1. 12
      src/storm/storage/dd/bisimulation/InternalSylvanSignatureRefiner.cpp

12
src/storm/storage/dd/bisimulation/InternalSylvanSignatureRefiner.cpp

@ -49,7 +49,7 @@ namespace storm {
LACE_ME; LACE_ME;
nextFreeBlockIndex = options.reuseBlockNumbers ? oldPartition.getNextFreeBlockIndex() : 0;
nextFreeBlockIndex = options.reuseBlockNumbers ? oldPartition.getNextFreeBlockIndex() : 1;
signatures.resize(nextFreeBlockIndex); signatures.resize(nextFreeBlockIndex);
// Perform the actual recursive refinement step. // Perform the actual recursive refinement step.
@ -161,6 +161,8 @@ namespace storm {
} }
} }
static const uint64_t NO_ELEMENT_MARKER = -1ull;
static uint64_t sylvan_search_or_insert(uint64_t sig, uint64_t previous_block, InternalSylvanSignatureRefinerBase* refiner) static uint64_t sylvan_search_or_insert(uint64_t sig, uint64_t previous_block, InternalSylvanSignatureRefinerBase* refiner)
{ {
uint64_t hash = sylvan_hash(sig, previous_block); uint64_t hash = sylvan_hash(sig, previous_block);
@ -189,7 +191,7 @@ namespace storm {
} }
pos++; pos++;
if (pos >= refiner->currentCapacity) pos = 0; if (pos >= refiner->currentCapacity) pos = 0;
if (++count >= 128) return 0;
if (++count >= 128) return NO_ELEMENT_MARKER;
} }
} }
@ -232,6 +234,7 @@ namespace storm {
sig = (uint64_t)-1; sig = (uint64_t)-1;
} }
if (refiner->options.reuseBlockNumbers) {
// try to claim previous block number // try to claim previous block number
assert(previous_block != sylvan_false); assert(previous_block != sylvan_false);
const uint64_t p_b = CALL(sylvan_decode_block, previous_block); const uint64_t p_b = CALL(sylvan_decode_block, previous_block);
@ -243,10 +246,13 @@ namespace storm {
if (cur != 0) break; if (cur != 0) break;
if (cas(&refiner->signatures[p_b], 0, sig)) return previous_block; if (cas(&refiner->signatures[p_b], 0, sig)) return previous_block;
} }
}
// no previous block number, search or insert // no previous block number, search or insert
uint64_t c; uint64_t c;
while ((c = sylvan_search_or_insert(sig, previous_block, refiner)) == 0) CALL(sylvan_grow, refiner);
while ((c = sylvan_search_or_insert(sig, refiner->options.reuseBlockNumbers ? previous_block : sig, refiner)) == NO_ELEMENT_MARKER) {
CALL(sylvan_grow, refiner);
}
return CALL(sylvan_encode_block, refiner->blockCube.getInternalBdd().getSylvanBdd().GetBDD(), refiner->numberOfBlockVariables, c); return CALL(sylvan_encode_block, refiner->blockCube.getInternalBdd().getSylvanBdd().GetBDD(), refiner->numberOfBlockVariables, c);
} }

Loading…
Cancel
Save