Skip to content

Commit

Permalink
Merge pull request #1474 from alex-mikheev/topic/ucp_tm_offload_prep
Browse files Browse the repository at this point in the history
UCP: preparations for the tag matching offload
  • Loading branch information
yosefe authored May 23, 2017
2 parents d851d49 + 4f63ef6 commit 3e160da
Show file tree
Hide file tree
Showing 24 changed files with 488 additions and 210 deletions.
27 changes: 27 additions & 0 deletions src/ucp/core/ucp_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include "ucp_context.h"
#include "ucp_request.h"
#include <ucp/proto/proto.h>

#include <ucs/config/parser.h>
#include <ucs/algorithm/crc.h>
Expand Down Expand Up @@ -125,6 +126,11 @@ static ucs_config_field_t ucp_config_table[] = {
"y - Use mutex for multithreading support in UCP.\n",
ucs_offsetof(ucp_config_t, ctx.use_mt_mutex), UCS_CONFIG_TYPE_BOOL},

{"TM_THRESH", "1024",
"Threshold for using tag matching offload capabilities.\n"
"Smaller buffers will not be posted to the transport.",
ucs_offsetof(ucp_config_t, ctx.tm_thresh), UCS_CONFIG_TYPE_MEMUNITS},

{NULL}
};

Expand Down Expand Up @@ -705,6 +711,12 @@ static ucs_status_t ucp_fill_config(ucp_context_h context,
: UCP_MT_TYPE_SPINLOCK);
context->config.ext = config->ctx;

/* Post threshold for tag offload should not be less than ucp_request_hdr_t
* size, because this header may be scattered to user buffer in case of
* expected SW RNDV protocol. */
context->tm.post_thresh = ucs_max(context->config.ext.tm_thresh,
sizeof(ucp_request_hdr_t));

/* always init MT lock in context even though it is disabled by user,
* because we need to use context lock to protect ucp_mm_ and ucp_rkey_
* routines */
Expand Down Expand Up @@ -917,3 +929,18 @@ void ucp_context_print_info(ucp_context_h context, FILE *stream)

fprintf(stream, "#\n");
}


void ucp_context_tag_offload_enable(ucp_context_h context)
{
if (ucs_queue_length(&context->tm.offload_ifaces) == 1) {
/* Enable offload, because just one tag offload capable interface is present */
context->tm.post_thresh = ucs_max(context->config.ext.tm_thresh,
sizeof(ucp_request_hdr_t));
} else {
/* Some offload interface/s already configured. Disable TM receive offload,
* because multiple offload ifaces are not supported yet. */
context->tm.post_thresh = SIZE_MAX;
}
}

7 changes: 6 additions & 1 deletion src/ucp/core/ucp_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ typedef struct ucp_context_config {
size_t zcopy_thresh;
/** Estimation of bcopy bandwidth */
size_t bcopy_bw;
/** Threshold for using tag matching offload capabilities. Smaller buffers
* will not be posted to the transport. */
size_t tm_thresh;
/** Maximal size of worker name for debugging */
unsigned max_worker_name;
/** Atomic mode */
Expand Down Expand Up @@ -97,7 +100,7 @@ typedef struct ucp_context {
ucp_tl_resource_desc_t *tl_rscs; /* Array of communication resources */
ucp_rsc_index_t num_tls; /* Number of resources in the array*/

ucp_tag_match_t tm; /* Tag-matching queues */
ucp_tag_match_t tm; /* Tag-matching queues and offload info */

struct {

Expand Down Expand Up @@ -161,6 +164,8 @@ extern ucp_am_handler_t ucp_am_handlers[];
void ucp_dump_payload(ucp_context_h context, char *buffer, size_t max,
const void *data, size_t length);

void ucp_context_tag_offload_enable(ucp_context_h context);

uint64_t ucp_context_uct_atomic_iface_flags(ucp_context_h context);

const char * ucp_find_tl_name_by_csum(ucp_context_t *context, uint16_t tl_name_csum);
Expand Down
Loading

0 comments on commit 3e160da

Please sign in to comment.