@@ -41,32 +41,20 @@ static constexpr ucp_tag_t STF_DONE_TAG = 1'000'000'000ULL;
4141namespace ucx ::io {
4242
4343struct dd_ucp_multi_req {
44+ alignas (128 )
4445 const std::uint64_t mSlotsCount = 1 ;
4546 std::atomic_uint64_t mSlotsUsed = 0 ;
4647 std::atomic_uint64_t mTotalDone = 0 ;
4748 std::atomic_bool mFinished = false ;
4849
49- std::mutex mRequestLock ;
50- boost::container::small_flat_set<void *, 128 > mRequests ;
51-
5250 dd_ucp_multi_req () = delete ;
5351 explicit dd_ucp_multi_req (const std::uint64_t pSlotsCount) : mSlotsCount(pSlotsCount) { }
5452 dd_ucp_multi_req (const dd_ucp_multi_req&) = delete ;
5553 dd_ucp_multi_req (dd_ucp_multi_req&&) = delete ;
5654
57- ~dd_ucp_multi_req () {
58- assert (mTotalDone .load () >= mRequests .size ());
59-
60- std::scoped_lock lLock (mRequestLock );
61- for (const auto req_ptr : mRequests ) {
62- if (req_ptr && UCS_PTR_IS_PTR (req_ptr)) {
63- ucp_request_free (req_ptr);
64- }
65- }
66- }
55+ ~dd_ucp_multi_req () { }
6756
68- inline
69- bool done () const {
57+ inline bool done () const {
7058 if (!mFinished ) {
7159 // let rma progress as long as there are free slots
7260 return (mSlotsUsed .load () < mSlotsCount );
@@ -76,34 +64,26 @@ struct dd_ucp_multi_req {
7664 }
7765 }
7866
79- inline
80- std::uint64_t total_done () const { return mTotalDone .load (); }
67+ inline std::uint64_t total_done () const { return mTotalDone .load (); }
8168
82- inline
83- bool add_request (void *req) {
69+ inline bool add_request (void *req) {
8470 if (UCS_PTR_IS_ERR (req)) {
8571 EDDLOG (" Failed run ucp_get_nbx ucx_err={}" , ucs_status_string (UCS_PTR_STATUS (req)));
8672 return false ;
8773 }
8874 // operation returned request
8975 if (req && UCS_PTR_IS_PTR (req)) {
90- std::scoped_lock lLock (mRequestLock );
91- mRequests .insert (req);
9276 mSlotsUsed += 1 ;
9377 }
9478 return true ;
9579 }
9680
97- inline
98- bool remove_request (void *req) {
81+ inline bool remove_request (void *req) {
9982 // operation returned request
10083 if (req && UCS_PTR_IS_PTR (req)) {
101- ucp_request_free (req);
102- std::scoped_lock lLock (mRequestLock );
103- mRequests .erase (req);
104-
105- mTotalDone += 1 ;
10684 mSlotsUsed -= 1 ;
85+ mTotalDone += 1 ;
86+ ucp_request_free (req);
10787 }
10888 return true ;
10989 }
0 commit comments