Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UCP/PROTO: Consider RNDV_PERF_DIFF #10292

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/ucp/proto/proto_perf.c
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,27 @@ ucs_status_t ucp_proto_perf_aggregate2(const char *name,
return ucp_proto_perf_aggregate(name, perf_elems, 2, perf_p);
}

void ucp_proto_perf_apply_bias(ucp_proto_perf_t *perf, double bias) {
ucs_linear_func_t bias_func = ucs_linear_func_make(0.0, 1.0 - bias);
ucp_proto_perf_node_t *bias_node;
ucp_proto_perf_factor_id_t fid;
ucp_proto_perf_segment_t *seg;

if (bias == 0) {
return;
}

ucp_proto_perf_segment_foreach(seg, perf) {
for (fid = 0; fid < UCP_PROTO_PERF_FACTOR_LAST; ++fid) {
seg->perf_factors[fid] = ucs_linear_func_compose(
bias_func, seg->perf_factors[fid]);
ucp_proto_perf_node_update_factors(seg->node, seg->perf_factors);
}
bias_node = ucp_proto_perf_node_new_data("bias", "%.2f %%", bias);
ucp_proto_perf_node_own_child(seg->node, &bias_node);
}
}

/* TODO:
* Reconsider correctness of PPLN perf estimation logic since in case of async
* operations it seems wrong to choose the longest factor without paying
Expand Down
10 changes: 10 additions & 0 deletions src/ucp/proto/proto_perf.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,16 @@ ucs_status_t ucp_proto_perf_aggregate2(const char *name,
ucp_proto_perf_t **perf_p);


/**
* Apply a bias change to the given perf structure.
*
* @param [in] perf Performance data structure to update.
* @param [in] bias Bias to apply. A bias equal to 0.1 indicates a 10%
* performance improvement.
*/
void ucp_proto_perf_apply_bias(ucp_proto_perf_t *perf, double bias);


/**
* Expand given perf by estimation that all messages on interval
* [end of @a frag_seg + 1, @a max_length] would be sent in a pipeline async
Expand Down
2 changes: 2 additions & 0 deletions src/ucp/rndv/proto_rndv.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,8 @@ static void ucp_proto_rndv_ctrl_variant_probe(
ucs_max(cfg_thresh, remote_proto->cfg_thresh);
}

ucp_proto_perf_apply_bias(perf, params->perf_bias);

/* Remote variants priorities are used to respect RNDV_SCHEME setting
* so they should contain value greater than CTRL message `cfg_thresh`.
* Equality is allowed for RTR remote variants.
Expand Down
38 changes: 38 additions & 0 deletions test/gtest/ucp/test_ucp_proto.cc
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,44 @@ UCS_TEST_F(test_proto_perf, intersect_first)
expect_empty_range(5000, SIZE_MAX);
}

UCS_TEST_F(test_proto_perf, apply_zero_bias) {
m_perf = create();
add_func(0, SIZE_MAX, UCP_PROTO_PERF_FACTOR_LOCAL_TL, local_tl_func);
add_func(0, SIZE_MAX, UCP_PROTO_PERF_FACTOR_REMOTE_TL, remote_tl_func);

/* Apply zero bias */
ucp_proto_perf_apply_bias(m_perf.get(), 0);

make_flat_perf();
print_perf();

expect_perf(0, SIZE_MAX,
{{UCP_PROTO_PERF_FACTOR_LOCAL_TL, local_tl_func},
{UCP_PROTO_PERF_FACTOR_REMOTE_TL, remote_tl_func}});
}

UCS_TEST_F(test_proto_perf, apply_bias) {
m_perf = create();
add_func(0, SIZE_MAX, UCP_PROTO_PERF_FACTOR_LOCAL_TL, local_tl_func);
add_func(0, SIZE_MAX, UCP_PROTO_PERF_FACTOR_REMOTE_TL, remote_tl_func);

/* Apply 10% bias */
double bias = 0.1;
ucp_proto_perf_apply_bias(m_perf.get(), bias);

make_flat_perf();
print_perf();

/* Calculate expected */
auto bias_func = ucs_linear_func_make(0, 1 - bias);
auto exp_local_tl_func = ucs_linear_func_compose(bias_func, local_tl_func);
auto exp_remote_tl_func = ucs_linear_func_compose(bias_func, remote_tl_func);

expect_perf(0, SIZE_MAX,
{{UCP_PROTO_PERF_FACTOR_LOCAL_TL, exp_local_tl_func},
{UCP_PROTO_PERF_FACTOR_REMOTE_TL, exp_remote_tl_func}});
}

UCS_TEST_F(test_proto_perf, intersect_last)
{
/*
Expand Down
Loading