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

Restore some type-erasure to transform_mpi to avoid debug bloat #1390

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

msimberg
Copy link
Contributor

#1346 simplified transform_mpi, but at the same time it removed almost all type-erasure of senders. This increased the debug symbol sizes caused by transform_mpi quite significantly. This PR proposes to restore some of the type-erasure, which further simplifies the implementation a bit and reduces debug bloat.

For reference, here are the binary sizes of the transform_mpi test (with build type Debug) at different points in history starting from just before #1321:

I've included a few selected commits above that also affect the binary size. #1321 is a bugfix, so the big increase from that PR we can't directly fix/revert. A few other PRs also increase the binary size, but not as much as #1346, so I'm targeting that first. With the changes in this PR we get back to the same size we had after #1321.

@msimberg msimberg self-assigned this Jan 23, 2025
Copy link

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
-0.12% (target: -1.00%) 100.00% (target: 90.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (1ab788b) 18223 13739 75.39%
Head commit (243c360) 18217 (-6) 13713 (-26) 75.28% (-0.12%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#1390) 10 10 100.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more

Comment on lines +67 to +73
auto f_completion = [f = std::forward<F>(f), mode, completions_inline, p](
auto&... args) mutable -> unique_any_sender<> {
unique_any_sender<> s = just(std::forward_as_tuple(args...)) | unpack() |
dispatch_mpi(std::move(f)) | trigger_mpi(mode);
if (completions_inline) { return s; }
else { return std::move(s) | continues_on(default_pool_scheduler(p)); }
};
Copy link
Contributor

Choose a reason for hiding this comment

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

The inline branch returns s as an any sender - the non inline returns an any sender of an any sender - do they get collapsed into one create, or can/should we just expand the other branch to just return one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In if (completions_inline) { return s; }, s is not going to get wrapped again and even a move construction should be avoided because of NRVO.

In the second branch there will indeed be two unique_any_senders. It's a tradeoff between debug bloat and wrapping. The first commit on this PR (aae6046) doesn't type-erase s; it only type-erases whatever is returned. That on its own already significantly reduces bloat, and then type-erasing s reduces bloat a bit more.

Copy link
Contributor

@aurianer aurianer left a comment

Choose a reason for hiding this comment

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

Looks good! Thanks a lot for the investigation! Have you checked if it solves the linking problem with DLA-F?

@msimberg
Copy link
Contributor Author

Looks good! Thanks a lot for the investigation! Have you checked if it solves the linking problem with DLA-F?

That is indeed the important question, and on top of main it doesn't, but on top of the #1295 merge it does. I think this will be a necessary, but not sufficient change. We've probably accumulated a bit of bloat here and there for this not to be sufficient on top of main. I'm continuing to test in DLA-Future with further changes (though I'm not planning to change this PR any more).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

3 participants