Skip to content

Commit

Permalink
Merge pull request #1712 from DARMA-tasking/1423-remove-ref-count-lim…
Browse files Browse the repository at this point in the history
…it-check

1423 remove maximimum ref-count check
  • Loading branch information
lifflander authored Apr 13, 2022
2 parents feaa148 + c85f1bb commit 7aa19e8
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 38 deletions.
2 changes: 1 addition & 1 deletion src/vt/configs/types/types_sentinels.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ static constexpr RDMA_PtrType const no_rdma_ptr = nullptr;
static constexpr VirtualProxyType const no_vrt_proxy = u64empty;
static constexpr HandlerType const uninitialized_handler = -1;
static constexpr RDMA_HandlerType const uninitialized_rdma_handler = -1;
static constexpr RefType const not_shared_message = -1000;
static constexpr RefType const not_shared_message = 65535;
static constexpr RDMA_BlockType const no_rdma_block = -1;
static constexpr SeedType const no_seed = -1;
static constexpr VirtualElmCountType const no_elms = -1;
Expand Down
4 changes: 3 additions & 1 deletion src/vt/configs/types/types_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ using BarrierType = uint64_t;
/// Used to identify a collective operation
using CollectiveAlgType = uint64_t;
/// Used to hold the reference count for messages
using RefType = int16_t;
using RefType = uint16_t;
/// Used to hold the reference count for messages in pipes
using PipeRefType = int16_t;
/// Used to store some number of bytes
using ByteType = uint64_t;
/// Used to store the number of bits in a field
Expand Down
14 changes: 3 additions & 11 deletions src/vt/messaging/envelope/envelope_ref.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,6 @@ inline void envelopeRef(Env& env) {
"This is can be caused by explicitly using 'new Message(..)' "
"instead of a MsgPtr/makeMessage/makeSharedMessage construct."
);
vtAssertInfo(
envp->ref >= 0 and envp->ref < 100,
"Bad ref-count on message ref-increment. "
"Message ref-count must never be negative and cannnot exceed limit (100).",
static_cast<RefType>(envp->ref)
);

