Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of https://framagit.org/simgrid/simgrid
authormlaurent <mathieu.laurent@ens-rennes.fr>
Tue, 13 Jun 2023 09:17:57 +0000 (11:17 +0200)
committermlaurent <mathieu.laurent@ens-rennes.fr>
Tue, 13 Jun 2023 09:17:57 +0000 (11:17 +0200)
1  2 
src/mc/transition/TransitionComm.cpp

@@@ -18,11 -18,24 +18,25 @@@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_tran
  
  namespace simgrid::mc {
  
+ CommWaitTransition::CommWaitTransition(aid_t issuer, int times_considered, bool timeout_, uintptr_t 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_)
+     , sender_(sender_)
+     , receiver_(receiver_)
+     , mbox_(mbox_)
+     , 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_assert(stream >> timeout_ >> comm_ >> sender_ >> receiver_ >> mbox_ >> sbuff_ >> rbuff_ >> size_ >>
 +             user_fun_call_);
    XBT_DEBUG("CommWaitTransition %s comm:%" PRIxPTR ", sender:%ld receiver:%ld mbox:%u sbuff:%" PRIxPTR
              " rbuff:%" PRIxPTR " size:%zu",
              (timeout_ ? "timeout" : "no-timeout"), comm_, sender_, receiver_, mbox_, sbuff_, rbuff_, size_);
@@@ -54,10 -67,23 +68,23 @@@ bool CommWaitTransition::depends(const 
  
    return false; // Comm transitions are INDEP with non-comm transitions
  }
+ CommTestTransition::CommTestTransition(aid_t issuer, int times_considered, uintptr_t 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_)
+     , sender_(sender_)
+     , receiver_(receiver_)
+     , mbox_(mbox_)
+     , 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_assert(stream >> comm_ >> sender_ >> receiver_ >> mbox_ >> sbuff_ >> rbuff_ >> size_ >> user_fun_call_);
    XBT_DEBUG("CommTestTransition comm:%" PRIxPTR ", sender:%ld receiver:%ld mbox:%u sbuff:%" PRIxPTR " rbuff:%" PRIxPTR
              " size:%zu",
              comm_, sender_, receiver_, mbox_, sbuff_, rbuff_, size_);
@@@ -95,10 -121,19 +122,19 @@@ bool CommTestTransition::depends(const 
    return false; // Comm transitions are INDEP with non-comm transitions
  }
  
+ CommRecvTransition::CommRecvTransition(aid_t issuer, int times_considered, uintptr_t 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)
  {
 -  xbt_assert(stream >> comm_ >> mbox_ >> rbuff_ >> tag_);
 +  xbt_assert(stream >> comm_ >> mbox_ >> rbuff_ >> tag_ >> user_fun_call_);
  }
  std::string CommRecvTransition::to_string(bool verbose) const
  {
@@@ -130,6 -165,11 +166,11 @@@ bool CommRecvTransition::depends(const 
      if ((aid_ != test->sender_) && (aid_ != test->receiver_) && (test->rbuff_ != rbuff_))
        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 ((aid_ != wait->sender_) && (aid_ != wait->receiver_) && (wait->rbuff_ != rbuff_))
        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
    }
  
    return false; // Comm transitions are INDEP with non-comm transitions
  }
  
+ CommSendTransition::CommSendTransition(aid_t issuer, int times_considered, uintptr_t 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_assert(stream >> comm_ >> mbox_ >> sbuff_ >> size_ >> tag_ >> user_fun_call_);
    XBT_DEBUG("SendTransition comm:%" PRIxPTR " mbox:%u sbuff:%" PRIxPTR " size:%zu", comm_, mbox_, sbuff_, size_);
  }
  std::string CommSendTransition::to_string(bool verbose = false) const
@@@ -186,6 -241,11 +242,11 @@@ bool CommSendTransition::depends(const 
      if ((aid_ != test->sender_) && (aid_ != test->receiver_) && (test->sbuff_ != sbuff_))
        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
    }
  
      if ((aid_ != wait->sender_) && (aid_ != wait->receiver_) && (wait->sbuff_ != sbuff_))
        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
    }