algorithms: expose Proj parameter in hpx::min/max/minmax_element CPOs#7230
Open
aneek22112007-tech wants to merge 1 commit intoTheHPXProject:masterfrom
Open
algorithms: expose Proj parameter in hpx::min/max/minmax_element CPOs#7230aneek22112007-tech wants to merge 1 commit intoTheHPXProject:masterfrom
aneek22112007-tech wants to merge 1 commit intoTheHPXProject:masterfrom
Conversation
Collaborator
|
Can one of the admins verify this patch? |
ef665ad to
264e948
Compare
Up to standards ✅🟢 Issues
|
264e948 to
426ac05
Compare
hkaiser
reviewed
Apr 28, 2026
hkaiser
reviewed
Apr 28, 2026
This commit adds projection tests for the std::ranges::minmax_element equivalent in HPX (hpx::ranges::minmax_element) to ensure it correctly handles projections in both sequential and parallel contexts. It also moves the existing minmax_element_parallel_projection.cpp test to the container_algorithms directory where it belongs.
426ac05 to
f1e0dd0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This PR exposes the
Proj(projection) parameter in the public Customization Point Objects (CPOs) forhpx::min_element,hpx::max_element, andhpx::minmax_element.Previously, while the internal
detaillayer supported projections, the public parallel CPO overloads hardcodedhpx::identity_v. This change brings these algorithms into alignment with thestd::rangesdesign and ensures consistency with the existinghpx::rangescontainer algorithms.Technical Details
CPO Updates
tag_fallback_invokeoverloads for each algorithm inlibs/core/algorithms/include/hpx/parallel/algorithms/minmax.hpp.Projtemplate parameter (defaulting tohpx::identity) to support the standard projection API across all execution policies (includingseq,par, andasyncvariations).hpx::parallel::traits::is_projected_vandhpx::parallel::traits::is_indirect_callable_vconstraints to ensure strict type checking and improved error diagnostics at the CPO boundary.Type Deduction Fix
element_typededuction withinsequential_minmax_element_ind.std::iter_value_t<FwdIter>&was insufficient for the parallel reduction phase, whereFwdIterrefers to an iterator over partition results rather than the base elements.decltype(HPX_INVOKE(proj, *it))pattern to correctly resolve the proxy value type when merging partition results.Testing
min_element_proj.cpp,max_element_proj.cpp, andminmax_element_proj.cpp.seq(task)async policies.min_element,max_element, andminmax_elementunit tests pass.Checklist