envp->ref++;
}
Expand All @@ -73,11 +67,9 @@ template <typename Env>
inline RefType envelopeDeref(Env& env) {
Envelope* envp = reinterpret_cast<Envelope*>(&env);

vtAssertInfo(
envp->ref >= 1,
"Bad ref-count on message ref-decrement.",
static_cast<RefType>(envp->ref)
);
if(not (envp->ref >= 1)){
vtAbort("Bad ref-count on message ref-decrement.");
}

return --(envp->ref);
}
Expand Down
2 changes: 1 addition & 1 deletion src/vt/pipe/callback/anon/callback_anon_listener.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ struct AnonListener : CallbackBase<SignalT> {
AnonListener() = default;
AnonListener(AnonListener const&) = default;
AnonListener(AnonListener&&) = default;
AnonListener(CallbackFnType const& in_fn, bool is_persist, RefType refs = -1);
AnonListener(CallbackFnType const& in_fn, bool is_persist, PipeRefType refs = -1);
explicit AnonListener(CallbackFnType const& in_fn);

private:
Expand Down
2 changes: 1 addition & 1 deletion src/vt/pipe/callback/anon/callback_anon_listener.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ namespace vt { namespace pipe { namespace callback {

template <typename SignalT>
AnonListener<SignalT>::AnonListener(
CallbackFnType const& in_fn, bool is_persist, RefType refs
CallbackFnType const& in_fn, bool is_persist, PipeRefType refs
) : CallbackBase<SignalT>(CallbackExplicitTag, is_persist, refs),
fn_(in_fn)
{ }
Expand Down
8 changes: 4 additions & 4 deletions src/vt/pipe/callback/callback_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@ struct CallbackBase {
: reference_counted_(true),
refs_(1)
{ }
CallbackBase(CallbackMultiUseTagType, RefType const& in_num_refs)
CallbackBase(CallbackMultiUseTagType, PipeRefType const& in_num_refs)
: reference_counted_(true),
refs_(in_num_refs)
{ }
CallbackBase(
CallbackExplicitTagType, bool const& persist, RefType const& in_refs = -1
CallbackExplicitTagType, bool const& persist, PipeRefType const& in_refs = -1
) : reference_counted_(!persist), refs_(in_refs)
{ }

Expand Down Expand Up @@ -134,8 +134,8 @@ struct CallbackBase {

private:
bool reference_counted_ = true;
RefType triggered_ = 0;
RefType refs_ = 1;
PipeRefType triggered_ = 0;
PipeRefType refs_ = 1;
};

}}} /* end namespace vt::pipe::callback */
Expand Down
8 changes: 4 additions & 4 deletions src/vt/pipe/pipe_manager_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ namespace vt { namespace pipe {
}

void PipeManagerBase::newPipeState(
PipeType const& pipe, bool persist, bool typeless, RefType num_signals,
RefType num_listeners, RefType num_reg_listeners, DispatchFuncType fn
PipeType const& pipe, bool persist, bool typeless, PipeRefType num_signals,
PipeRefType num_listeners, PipeRefType num_reg_listeners, DispatchFuncType fn
) {
/*
* Create pipe state of `pipe' to track the state locally on this node
Expand Down Expand Up @@ -103,8 +103,8 @@ void PipeManagerBase::newPipeState(
}

PipeType PipeManagerBase::makeCallbackFuncVoid(
bool const& persist, FuncType fn, bool const& dispatch, RefType num_signals,
RefType num_listeners
bool const& persist, FuncType fn, bool const& dispatch, PipeRefType num_signals,
PipeRefType num_listeners
) {
using SignalType = signal::SignalVoid;

Expand Down
10 changes: 5 additions & 5 deletions src/vt/pipe/pipe_manager_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,13 @@ struct PipeManagerBase {

PipeType makeCallbackFuncVoid(
bool const& persist, FuncType fn, bool const& dispatch = false,
RefType num_signals = -1, RefType num_listeners = 1
PipeRefType num_signals = -1, PipeRefType num_listeners = 1
);

template <typename MsgT>
PipeType makeCallbackFunc(
bool const& persist, FuncMsgType<MsgT> fn, bool const& dispatch = false,
RefType num_signals = -1, RefType num_listeners = 1
PipeRefType num_signals = -1, PipeRefType num_listeners = 1
);

template <typename MsgT>
Expand All @@ -113,7 +113,7 @@ struct PipeManagerBase {
template <typename MsgT, typename ListenerT>
PipeType makeCallbackAny(
bool const& persist, ListenerT&& fn, bool const& dispatch = false,
RefType num_signals = -1, RefType num_listeners = 1
PipeRefType num_signals = -1, PipeRefType num_listeners = 1
);

template <typename MsgT, typename ListenerT>
Expand All @@ -137,8 +137,8 @@ struct PipeManagerBase {
void triggerPipe(PipeType const& pipe);
void generalSignalTrigger(PipeType const& pipe);
void newPipeState(
PipeType const& pipe, bool persist, bool typeless, RefType num_sig,
RefType num_listeners, RefType num_reg_listeners,
PipeType const& pipe, bool persist, bool typeless, PipeRefType num_sig,
PipeRefType num_listeners, PipeRefType num_reg_listeners,
DispatchFuncType fn = nullptr
);

Expand Down
4 changes: 2 additions & 2 deletions src/vt/pipe/pipe_manager_base.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ void PipeManagerBase::registerCallback(
template <typename MsgT, typename ListenerT>
PipeType PipeManagerBase::makeCallbackAny(
bool const& persist, ListenerT&& listener, bool const& dispatch,
RefType num_signals, RefType num_listeners
PipeRefType num_signals, PipeRefType num_listeners
) {
using SignalType = signal::Signal<MsgT>;

Expand Down Expand Up @@ -170,7 +170,7 @@ PipeType PipeManagerBase::makeCallbackAny(
template <typename MsgT>
PipeType PipeManagerBase::makeCallbackFunc(
bool const& persist, FuncMsgType<MsgT> fn, bool const& dispatch,
RefType num_signals, RefType num_listeners
PipeRefType num_signals, PipeRefType num_listeners
) {
using SignalType = signal::Signal<MsgT>;
vtAssert(num_listeners > 0, "Number of listeners must be positive");
Expand Down
4 changes: 2 additions & 2 deletions src/vt/pipe/state/pipe_state.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
namespace vt { namespace pipe {

PipeState::PipeState(
PipeType const& in_pipe, RefType const& in_signals, RefType const& in_lis,
PipeType const& in_pipe, PipeRefType const& in_signals, PipeRefType const& in_lis,
bool const& in_typeless
) : automatic_(true), typeless_(in_typeless), num_signals_expected_(in_signals),
num_listeners_expected_(in_lis), pipe_(in_pipe)
Expand Down Expand Up @@ -82,7 +82,7 @@ PipeType PipeState::getPipe() const {
return pipe_;
}

RefType PipeState::refsPerListener() const {
PipeRefType PipeState::refsPerListener() const {
return num_signals_expected_;
}

Expand Down
12 changes: 6 additions & 6 deletions src/vt/pipe/state/pipe_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ struct PipeState {
using DispatchFuncType = std::function<void(void*)>;

PipeState(
PipeType const& in_pipe, RefType const& in_signals, RefType const& in_lis,
PipeType const& in_pipe, PipeRefType const& in_signals, PipeRefType const& in_lis,
bool const& in_typeless = false
);

Expand All @@ -68,7 +68,7 @@ struct PipeState {
bool isPersist() const;
PipeType getPipe() const;
bool finished() const;
RefType refsPerListener() const;
PipeRefType refsPerListener() const;

bool hasDispatch() const;
void setDispatch(DispatchFuncType in_dispatch);
Expand All @@ -77,10 +77,10 @@ struct PipeState {
private:
bool automatic_ = false;
bool typeless_ = false;
RefType num_signals_expected_ = -1;
RefType num_signals_received_ = 0;
RefType num_listeners_expected_ = -1;
RefType num_listeners_received_ = 0;
PipeRefType num_signals_expected_ = -1;
PipeRefType num_signals_received_ = 0;
PipeRefType num_listeners_expected_ = -1;
PipeRefType num_listeners_received_ = 0;
PipeType pipe_ = no_pipe;
DispatchFuncType dispatch_ = nullptr;
};
Expand Down

0 comments on commit 7aa19e8

Please sign in to comment.