Skip to content

Commit cfd5d96

Browse files
committed
ch4: remove av table ref_count
We don't really tracek av tables' ref_count. We simply free all av tables at finalize. Rename MPIDIU_avt_destroy to MPIDIU_avt_finalize to better reflect its role.
1 parent fa829a8 commit cfd5d96

File tree

4 files changed

+4
-38
lines changed

4 files changed

+4
-38
lines changed

src/mpid/ch4/src/ch4_init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@ int MPID_Finalize(void)
734734

735735
MPIDU_genq_private_pool_destroy(MPIDI_global.gpu_coll_pool);
736736

737-
MPIDIU_avt_destroy();
737+
MPIDIU_avt_finalize();
738738

739739
mpi_errno = MPIDU_Init_shm_finalize();
740740
MPIR_ERR_CHECK(mpi_errno);

src/mpid/ch4/src/ch4_proc.c

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,6 @@ int MPIDIU_new_avt(int size, int *avtid)
102102
}
103103
MPIDI_global.avt_mgr.av_tables[*avtid] = new_av_table;
104104

105-
MPIR_cc_set(&MPIDI_global.avt_mgr.av_tables[*avtid]->ref_count, 0);
106-
107105
MPIR_FUNC_EXIT;
108106
return mpi_errno;
109107
}
@@ -124,33 +122,6 @@ int MPIDIU_free_avt(int avtid)
124122
return mpi_errno;
125123
}
126124

127-
int MPIDIU_avt_add_ref(int avtid)
128-
{
129-
MPIR_FUNC_ENTER;
130-
131-
MPL_DBG_MSG_FMT(MPIDI_CH4_DBG_GENERAL, VERBOSE, (MPL_DBG_FDEST, " incr avtid=%d", avtid));
132-
MPIR_cc_inc(&MPIDI_global.avt_mgr.av_tables[avtid]->ref_count);
133-
134-
MPIR_FUNC_EXIT;
135-
return MPI_SUCCESS;
136-
}
137-
138-
int MPIDIU_avt_release_ref(int avtid)
139-
{
140-
int in_use;
141-
142-
MPIR_FUNC_ENTER;
143-
144-
MPL_DBG_MSG_FMT(MPIDI_CH4_DBG_GENERAL, VERBOSE, (MPL_DBG_FDEST, " decr avtid=%d", avtid));
145-
MPIR_cc_decr(&MPIDI_global.avt_mgr.av_tables[avtid]->ref_count, &in_use);
146-
if (!in_use) {
147-
MPIDIU_free_avt(avtid);
148-
}
149-
150-
MPIR_FUNC_EXIT;
151-
return MPI_SUCCESS;
152-
}
153-
154125
static void init_dynamic_av_table(void);
155126
static void destroy_dynamic_av_table(void);
156127

@@ -178,7 +149,6 @@ int MPIDIU_avt_init(void)
178149
#endif
179150

180151
MPIDI_global.avt_mgr.av_table0->size = size;
181-
MPIR_cc_set(&MPIDI_global.avt_mgr.av_table0->ref_count, 1);
182152

183153
for (int i = 0; i < size; i++) {
184154
MPIDI_global.avt_mgr.av_table0->table[i].is_local =
@@ -194,14 +164,13 @@ int MPIDIU_avt_init(void)
194164
return mpi_errno;
195165
}
196166

197-
int MPIDIU_avt_destroy(void)
167+
int MPIDIU_avt_finalize(void)
198168
{
199169
MPIR_FUNC_ENTER;
200170

201171
for (int i = 0; i < MPIDI_global.avt_mgr.n_avts; i++) {
202172
if (MPIDI_global.avt_mgr.av_tables[i] != NULL) {
203-
MPIDIU_avt_release_ref(i);
204-
/*TODO: Check all references is cleared and the entry is set to NULL */
173+
MPIDIU_free_avt(i);
205174
}
206175
}
207176

src/mpid/ch4/src/ch4_proc.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,8 @@ int MPIDIU_get_n_avts(void);
2222
int MPIDIU_get_avt_size(int avtid);
2323
int MPIDIU_new_avt(int size, int *avtid);
2424
int MPIDIU_free_avt(int avtid);
25-
int MPIDIU_avt_add_ref(int avtid);
26-
int MPIDIU_avt_release_ref(int avtid);
2725
int MPIDIU_avt_init(void);
28-
int MPIDIU_avt_destroy(void);
26+
int MPIDIU_avt_finalize(void);
2927
int MPIDIU_get_node_id(MPIR_Comm * comm, int rank, int *id_p);
3028

3129
#ifdef MPIDI_BUILD_CH4_UPID_HASH

src/mpid/ch4/src/ch4_types.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,6 @@ typedef struct MPIDIG_acc_ack_msg_t {
185185
typedef MPIDIG_acc_ack_msg_t MPIDIG_get_acc_ack_msg_t;
186186

187187
typedef struct {
188-
MPIR_cc_t ref_count;
189188
int size;
190189
MPIDI_av_entry_t table[];
191190
} MPIDI_av_table_t;

0 commit comments

Comments
 (0)