5252getNextIdImpl (StateHolder::StatesVec& states, size_t idx) {
5353 size_t id = u64empty;
5454
55+ vt_debug_print (
56+ terse, allreduce, " getNextIdImpl idx={} size={} \n " , idx, states.size ());
57+
5558 for (; idx < states.size (); ++idx) {
5659 auto & state = states.at (idx);
5760 if (not state or not state->active_ ) {
@@ -64,28 +67,35 @@ getNextIdImpl(StateHolder::StatesVec& states, size_t idx) {
6467 id = states.size ();
6568 }
6669
70+
6771 return id;
6872}
6973
7074size_t StateHolder::getNextID (detail::StrongVrtProxy proxy) {
71- auto & states = active_coll_states_[proxy.get ()];
75+ auto & [idx, states] = active_coll_states_[proxy.get ()];
76+
77+ auto current_idx = getNextIdImpl (states, idx);
78+ idx = current_idx + 1 ;
7279
73- collection_idx_ = getNextIdImpl (states, collection_idx_);
74- return collection_idx_;
80+ return current_idx;
7581}
7682
7783size_t StateHolder::getNextID (detail::StrongObjGroup proxy) {
78- auto & states = active_obj_states_[proxy.get ()];
84+ auto & [idx, states] = active_obj_states_[proxy.get ()];
7985
80- objgroup_idx_ = getNextIdImpl (states, objgroup_idx_);
81- return objgroup_idx_;
86+ auto current_idx = getNextIdImpl (states, idx);
87+ idx = current_idx + 1 ;
88+
89+ return current_idx;
8290}
8391
8492size_t StateHolder::getNextID (detail::StrongGroup group) {
85- auto & states = active_grp_states_[group.get ()];
93+ auto & [idx, states] = active_grp_states_[group.get ()];
94+
95+ auto current_idx = getNextIdImpl (states, idx);
8696
87- group_idx_ = getNextIdImpl (states, group_idx_) ;
88- return group_idx_ ;
97+ idx = current_idx + 1 ;
98+ return current_idx ;
8999}
90100
91101static inline void
@@ -101,19 +111,19 @@ clearSingleImpl(StateHolder::StatesVec& states, size_t idx) {
101111}
102112
103113void StateHolder::clearSingle (detail::StrongVrtProxy proxy, size_t idx) {
104- auto & states = active_coll_states_[proxy.get ()];
114+ auto & [_, states] = active_coll_states_[proxy.get ()];
105115
106116 clearSingleImpl (states, idx);
107117}
108118
109119void StateHolder::clearSingle (detail::StrongObjGroup proxy, size_t idx) {
110- auto & states = active_obj_states_[proxy.get ()];
120+ auto & [_, states] = active_obj_states_[proxy.get ()];
111121
112122 clearSingleImpl (states, idx);
113123}
114124
115125void StateHolder::clearSingle (detail::StrongGroup group, size_t idx) {
116- auto & states = active_grp_states_[group.get ()];
126+ auto & [_, states] = active_grp_states_[group.get ()];
117127
118128 clearSingleImpl (states, idx);
119129}
0 commit comments