This repository has been archived by the owner on Mar 21, 2024. It is now read-only.
Add __forceinline__ to thrust::detail::wrapped_function::operator() #1647
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request adds forced inlining to
thrust::detail::wrapped_function::operator()
. This makes sure that when a function with the__forceinline__
attribute is wrapped (e.g. when it is passed tothrust::for_each
), it is actually inlined into the caller (e.g.thrust::for_each
) and not just inlined into the wrapper, which may or may not have been inlined into the caller automatically.When a function that does not have the
__forceinline__
attribute is wrapped, this pull request only has a minor effect. Previously the compiler could decide to inline the wrapper into the caller or the function into the wrapper (it would always do one or the other because the wrapper is so simple). Now it can only decide to inline the function into the wrapper or not as the wrapper is always inlined into the caller.