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

#962 Msg API - switch to implicit conversion #969

Merged
merged 11 commits into from
Sep 8, 2020
Merged

Conversation

pnstickne
Copy link
Contributor

@pnstickne pnstickne commented Aug 4, 2020

Changes theMsg()'s sendMsg and broadcastMsg to perform an implicit std::move on the MsgPtr& argument.

Change all core usages to supply a MsgPtr& (and all but two usage in tests).

This change can make some code that worked before fail is the implicit move-like semantics are not honored.

Notes:

This currently uses an implicit proxy to unify both MsgPtr& and Msg*. However, this type can be eliminated if dropping Msg* directly and always accepting MsgPtr&.

Over all the current code in VT, the pattern of creating a message is "the method" so there is no need to accept a MsgPtr or MsgPtr&&.

The implicit type is still very hand for transitioning over.

@pnstickne pnstickne force-pushed the 962-msg-api-redux branch 2 times, most recently from 65eed88 to 461065a Compare August 4, 2020 08:00
@codecov
Copy link

codecov bot commented Aug 4, 2020

Codecov Report

Merging #969 into develop will decrease coverage by 0.15%.
The diff coverage is 82.74%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #969      +/-   ##
===========================================
- Coverage    77.56%   77.40%   -0.16%     
===========================================
  Files          667      665       -2     
  Lines        25614    25522      -92     
===========================================
- Hits         19868    19756     -112     
- Misses        5746     5766      +20     
Impacted Files Coverage Δ
examples/rdma/rdma_simple_put.cc 13.11% <0.00%> (ø)
examples/rdma/rdma_simple_put_direct.cc 19.04% <0.00%> (ø)
...c/vt/collective/reduce/operators/default_op.impl.h 100.00% <ø> (ø)
src/vt/event/event.cc 60.56% <0.00%> (+1.25%) ⬆️
src/vt/group/group_info.impl.h 37.70% <0.00%> (ø)
src/vt/parameterization/parameterization.h 100.00% <ø> (ø)
...allback/proxy_bcast/callback_proxy_bcast_tl.impl.h 56.00% <0.00%> (-2.34%) ⬇️
src/vt/trace/trace_user_event.cc 44.26% <0.00%> (ø)
src/vt/vrt/collection/balance/node_stats.cc 46.62% <0.00%> (-0.27%) ⬇️
src/vt/vrt/collection/manager.cc 68.29% <0.00%> (ø)
... and 93 more

@PhilMiller
Copy link
Member

Looks good so far. Looking forward to seeing all of the msg.get() in caller code disappear

@pnstickne pnstickne force-pushed the 962-msg-api-redux branch 4 times, most recently from b37a297 to 7b623c9 Compare August 14, 2020 08:05
@pnstickne
Copy link
Contributor Author

@lifflander "Works Here", ahah ^_^

* \brief Helper to unify 'stealing' message ownership.
*
* This type is not intented to be used directly. It uses implicit conversion
* construtors to perform a 'std::move' on a \c MsgPtr<MsgT>&.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo 'constructors'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... It still reads 'construtors' (missing 'c'). Neglected push?

Comment on lines +159 to +170
auto msg_hold = promoteMsg(msg.get());
theMsg()->broadcastMsg<MsgType,CollectionManager::releaseLBPhase>(msg);

CollectionManager::releaseLBPhase(msg_hold.get());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This repeated pattern of get, promote, broadcast, and deliver further favors making broadcast include local delivery.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PhilMiller broadcastMsgIncludingSelf? A mouthful..

@PhilMiller
Copy link
Member

This is good progress. I like that this makes promoteMsg an indicator that something weird is being done, and that the surrounding code needs more care and attention on it. Ideally, we'd be able to reduce the number of call sites accordingly, now that we can see them clearly.

@pnstickne pnstickne marked this pull request as ready for review August 18, 2020 18:17
Copy link
Member

@PhilMiller PhilMiller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm generally pretty happy with this.

@pnstickne pnstickne force-pushed the 962-msg-api-redux branch 3 times, most recently from 25f5f03 to 72a7735 Compare August 23, 2020 23:32
@pnstickne
Copy link
Contributor Author

The failing test is addressed in #990. After #990 is merged the MsgPtrThief tests here should be updated to be no-MPI.

@bradybray
Copy link

Looks good save for the one failed build.

pnstickne and others added 11 commits September 8, 2020 11:18
- This allows the same callsite to, eg., bind to either
  a Msg<T>* or a MsgPtr<T>& without requiring duplicated methods.

  However, it also requires that the templated forms accepting
  a 'FunctorT' as the first parameter specify the message type
  as such can no longer be inferred.
- Despite very few usages, it's also quite confusing auto-null a ptr.
  It also does not work towards elimination of using T* directly.

  The usages of T* are restricted to being const, which should effectively
  only be 'msg.get()' cases.
- Now issues a vtAssert in some cases.

  In particular, get() will never return null as this much more eagerly
  exposes when a MsgPtr& has been [unexpectedly] moved by the API.
- Examples / tutorials / tests.
- The new name should (hopefully) much more clearly represent
  what is occuring and/or should be expected.

  This doesn't steal a Msg*, only a MsgPtr.

  This is designed to be used to transitional API which still
  accepts a Msg* which can be targeted as [deprecated].

- Tests cover expected thieving ability.
- The msg thief tests cover the expected lifetimes of all
  allowed usages - MsgT, MgsPtr<MsgT>&, MsgPtr<MsgT>&&.
- All (immediate) test directories are added in CMake instead of
  being manually specified. This reduces the chance of misplacing
  and expected resource.. such as 'context'.

- REMOVED the non-compiled / not-executed context tests.

  These tests are woefully out of date and fail to compile
  for multiple reasons. See #999.
- Clarify ownership, provide std::move example.
Copy link
Collaborator

Codacy Here is an overview of what got changed by this pull request:

Clones removed
==============
+ tests/unit/memory/test_memory_lifetime.cc  -4
+ tutorial/tutorial_1g.h  -3
         

See the complete overview on Codacy

@lifflander lifflander merged commit 6a80f05 into develop Sep 8, 2020
@PhilMiller PhilMiller deleted the 962-msg-api-redux branch September 8, 2020 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants