Skip to content

Commit

Permalink
add an additional field (packet) to LCII_context_t
Browse files Browse the repository at this point in the history
  • Loading branch information
JiakunYan committed Dec 20, 2023
1 parent f055a12 commit aa8f5f4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lci/experimental/coll/coll.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ static inline void LCIXC_mcoll_complete(LCI_endpoint_t ep, LCI_mbuffer_t buffer,
LCII_comp_attr_set_comp_type(ctx->comp_attr, ep->msg_comp_type);
ctx->data_type = LCI_MEDIUM;
ctx->user_context = user_context;
ctx->data = (LCI_data_t){.mbuffer = buffer};
ctx->data.mbuffer = buffer;
ctx->rank = -1; /* this doesn't make much sense for collectives */
ctx->tag = tag;
ctx->completion = completion;
Expand All @@ -160,7 +160,7 @@ static inline void LCIXC_lcoll_complete(LCI_endpoint_t ep, LCI_lbuffer_t buffer,
LCII_comp_attr_set_comp_type(ctx->comp_attr, ep->msg_comp_type);
ctx->data_type = LCI_LONG;
ctx->user_context = user_context;
ctx->data = (LCI_data_t){.lbuffer = buffer};
ctx->data.lbuffer = buffer;
ctx->rank = -1; /* this doesn't make much sense for collectives */
ctx->tag = tag;
ctx->completion = completion;
Expand Down
3 changes: 1 addition & 2 deletions lci/runtime/completion/sync_flag.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,8 @@ LCI_error_t LCI_sync_signal(LCI_comp_t completion, LCI_request_t request)
ctx->rank = request.rank;
ctx->tag = request.tag;
ctx->data_type = request.type;
ctx->data = request.data;
memcpy(&ctx->data, &request.data, sizeof(ctx->data));
ctx->user_context = request.user_context;

LCII_sync_signal(completion, ctx);
return LCI_OK;
}
Expand Down
15 changes: 13 additions & 2 deletions lci/runtime/lcii.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,15 @@ typedef struct __attribute__((aligned(LCI_CACHE_LINE))) {
// LCI_request_t fields, 52 bytes
LCI_data_type_t data_type; // 4 bytes
void* user_context; // 8 bytes
LCI_data_t data; // 32 bytes
union {
LCI_short_t immediate; // 32 bytes
struct { // 24 bytes
LCI_mbuffer_t mbuffer;
LCII_packet_t *packet;
};
LCI_lbuffer_t lbuffer; // 24 bytes
LCI_iovec_t iovec; // 28 bytes
} data; // 32 bytes
uint32_t rank; // 4 bytes
LCI_tag_t tag; // 4 bytes
// used by LCI internally
Expand Down Expand Up @@ -200,8 +208,11 @@ static inline LCI_request_t LCII_ctx2req(LCII_context_t* ctx)
.rank = ctx->rank,
.tag = ctx->tag,
.type = ctx->data_type,
.data = ctx->data,
.user_context = ctx->user_context};
LCI_DBG_Assert(sizeof(request.data) == sizeof(ctx->data), "Unexpected size!\n");
memcpy(&request.data, &ctx->data, sizeof(request.data));
LCI_DBG_Assert(request.data.mbuffer.address == ctx->data.mbuffer.address, "Invalid conversion!");
LCI_DBG_Assert(request.data.mbuffer.length == ctx->data.mbuffer.length, "Invalid conversion!");
LCIU_free(ctx);
return request;
}
Expand Down

0 comments on commit aa8f5f4

Please sign in to comment.