Commit 3f01c838 authored by David Goodell's avatar David Goodell
Browse files

[svn-r7916] refactor greq storage in request to save space in pt2pt requests

This change moves the greq functions and state into a subordinate
struct that is only created for generalized requests.  This saves ~48 bytes
per request on many platforms in the common pt2pt request case.

Reviewed by buntinas@.
parent c0ddb610
......@@ -1351,6 +1351,19 @@ typedef void (MPIR_Grequest_f77_cancel_function)(void *, int*, int *);
typedef void (MPIR_Grequest_f77_free_function)(void *, int *);
typedef void (MPIR_Grequest_f77_query_function)(void *, MPI_Status *, int *);
/* vtable-ish structure holding generalized request function pointers and other
* state. Saves ~48 bytes in pt2pt requests on many platforms. */
struct MPID_Grequest_fns {
MPI_Grequest_cancel_function *cancel_fn;
MPI_Grequest_free_function *free_fn;
MPI_Grequest_query_function *query_fn;
MPIX_Grequest_poll_function *poll_fn;
MPIX_Grequest_wait_function *wait_fn;
void *grequest_extra_state;
MPIX_Grequest_class greq_class;
MPID_Lang_t greq_lang; /* language that defined
the generalize req */
};
/* see mpiimplthread.h for the def of MPID_cc_t and related functions/macros */
#define MPID_Request_is_complete(req_) (MPID_cc_is_complete((req_)->cc_ptr))
......@@ -1386,17 +1399,11 @@ typedef struct MPID_Request {
/* Persistent requests have their own "real" requests. Receive requests
have partnering send requests when src=dest. etc. */
struct MPID_Request *partner_request;
/* User-defined request support */
MPI_Grequest_cancel_function *cancel_fn;
MPI_Grequest_free_function *free_fn;
MPI_Grequest_query_function *query_fn;
MPIX_Grequest_poll_function *poll_fn;
MPIX_Grequest_wait_function *wait_fn;
void *grequest_extra_state;
MPIX_Grequest_class greq_class;
MPID_Lang_t greq_lang; /* language that defined
the generalize req */
/* User-defined request support via a "vtable". Saves space in the already
* bloated request for regular pt2pt and NBC requests. */
struct MPID_Grequest_fns *greq_fns;
/* Other, device-specific information */
#ifdef MPID_DEV_REQUEST_DECL
MPID_DEV_REQUEST_DECL
......
......@@ -76,7 +76,8 @@ int MPIR_Grequest_start_impl(MPI_Grequest_query_function *query_fn,
void *extra_state, MPID_Request **request_ptr)
{
int mpi_errno = MPI_SUCCESS;
MPIU_CHKPMEM_DECL(1);
/* MT FIXME this routine is not thread-safe in the non-global case */
*request_ptr = MPID_Request_create();
......@@ -87,17 +88,21 @@ int MPIR_Grequest_start_impl(MPI_Grequest_query_function *query_fn,
(*request_ptr)->cc_ptr = &(*request_ptr)->cc;
MPID_cc_set((*request_ptr)->cc_ptr, 1);
(*request_ptr)->comm = NULL;
(*request_ptr)->cancel_fn = cancel_fn;
(*request_ptr)->free_fn = free_fn;
(*request_ptr)->query_fn = query_fn;
(*request_ptr)->poll_fn = NULL;
(*request_ptr)->wait_fn = NULL;
(*request_ptr)->grequest_extra_state = extra_state;
(*request_ptr)->greq_lang = MPID_LANG_C;
(*request_ptr)->greq_fns = NULL;
MPIU_CHKPMEM_MALLOC((*request_ptr)->greq_fns, struct MPID_Grequest_fns *, sizeof(struct MPID_Grequest_fns), mpi_errno, "greq_fns");
(*request_ptr)->greq_fns->cancel_fn = cancel_fn;
(*request_ptr)->greq_fns->free_fn = free_fn;
(*request_ptr)->greq_fns->query_fn = query_fn;
(*request_ptr)->greq_fns->poll_fn = NULL;
(*request_ptr)->greq_fns->wait_fn = NULL;
(*request_ptr)->greq_fns->grequest_extra_state = extra_state;
(*request_ptr)->greq_fns->greq_lang = MPID_LANG_C;
MPIU_CHKPMEM_COMMIT();
fn_exit:
return mpi_errno;
fn_fail:
MPIU_CHKPMEM_REAP();
goto fn_exit;
}
......@@ -333,17 +338,17 @@ int MPIX_Grequest_class_allocate(MPIX_Grequest_class greq_class,
MPID_Request *lrequest_ptr;
MPID_Grequest_class *class_ptr;
*request = MPI_REQUEST_NULL;
MPID_Grequest_class_get_ptr(greq_class, class_ptr);
mpi_errno = MPI_Grequest_start(class_ptr->query_fn,
class_ptr->free_fn, class_ptr->cancel_fn,
extra_state, request);
mpi_errno = MPIR_Grequest_start_impl(class_ptr->query_fn, class_ptr->free_fn,
class_ptr->cancel_fn, extra_state,
&lrequest_ptr);
if (mpi_errno == MPI_SUCCESS)
{
MPID_Request_get_ptr(*request, lrequest_ptr);
lrequest_ptr->poll_fn = class_ptr->poll_fn;
lrequest_ptr->wait_fn = class_ptr->wait_fn;
lrequest_ptr->greq_class = greq_class;
*request = lrequest_ptr->handle;
lrequest_ptr->greq_fns->poll_fn = class_ptr->poll_fn;
lrequest_ptr->greq_fns->wait_fn = class_ptr->wait_fn;
lrequest_ptr->greq_fns->greq_class = greq_class;
}
return mpi_errno;
}
......@@ -378,14 +383,14 @@ int MPIX_Grequest_start( MPI_Grequest_query_function *query_fn,
int mpi_errno;
MPID_Request *lrequest_ptr;
mpi_errno = MPI_Grequest_start(query_fn, free_fn, cancel_fn,
extra_state, request);
*request = MPI_REQUEST_NULL;
mpi_errno = MPIR_Grequest_start_impl(query_fn, free_fn, cancel_fn, extra_state, &lrequest_ptr);
if (mpi_errno == MPI_SUCCESS)
{
MPID_Request_get_ptr(*request, lrequest_ptr);
lrequest_ptr->poll_fn = poll_fn;
lrequest_ptr->wait_fn = wait_fn;
{
*request = lrequest_ptr->handle;
lrequest_ptr->greq_fns->poll_fn = poll_fn;
lrequest_ptr->greq_fns->wait_fn = wait_fn;
}
return mpi_errno;
......
......@@ -306,14 +306,14 @@ int MPIR_Request_get_error(MPID_Request * request_ptr)
/* Note that we've acquired the thread private storage above */
switch (request_ptr->greq_lang)
switch (request_ptr->greq_fns->greq_lang)
{
case MPID_LANG_C:
#ifdef HAVE_CXX_BINDING
case MPID_LANG_CXX:
#endif
rc = (request_ptr->query_fn)(
request_ptr->grequest_extra_state,
rc = (request_ptr->greq_fns->query_fn)(
request_ptr->greq_fns->grequest_extra_state,
&request_ptr->status);
MPIU_ERR_CHKANDSTMT1((rc != MPI_SUCCESS), mpi_errno,
MPI_ERR_OTHER,;, "**user", "**userquery %d", rc);
......@@ -323,8 +323,8 @@ int MPIR_Request_get_error(MPID_Request * request_ptr)
case MPID_LANG_FORTRAN90:
{
MPI_Fint ierr;
((MPIR_Grequest_f77_query_function*)(request_ptr->query_fn))(
request_ptr->grequest_extra_state, &request_ptr->status,
((MPIR_Grequest_f77_query_function*)(request_ptr->greq_fns->query_fn))(
request_ptr->greq_fns->grequest_extra_state, &request_ptr->status,
&ierr );
rc = (int) ierr;
MPIU_ERR_CHKANDSTMT1((rc != MPI_SUCCESS), mpi_errno,
......@@ -339,7 +339,7 @@ int MPIR_Request_get_error(MPID_Request * request_ptr)
/* This should not happen */
MPIU_ERR_SETANDSTMT1(mpi_errno, MPI_ERR_INTERN,;,
"**badcase",
"**badcase %d", request_ptr->greq_lang);
"**badcase %d", request_ptr->greq_fns->greq_lang);
break;
/* --END ERROR HANDLING-- */
}
......@@ -370,7 +370,7 @@ void MPIR_Grequest_set_lang_f77( MPI_Request greq )
MPID_Request_get_ptr( greq, greq_ptr );
greq_ptr->greq_lang = MPID_LANG_FORTRAN;
greq_ptr->greq_fns->greq_lang = MPID_LANG_FORTRAN;
}
#endif
......@@ -384,14 +384,14 @@ int MPIR_Grequest_cancel(MPID_Request * request_ptr, int complete)
int rc;
int mpi_errno = MPI_SUCCESS;
switch (request_ptr->greq_lang)
switch (request_ptr->greq_fns->greq_lang)
{
case MPID_LANG_C:
#ifdef HAVE_CXX_BINDING
case MPID_LANG_CXX:
#endif
rc = (request_ptr->cancel_fn)(
request_ptr->grequest_extra_state, complete);
rc = (request_ptr->greq_fns->cancel_fn)(
request_ptr->greq_fns->grequest_extra_state, complete);
MPIU_ERR_CHKANDSTMT1((rc != MPI_SUCCESS), mpi_errno,
MPI_ERR_OTHER,;, "**user", "**usercancel %d", rc);
break;
......@@ -401,8 +401,8 @@ int MPIR_Grequest_cancel(MPID_Request * request_ptr, int complete)
{
MPI_Fint ierr;
((MPIR_Grequest_f77_cancel_function *)(request_ptr->cancel_fn))(
request_ptr->grequest_extra_state, &complete, &ierr);
((MPIR_Grequest_f77_cancel_function *)(request_ptr->greq_fns->cancel_fn))(
request_ptr->greq_fns->grequest_extra_state, &complete, &ierr);
rc = (int) ierr;
MPIU_ERR_CHKANDSTMT1((rc != MPI_SUCCESS), mpi_errno, MPI_ERR_OTHER,
{;}, "**user", "**usercancel %d", rc);
......@@ -415,7 +415,7 @@ int MPIR_Grequest_cancel(MPID_Request * request_ptr, int complete)
/* --BEGIN ERROR HANDLING-- */
/* This should not happen */
MPIU_ERR_SETANDSTMT1(mpi_errno, MPI_ERR_INTERN,;, "**badcase",
"**badcase %d", request_ptr->greq_lang);
"**badcase %d", request_ptr->greq_fns->greq_lang);
break;
/* --END ERROR HANDLING-- */
}
......@@ -434,13 +434,13 @@ int MPIR_Grequest_query(MPID_Request * request_ptr)
int rc;
int mpi_errno = MPI_SUCCESS;
switch (request_ptr->greq_lang)
switch (request_ptr->greq_fns->greq_lang)
{
case MPID_LANG_C:
#ifdef HAVE_CXX_BINDING
case MPID_LANG_CXX:
#endif
rc = (request_ptr->query_fn)(request_ptr->grequest_extra_state,
rc = (request_ptr->greq_fns->query_fn)(request_ptr->greq_fns->grequest_extra_state,
&request_ptr->status);
MPIU_ERR_CHKANDSTMT1((rc != MPI_SUCCESS), mpi_errno, MPI_ERR_OTHER,
{;}, "**user", "**userquery %d", rc);
......@@ -450,8 +450,8 @@ int MPIR_Grequest_query(MPID_Request * request_ptr)
case MPID_LANG_FORTRAN90:
{
MPI_Fint ierr;
((MPIR_Grequest_f77_query_function *)(request_ptr->query_fn))(
request_ptr->grequest_extra_state, &request_ptr->status, &ierr );
((MPIR_Grequest_f77_query_function *)(request_ptr->greq_fns->query_fn))(
request_ptr->greq_fns->grequest_extra_state, &request_ptr->status, &ierr );
rc = (int)ierr;
MPIU_ERR_CHKANDSTMT1((rc != MPI_SUCCESS), mpi_errno, MPI_ERR_OTHER,
{;}, "**user", "**userquery %d", rc);
......@@ -463,7 +463,7 @@ int MPIR_Grequest_query(MPID_Request * request_ptr)
/* --BEGIN ERROR HANDLING-- */
/* This should not happen */
MPIU_ERR_SETANDSTMT1(mpi_errno, MPI_ERR_INTERN,;, "**badcase",
"**badcase %d", request_ptr->greq_lang);
"**badcase %d", request_ptr->greq_fns->greq_lang);
break;
/* --END ERROR HANDLING-- */
}
......@@ -482,13 +482,13 @@ int MPIR_Grequest_free(MPID_Request * request_ptr)
int rc;
int mpi_errno = MPI_SUCCESS;
switch (request_ptr->greq_lang)
switch (request_ptr->greq_fns->greq_lang)
{
case MPID_LANG_C:
#ifdef HAVE_CXX_BINDING
case MPID_LANG_CXX:
#endif
rc = (request_ptr->free_fn)(request_ptr->grequest_extra_state);
rc = (request_ptr->greq_fns->free_fn)(request_ptr->greq_fns->grequest_extra_state);
MPIU_ERR_CHKANDSTMT1((rc != MPI_SUCCESS), mpi_errno, MPI_ERR_OTHER,
{;}, "**user", "**userfree %d", rc);
break;
......@@ -498,8 +498,8 @@ int MPIR_Grequest_free(MPID_Request * request_ptr)
{
MPI_Fint ierr;
((MPIR_Grequest_f77_free_function *)(request_ptr->free_fn))(
request_ptr->grequest_extra_state, &ierr);
((MPIR_Grequest_f77_free_function *)(request_ptr->greq_fns->free_fn))(
request_ptr->greq_fns->grequest_extra_state, &ierr);
rc = (int) ierr;
MPIU_ERR_CHKANDSTMT1((rc != MPI_SUCCESS), mpi_errno, MPI_ERR_OTHER,
{;}, "**user", "**userfree %d", rc);
......@@ -512,7 +512,7 @@ int MPIR_Grequest_free(MPID_Request * request_ptr)
/* --BEGIN ERROR HANDLING-- */
/* This should not happen */
MPIU_ERR_SETANDSTMT1(mpi_errno, MPI_ERR_INTERN, {;}, "**badcase",
"**badcase %d", request_ptr->greq_lang);
"**badcase %d", request_ptr->greq_fns->greq_lang);
break;
/* --END ERROR HANDLING-- */
}
......@@ -550,13 +550,13 @@ int MPIR_Grequest_progress_poke(int count,
if (request_ptrs[i]->kind == MPID_UREQUEST)
{
n_greq += 1;
wait_fn = request_ptrs[i]->wait_fn;
state_ptrs[j] = request_ptrs[i]->grequest_extra_state;
wait_fn = request_ptrs[i]->greq_fns->wait_fn;
state_ptrs[j] = request_ptrs[i]->greq_fns->grequest_extra_state;
j++;
if (i+1 < count) {
if (request_ptrs[i+1] == NULL ||
(request_ptrs[i]->greq_class !=
request_ptrs[i+1]->greq_class) )
(request_ptrs[i]->greq_fns->greq_class !=
request_ptrs[i+1]->greq_fns->greq_class) )
n_classes += 1;
}
} else {
......@@ -572,9 +572,9 @@ int MPIR_Grequest_progress_poke(int count,
if (request_ptrs[i] != NULL &&
request_ptrs[i]->kind == MPID_UREQUEST &&
!MPID_Request_is_complete(request_ptrs[i]) &&
request_ptrs[i]->poll_fn != NULL)
request_ptrs[i]->greq_fns->poll_fn != NULL)
{
mpi_errno = (request_ptrs[i]->poll_fn)(request_ptrs[i]->grequest_extra_state, &(array_of_statuses[i]));
mpi_errno = (request_ptrs[i]->greq_fns->poll_fn)(request_ptrs[i]->greq_fns->grequest_extra_state, &(array_of_statuses[i]));
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
}
}
......@@ -626,13 +626,13 @@ int MPIR_Grequest_waitall(int count, MPID_Request * const * request_ptrs)
if (request_ptrs[i] == NULL || *request_ptrs[i]->cc_ptr == 0 || request_ptrs[i]->kind != MPID_UREQUEST)
continue;
if (n_greq == 0 || request_ptrs[i]->greq_class == curr_class)
if (n_greq == 0 || request_ptrs[i]->greq_fns->greq_class == curr_class)
{
/* if this is the first grequest of a group, or if it's the
same class as the last one, add its state to the list */
curr_class = request_ptrs[i]->greq_class;
wait_fn = request_ptrs[i]->wait_fn;
state_ptrs[n_greq] = request_ptrs[i]->grequest_extra_state;
curr_class = request_ptrs[i]->greq_fns->greq_class;
wait_fn = request_ptrs[i]->greq_fns->wait_fn;
state_ptrs[n_greq] = request_ptrs[i]->greq_fns->grequest_extra_state;
++n_greq;
}
else
......@@ -642,9 +642,9 @@ int MPIR_Grequest_waitall(int count, MPID_Request * const * request_ptrs)
mpi_error = (wait_fn)(n_greq, state_ptrs, 0, NULL);
if (mpi_error) MPIU_ERR_POP(mpi_error);
curr_class = request_ptrs[i]->greq_class;
wait_fn = request_ptrs[i]->wait_fn;
state_ptrs[0] = request_ptrs[i]->grequest_extra_state;
curr_class = request_ptrs[i]->greq_fns->greq_class;
wait_fn = request_ptrs[i]->greq_fns->wait_fn;
state_ptrs[0] = request_ptrs[i]->greq_fns->grequest_extra_state;
n_greq = 1;
}
}
......@@ -663,12 +663,12 @@ int MPIR_Grequest_waitall(int count, MPID_Request * const * request_ptrs)
if (request_ptrs[i] == NULL ||
MPID_Request_is_complete(request_ptrs[i]) ||
request_ptrs[i]->kind != MPID_UREQUEST ||
request_ptrs[i]->wait_fn == NULL)
request_ptrs[i]->greq_fns->wait_fn == NULL)
{
continue;
}
mpi_error = (request_ptrs[i]->wait_fn)(1, &request_ptrs[i]->grequest_extra_state, 0, NULL);
mpi_error = (request_ptrs[i]->greq_fns->wait_fn)(1, &request_ptrs[i]->greq_fns->grequest_extra_state, 0, NULL);
if (mpi_error) MPIU_ERR_POP(mpi_error);
MPIU_Assert(MPID_Request_is_complete(request_ptrs[i]));
}
......
......@@ -50,12 +50,14 @@ int MPIR_Test_impl(MPI_Request *request, int *flag, MPI_Status *status)
mpi_errno = MPID_Progress_test();
if (mpi_errno != MPI_SUCCESS) goto fn_fail;
if (request_ptr->kind == MPID_UREQUEST && request_ptr->poll_fn != NULL) {
mpi_errno = (request_ptr->poll_fn)(request_ptr->grequest_extra_state,
status);
if (mpi_errno != MPI_SUCCESS) goto fn_fail;
if (request_ptr->kind == MPID_UREQUEST &&
request_ptr->greq_fns != NULL &&
request_ptr->greq_fns->poll_fn != NULL)
{
mpi_errno = (request_ptr->greq_fns->poll_fn)(request_ptr->greq_fns->grequest_extra_state, status);
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
}
if (MPID_Request_is_complete(request_ptr)) {
mpi_errno = MPIR_Request_complete(request, request_ptr, status,
&active_flag);
......
......@@ -162,11 +162,11 @@ int MPI_Testall(int count, MPI_Request array_of_requests[], int *flag,
for (i = 0; i < count; i++)
{
if (request_ptrs[i] != NULL &&
request_ptrs[i]->kind == MPID_UREQUEST &&
request_ptrs[i]->poll_fn != NULL)
request_ptrs[i]->kind == MPID_UREQUEST &&
request_ptrs[i]->greq_fns->poll_fn != NULL)
{
mpi_errno = (request_ptrs[i]->poll_fn)(request_ptrs[i]->grequest_extra_state,
&(array_of_statuses[i]));
mpi_errno = (request_ptrs[i]->greq_fns->poll_fn)(request_ptrs[i]->greq_fns->grequest_extra_state,
&(array_of_statuses[i]));
if (mpi_errno != MPI_SUCCESS) goto fn_fail;
}
if (request_ptrs[i] != NULL && MPID_Request_is_complete(request_ptrs[i]))
......
......@@ -163,11 +163,11 @@ int MPI_Testany(int count, MPI_Request array_of_requests[], int *index,
for (i = 0; i < count; i++)
{
if (request_ptrs[i] != NULL &&
request_ptrs[i]->kind == MPID_UREQUEST &&
request_ptrs[i]->poll_fn != NULL)
request_ptrs[i]->kind == MPID_UREQUEST &&
request_ptrs[i]->greq_fns->poll_fn != NULL)
{
mpi_errno = (request_ptrs[i]->poll_fn)(request_ptrs[i]->grequest_extra_state,
status);
mpi_errno = (request_ptrs[i]->greq_fns->poll_fn)(request_ptrs[i]->greq_fns->grequest_extra_state,
status);
if (mpi_errno != MPI_SUCCESS) goto fn_fail;
}
if (request_ptrs[i] != NULL && MPID_Request_is_complete(request_ptrs[i]))
......
......@@ -164,11 +164,11 @@ int MPI_Testsome(int incount, MPI_Request array_of_requests[], int *outcount,
for (i = 0; i < incount; i++)
{
if (request_ptrs[i] != NULL &&
request_ptrs[i]->kind == MPID_UREQUEST &&
request_ptrs[i]->poll_fn != NULL)
request_ptrs[i]->kind == MPID_UREQUEST &&
request_ptrs[i]->greq_fns->poll_fn != NULL)
{
mpi_errno = (request_ptrs[i]->poll_fn)(request_ptrs[i]->grequest_extra_state,
array_of_statuses);
mpi_errno = (request_ptrs[i]->greq_fns->poll_fn)(request_ptrs[i]->greq_fns->grequest_extra_state,
array_of_statuses);
if (mpi_errno != MPI_SUCCESS) goto fn_fail;
}
if (request_ptrs[i] != NULL && MPID_Request_is_complete(request_ptrs[i]))
......
......@@ -50,7 +50,7 @@ int MPIR_Wait_impl(MPI_Request *request, MPI_Status *status)
{
mpi_errno = MPIR_Grequest_progress_poke(1, &request_ptr, status);
if (request_ptr->kind == MPID_UREQUEST &&
request_ptr->wait_fn != NULL)
request_ptr->greq_fns->wait_fn != NULL)
{
if (mpi_errno) {
/* --BEGIN ERROR HANDLING-- */
......
......@@ -158,10 +158,10 @@ int MPI_Waitany(int count, MPI_Request array_of_requests[], int *index,
/* we found at least one non-null request */
found_nonnull_req = TRUE;
if (request_ptrs[i]->kind == MPID_UREQUEST && request_ptrs[i]->poll_fn != NULL)
if (request_ptrs[i]->kind == MPID_UREQUEST && request_ptrs[i]->greq_fns->poll_fn != NULL)
{
/* this is a generalized request; make progress on it */
mpi_errno = (request_ptrs[i]->poll_fn)(request_ptrs[i]->grequest_extra_state, status);
mpi_errno = (request_ptrs[i]->greq_fns->poll_fn)(request_ptrs[i]->greq_fns->grequest_extra_state, status);
if (mpi_errno != MPI_SUCCESS) goto fn_progress_end_fail;
}
if (MPID_Request_is_complete(request_ptrs[i]))
......
......@@ -319,6 +319,7 @@ extern MPIDI_Process_t MPIDI_Process;
MPIU_Object_set_ref((sreq_), 2); \
(sreq_)->kind = MPID_REQUEST_SEND; \
(sreq_)->comm = comm; \
(sreq_)->greq_fns = NULL; \
MPID_cc_set(&(sreq_)->cc, 1); \
(sreq_)->cc_ptr = &(sreq_)->cc; \
(sreq_)->partner_request = NULL; \
......@@ -357,6 +358,7 @@ extern MPIDI_Process_t MPIDI_Process;
MPIU_Object_set_ref((rreq_), 2); \
(rreq_)->kind = MPID_REQUEST_RECV; \
(rreq_)->comm = NULL; \
(rreq_)->greq_fns = NULL; \
MPID_cc_set(&(rreq_)->cc, 1); \
(rreq_)->cc_ptr = &(rreq_)->cc; \
(rreq_)->status.MPI_ERROR = MPI_SUCCESS; \
......
......@@ -72,6 +72,7 @@ MPID_Request * MPID_Request_create(void)
req->status.count = 0;
req->status.cancelled = FALSE;
req->comm = NULL;
req->greq_fns = NULL;
req->dev.datatype_ptr = NULL;
req->dev.segment_ptr = NULL;
/* Masks and flags for channel device state in an MPID_Request */
......@@ -145,6 +146,10 @@ void MPIDI_CH3_Request_destroy(MPID_Request * req)
MPIR_Comm_release(req->comm, 0);
}
if (req->greq_fns != NULL) {
MPIU_Free(req->greq_fns);
}
if (req->dev.datatype_ptr != NULL) {
MPID_Datatype_release(req->dev.datatype_ptr);
}
......
......@@ -48,6 +48,7 @@ MPID_Request * MPID_Request_create()
req->status.count = 0;
req->status.cancelled = FALSE;
req->comm = NULL;
req->greq_fns = NULL;
struct MPIDI_DCMF_Request* dcmf = &req->dcmf;
if (DCQuad_sizeof(MPIDI_DCMF_MsgInfo) == 1)
......@@ -80,6 +81,7 @@ static inline void MPIDI_Request_try_free(MPID_Request *req)
if ( (req->ref_count == 0) && (MPID_Request_get_cc(req) == 0) )
{
if (req->comm) MPIR_Comm_release(req->comm, 0);
if (req->greq_fns != NULL) MPIU_Free(req->greq_fns);
if (req->dcmf.datatype_ptr) MPID_Datatype_release(req->dcmf.datatype_ptr);
MPIU_Handle_obj_free(&MPID_Request_mem, req);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment