X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/50315369ab3f6921a3c6c6a266cf1d25b9c56b4d..fd0a3e64ee8c0eef865c03b8758deb7213f9ee67:/src/mc/transition/TransitionComm.cpp diff --git a/src/mc/transition/TransitionComm.cpp b/src/mc/transition/TransitionComm.cpp index 029548dd63..ddb284c74b 100644 --- a/src/mc/transition/TransitionComm.cpp +++ b/src/mc/transition/TransitionComm.cpp @@ -18,12 +18,26 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_trans_comm, mc_transition, namespace simgrid::mc { +CommWaitTransition::CommWaitTransition(aid_t issuer, int times_considered, bool timeout_, unsigned comm_, aid_t sender_, + aid_t receiver_, unsigned mbox_, uintptr_t sbuff_, uintptr_t rbuff_, + size_t size_) + : Transition(Type::COMM_WAIT, issuer, times_considered) + , timeout_(timeout_) + , comm_(comm_) + , mbox_(mbox_) + , sender_(sender_) + , receiver_(receiver_) + , sbuff_(sbuff_) + , rbuff_(rbuff_) + , size_(size_) +{ +} CommWaitTransition::CommWaitTransition(aid_t issuer, int times_considered, std::stringstream& stream) : Transition(Type::COMM_WAIT, issuer, times_considered) { xbt_assert(stream >> timeout_ >> comm_ >> sender_ >> receiver_ >> mbox_ >> sbuff_ >> rbuff_ >> size_); - XBT_DEBUG("CommWaitTransition %s comm:%" PRIxPTR ", sender:%ld receiver:%ld mbox:%u sbuff:%" PRIxPTR - " rbuff:%" PRIxPTR " size:%zu", + XBT_DEBUG("CommWaitTransition %s comm:%u, sender:%ld receiver:%ld mbox:%u sbuff:%" PRIxPTR " rbuff:%" PRIxPTR + " size:%zu", (timeout_ ? "timeout" : "no-timeout"), comm_, sender_, receiver_, mbox_, sbuff_, rbuff_, size_); } std::string CommWaitTransition::to_string(bool verbose) const @@ -49,23 +63,28 @@ bool CommWaitTransition::depends(const Transition* other) const if (const auto* wait = dynamic_cast(other)) { if (timeout_ || wait->timeout_) return true; // Timeouts are not considered by the independence theorem, thus assumed dependent - - if (sbuff_ == wait->sbuff_ && rbuff_ == wait->rbuff_) - return false; - if (sbuff_ != 0 && rbuff_ != 0 && wait->sbuff_ != 0 && wait->rbuff_ != 0 && rbuff_ != wait->sbuff_ && - rbuff_ != wait->rbuff_ && rbuff_ != sbuff_) - return false; - - return true; } return false; // Comm transitions are INDEP with non-comm transitions } +CommTestTransition::CommTestTransition(aid_t issuer, int times_considered, unsigned comm_, aid_t sender_, + aid_t receiver_, unsigned mbox_, uintptr_t sbuff_, uintptr_t rbuff_, + size_t size_) + : Transition(Type::COMM_TEST, issuer, times_considered) + , comm_(comm_) + , mbox_(mbox_) + , sender_(sender_) + , receiver_(receiver_) + , sbuff_(sbuff_) + , rbuff_(rbuff_) + , size_(size_) +{ +} CommTestTransition::CommTestTransition(aid_t issuer, int times_considered, std::stringstream& stream) : Transition(Type::COMM_TEST, issuer, times_considered) { xbt_assert(stream >> comm_ >> sender_ >> receiver_ >> mbox_ >> sbuff_ >> rbuff_ >> size_); - XBT_DEBUG("CommTestTransition comm:%" PRIxPTR ", sender:%ld receiver:%ld mbox:%u sbuff:%" PRIxPTR " rbuff:%" PRIxPTR + XBT_DEBUG("CommTestTransition comm:%u, sender:%ld receiver:%ld mbox:%u sbuff:%" PRIxPTR " rbuff:%" PRIxPTR " size:%zu", comm_, sender_, receiver_, mbox_, sbuff_, rbuff_, size_); } @@ -102,6 +121,15 @@ bool CommTestTransition::depends(const Transition* other) const return false; // Comm transitions are INDEP with non-comm transitions } +CommRecvTransition::CommRecvTransition(aid_t issuer, int times_considered, unsigned comm_, unsigned mbox_, + uintptr_t rbuff_, int tag_) + : Transition(Type::COMM_ASYNC_RECV, issuer, times_considered) + , comm_(comm_) + , mbox_(mbox_) + , rbuff_(rbuff_) + , tag_(tag_) +{ +} CommRecvTransition::CommRecvTransition(aid_t issuer, int times_considered, std::stringstream& stream) : Transition(Type::COMM_ASYNC_RECV, issuer, times_considered) { @@ -134,20 +162,30 @@ bool CommRecvTransition::depends(const Transition* other) const if (mbox_ != test->mbox_) return false; - if ((aid_ != test->sender_) && (aid_ != test->receiver_) && (test->rbuff_ != rbuff_)) + if ((aid_ != test->sender_) && (aid_ != test->receiver_)) + return false; + + // If the test is checking a paired comm already, we're independent! + // If we happen to make up that pair, then we're dependent... + if (test->comm_ != comm_) return false; return true; // DEP with other send transitions } - if (auto* wait = dynamic_cast(other)) { + if (const auto* wait = dynamic_cast(other)) { if (wait->timeout_) return true; if (mbox_ != wait->mbox_) return false; - if ((aid_ != wait->sender_) && (aid_ != wait->receiver_) && (wait->rbuff_ != rbuff_)) + if ((aid_ != wait->sender_) && (aid_ != wait->receiver_)) + return false; + + // If the wait is waiting on a paired comm already, we're independent! + // If we happen to make up that pair, then we're dependent... + if ((aid_ != wait->aid_) && wait->comm_ != comm_) return false; return true; // DEP with other wait transitions @@ -156,11 +194,21 @@ bool CommRecvTransition::depends(const Transition* other) const return false; // Comm transitions are INDEP with non-comm transitions } +CommSendTransition::CommSendTransition(aid_t issuer, int times_considered, unsigned comm_, unsigned mbox_, + uintptr_t sbuff_, size_t size_, int tag_) + : Transition(Type::COMM_ASYNC_SEND, issuer, times_considered) + , comm_(comm_) + , mbox_(mbox_) + , sbuff_(sbuff_) + , size_(size_) + , tag_(tag_) +{ +} CommSendTransition::CommSendTransition(aid_t issuer, int times_considered, std::stringstream& stream) : Transition(Type::COMM_ASYNC_SEND, issuer, times_considered) { xbt_assert(stream >> comm_ >> mbox_ >> sbuff_ >> size_ >> tag_); - XBT_DEBUG("SendTransition comm:%" PRIxPTR " mbox:%u sbuff:%" PRIxPTR " size:%zu", comm_, mbox_, sbuff_, size_); + XBT_DEBUG("SendTransition comm:%u mbox:%u sbuff:%" PRIxPTR " size:%zu", comm_, mbox_, sbuff_, size_); } std::string CommSendTransition::to_string(bool verbose = false) const { @@ -190,7 +238,12 @@ bool CommSendTransition::depends(const Transition* other) const if (mbox_ != test->mbox_) return false; - if ((aid_ != test->sender_) && (aid_ != test->receiver_) && (test->sbuff_ != sbuff_)) + if ((aid_ != test->sender_) && (aid_ != test->receiver_)) + return false; + + // If the test is checking a paired comm already, we're independent! + // If we happen to make up that pair, then we're dependent... + if (test->comm_ != comm_) return false; return true; // DEP with other test transitions @@ -203,7 +256,12 @@ bool CommSendTransition::depends(const Transition* other) const if (mbox_ != wait->mbox_) return false; - if ((aid_ != wait->sender_) && (aid_ != wait->receiver_) && (wait->sbuff_ != sbuff_)) + if ((aid_ != wait->sender_) && (aid_ != wait->receiver_)) + return false; + + // If the wait is waiting on a paired comm already, we're independent! + // If we happen to make up that pair, then we're dependent... + if ((aid_ != wait->aid_) && wait->comm_ != comm_) return false; return true; // DEP with other wait transitions