Repository navigation
UCP/RMA: Apply ep_based weak fence once per worker fence #12029
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
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -169,13 +169,27 @@ ucp_ep_rma_handle_fence(ucp_ep_h ep, ucp_request_t *req, | |||||||
| /* Apply a fence if EP's sequence is behind worker's */ | ||||||||
| if (ucs_unlikely(req->flags & UCP_REQUEST_FLAG_FENCE_REQUIRED)) { | ||||||||
| if (ucs_unlikely(ep->ext->unflushed_lanes == 0)) { | ||||||||
| status = UCS_OK; | ||||||||
| /* No earlier operation to order */ | ||||||||
| ep->ext->fence_seq = ep->worker->fence_seq; | ||||||||
| ep->ext->fenced_lanes = 0; | ||||||||
| status = UCS_OK; | ||||||||
| } else if (ucs_likely( | ||||||||
| ucs_is_pow2_or_zero(ep->ext->unflushed_lanes | lane_map))) { | ||||||||
| status = ucp_ep_fence_weak(ep); | ||||||||
| if (status == UCS_OK) { | ||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the weak fence branch: why set
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed, but I would keep this out of this PR. The weak branch makes the same assumption that |
||||||||
| /* The fence orders all earlier operations on this single | ||||||||
| * lane, so later operations on it need no further fence */ | ||||||||
| ep->ext->fence_seq = ep->worker->fence_seq; | ||||||||
| ep->ext->fenced_lanes = ep->ext->unflushed_lanes; | ||||||||
| } | ||||||||
| } else { | ||||||||
| status = ucp_ep_fence_strong(ep); | ||||||||
| } | ||||||||
| } else if (ucs_unlikely(lane_map & ~ep->ext->fenced_lanes) && | ||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. pls test
Suggested change
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done in ca6fc76. The NULL check now comes first, inside the new |
||||||||
| (ep->ext->fenced_lanes != 0)) { | ||||||||
| /* A weak fence does not order earlier operations on the fenced lane | ||||||||
| * with operations on another lane */ | ||||||||
| status = ucp_ep_fence_strong(ep); | ||||||||
| } else { | ||||||||
| status = UCS_OK; | ||||||||
| } | ||||||||
|
|
||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -173,7 +173,9 @@ ucp_put_send_short(ucp_ep_h ep, const void *buffer, size_t length, | |
|
|
||
| tl_rkey = ucp_rkey_get_tl_rkey(rkey, rkey_config->put_short.rkey_index); | ||
|
|
||
| if (ucs_unlikely(ucp_ep_rma_is_fence_required(ep))) { | ||
| if (ucs_unlikely(ucp_ep_rma_is_fence_required(ep) || | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. minor: can we hide this in an inline helper in
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done in ca6fc76. Added |
||
| (ep->ext->fenced_lanes & | ||
| ~UCS_BIT(rkey_config->put_short.lane)))) { | ||
| /* TODO: check support for fence in fast path short */ | ||
| return UCS_ERR_NO_RESOURCE; | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -955,6 +955,25 @@ class test_ucp_ep_based_fence : public test_ucp_rma { | |
| * iterations. | ||
| */ | ||
| sender().ep()->ext->unflushed_lanes = 0; | ||
| sender().ep()->ext->fenced_lanes = 0; | ||
| } | ||
|
|
||
| void do_rma_op_with_fence_applied_once(op_type_t op, void *sbuf, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the second
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done in ca6fc76.
|
||
| size_t size, void *target, | ||
| ucp_rkey_h rkey) | ||
| { | ||
| do_rma_op_with_fence(op, sbuf, size, target, rkey); | ||
| flush_worker(sender()); | ||
|
|
||
| /* Applying the fence satisfies it, so later operations on the | ||
| * endpoint must not apply it again */ | ||
| EXPECT_EQ(worker_fence_seq(), ep_fence_seq()); | ||
|
|
||
| do_rma_op(op, sbuf, size, target, rkey); | ||
| flush_worker(sender()); | ||
| EXPECT_EQ(worker_fence_seq(), ep_fence_seq()); | ||
|
|
||
| flush_sender_cleanup(); | ||
| } | ||
|
|
||
| void do_rma_op_with_fence_before(op_type_t op, void *sbuf, size_t size, | ||
|
|
@@ -999,6 +1018,27 @@ UCS_TEST_P(test_ucp_ep_based_fence, test_ep_based_fence_before_atomic) { | |
| OP_ATOMIC, &test_ucp_ep_based_fence::do_rma_op_with_fence_before); | ||
| } | ||
|
|
||
| UCS_TEST_P(test_ucp_ep_based_fence, test_ep_based_fence_applied_once_put) | ||
| { | ||
| test_ep_based_fence_common( | ||
| OP_PUT, | ||
| &test_ucp_ep_based_fence::do_rma_op_with_fence_applied_once); | ||
| } | ||
|
|
||
| UCS_TEST_P(test_ucp_ep_based_fence, test_ep_based_fence_applied_once_get) | ||
| { | ||
| test_ep_based_fence_common( | ||
| OP_GET, | ||
| &test_ucp_ep_based_fence::do_rma_op_with_fence_applied_once); | ||
| } | ||
|
|
||
| UCS_TEST_P(test_ucp_ep_based_fence, test_ep_based_fence_applied_once_atomic) | ||
| { | ||
| test_ep_based_fence_common( | ||
| OP_ATOMIC, | ||
| &test_ucp_ep_based_fence::do_rma_op_with_fence_applied_once); | ||
| } | ||
|
|
||
| UCP_INSTANTIATE_TEST_CASE_TLS(test_ucp_ep_based_fence, all, "all") | ||
|
|
||
| class test_ucp_rma_sgl : public test_ucp_rma { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the
unflushed_lanes == 0branch:fenced_lanesis always a subset ofunflushed_lanes, so this store is redundant. maybe replace it with an assert to document the invariant thatucp_ep_fence_strong()and the new branch rely on?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in ca6fc76. The store is replaced with
ucs_assert(ep->ext->fenced_lane == UCP_NULL_LANE).