Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
77ccb96
Add type_id type
beojan Nov 17, 2025
37c92e3
Add type information to qualified_name
beojan Nov 18, 2025
e5de606
First prototype of type checking
beojan Nov 19, 2025
04e3063
Fix formatting
beojan Nov 19, 2025
2a0387a
Formatting
beojan Nov 19, 2025
e45677c
Improve test coverage for type_id
beojan Nov 19, 2025
99e9576
And again, formatting
beojan Nov 19, 2025
55df8ad
Move type_id formatter out of line and support fmt 9
beojan Nov 19, 2025
9f8cff6
Put formatting back in the type_id header
beojan Nov 19, 2025
bbb9bdc
Improve coverage
beojan Nov 20, 2025
2ff8a7c
Fix type_id format for list of struct
beojan Nov 20, 2025
9747bc4
Don't use fmt::to_string
beojan Nov 20, 2025
7e20360
Adjust error checking
beojan Nov 20, 2025
eb75718
Typo
beojan Nov 20, 2025
864e7c4
Make more code consteval
beojan Nov 20, 2025
a95c3fc
Add long double
beojan Nov 21, 2025
0e7baba
Rename qualified_name to product_specification
beojan Nov 21, 2025
4f6e64d
Rename specified_label to product_query
beojan Nov 21, 2025
4908c5a
set_types --> populate_types
beojan Nov 21, 2025
cea8f7f
Don't include products with mismatching types in candidate list
beojan Nov 21, 2025
a9f58c8
Make find_producer take a product_query instead of a specification
beojan Nov 24, 2025
9d2ff62
Run clang-format
beojan Nov 25, 2025
3ab01ec
Remove constexpr from formatter
beojan Nov 25, 2025
c8e6183
T_signed --> SignedT
beojan Nov 25, 2025
f1fff0e
Make populate_types a free function
beojan Nov 26, 2025
d235ed2
Simplify type_id creation
beojan Nov 26, 2025
81f4b92
Tweaks to fix / diagnose segfaults
beojan Dec 2, 2025
ebc9771
Add test for disambiguating duplicate names
beojan Dec 2, 2025
f5aa4aa
Add exact type check with warning if this fails
beojan Dec 2, 2025
434c826
Remove extraneous arguments
beojan Dec 2, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion phlex/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ add_library(
products_consumer.cpp
registrar.cpp
registration_api.cpp
specified_label.cpp
product_query.cpp
store_counters.cpp
)
target_include_directories(phlex_core PRIVATE ${PROJECT_SOURCE_DIR})
Expand Down
2 changes: 1 addition & 1 deletion phlex/core/declared_fold.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace phlex::experimental {
declared_fold::declared_fold(algorithm_name name,
std::vector<std::string> predicates,
specified_labels input_products) :
product_queries input_products) :
products_consumer{std::move(name), std::move(predicates), std::move(input_products)}
{
}
Expand Down
18 changes: 9 additions & 9 deletions phlex/core/declared_fold.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
#include "phlex/core/fwd.hpp"
#include "phlex/core/input_arguments.hpp"
#include "phlex/core/message.hpp"
#include "phlex/core/product_query.hpp"
#include "phlex/core/products_consumer.hpp"
#include "phlex/core/specified_label.hpp"
#include "phlex/core/store_counters.hpp"
#include "phlex/model/algorithm_name.hpp"
#include "phlex/model/handle.hpp"
#include "phlex/model/level_id.hpp"
#include "phlex/model/product_specification.hpp"
#include "phlex/model/product_store.hpp"
#include "phlex/model/qualified_name.hpp"
#include "phlex/utilities/simple_ptr_map.hpp"

#include "oneapi/tbb/concurrent_unordered_map.h"
Expand All @@ -37,12 +37,12 @@ namespace phlex::experimental {
public:
declared_fold(algorithm_name name,
std::vector<std::string> predicates,
specified_labels input_products);
product_queries input_products);
virtual ~declared_fold();

virtual tbb::flow::sender<message>& sender() = 0;
virtual tbb::flow::sender<message>& to_output() = 0;
virtual qualified_names const& output() const = 0;
virtual product_specifications const& output() const = 0;
virtual std::size_t product_count() const = 0;
};

Expand All @@ -68,12 +68,12 @@ namespace phlex::experimental {
tbb::flow::graph& g,
AlgorithmBits alg,
InitTuple initializer,
specified_labels product_labels,
product_queries product_labels,
std::vector<std::string> output,
std::string partition) :
declared_fold{std::move(name), std::move(predicates), std::move(product_labels)},
initializer_{std::move(initializer)},
output_{to_qualified_names(full_name(), std::move(output))},
output_{to_product_specifications(full_name(), std::move(output), make_type_ids<R>())},
partition_{std::move(partition)},
join_{make_join_or_none(g, std::make_index_sequence<N>{})},
fold_{g,
Expand Down Expand Up @@ -121,7 +121,7 @@ namespace phlex::experimental {
}

private:
tbb::flow::receiver<message>& port_for(specified_label const& product_label) override
tbb::flow::receiver<message>& port_for(product_query const& product_label) override
{
return receiver_for<N>(join_, input(), product_label);
}
Expand All @@ -130,7 +130,7 @@ namespace phlex::experimental {

tbb::flow::sender<message>& sender() override { return output_port<0ull>(fold_); }
tbb::flow::sender<message>& to_output() override { return sender(); }
qualified_names const& output() const override { return output_; }
product_specifications const& output() const override { return output_; }

template <std::size_t... Is>
void call(function_t const& ft, messages_t<N> const& messages, std::index_sequence<Is...>)
Expand Down Expand Up @@ -175,7 +175,7 @@ namespace phlex::experimental {

InitTuple initializer_;
input_retriever_types<input_parameter_types> input_{input_arguments<input_parameter_types>()};
qualified_names output_;
product_specifications output_;
std::string partition_;
join_or_none_t<N> join_;
tbb::flow::multifunction_node<messages_t<N>, messages_t<1>> fold_;
Expand Down
2 changes: 1 addition & 1 deletion phlex/core/declared_observer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace phlex::experimental {
declared_observer::declared_observer(algorithm_name name,
std::vector<std::string> predicates,
specified_labels input_products) :
product_queries input_products) :
products_consumer{std::move(name), std::move(predicates), std::move(input_products)}
{
}
Expand Down
10 changes: 5 additions & 5 deletions phlex/core/declared_observer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
#include "phlex/core/fwd.hpp"
#include "phlex/core/input_arguments.hpp"
#include "phlex/core/message.hpp"
#include "phlex/core/product_query.hpp"
#include "phlex/core/products_consumer.hpp"
#include "phlex/core/specified_label.hpp"
#include "phlex/core/store_counters.hpp"
#include "phlex/metaprogramming/type_deduction.hpp"
#include "phlex/model/algorithm_name.hpp"
#include "phlex/model/handle.hpp"
#include "phlex/model/level_id.hpp"
#include "phlex/model/product_specification.hpp"
#include "phlex/model/product_store.hpp"
#include "phlex/model/qualified_name.hpp"
#include "phlex/utilities/simple_ptr_map.hpp"

#include "oneapi/tbb/concurrent_hash_map.h"
Expand All @@ -34,7 +34,7 @@ namespace phlex::experimental {
public:
declared_observer(algorithm_name name,
std::vector<std::string> predicates,
specified_labels input_products);
product_queries input_products);
virtual ~declared_observer();

protected:
Expand Down Expand Up @@ -64,7 +64,7 @@ namespace phlex::experimental {
std::vector<std::string> predicates,
tbb::flow::graph& g,
AlgorithmBits alg,
specified_labels input_products) :
product_queries input_products) :
declared_observer{std::move(name), std::move(predicates), std::move(input_products)},
join_{make_join_or_none(g, std::make_index_sequence<N>{})},
observer_{g,
Expand Down Expand Up @@ -93,7 +93,7 @@ namespace phlex::experimental {
~observer_node() { report_cached_hashes(cached_hashes_); }

private:
tbb::flow::receiver<message>& port_for(specified_label const& product_label) override
tbb::flow::receiver<message>& port_for(product_query const& product_label) override
{
return receiver_for<N>(join_, input(), product_label);
}
Expand Down
2 changes: 1 addition & 1 deletion phlex/core/declared_predicate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace phlex::experimental {
declared_predicate::declared_predicate(algorithm_name name,
std::vector<std::string> predicates,
specified_labels input_products) :
product_queries input_products) :
products_consumer{std::move(name), std::move(predicates), std::move(input_products)}
{
}
Expand Down
8 changes: 4 additions & 4 deletions phlex/core/declared_predicate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#include "phlex/core/fwd.hpp"
#include "phlex/core/input_arguments.hpp"
#include "phlex/core/message.hpp"
#include "phlex/core/product_query.hpp"
#include "phlex/core/products_consumer.hpp"
#include "phlex/core/specified_label.hpp"
#include "phlex/core/store_counters.hpp"
#include "phlex/metaprogramming/type_deduction.hpp"
#include "phlex/model/algorithm_name.hpp"
Expand Down Expand Up @@ -37,7 +37,7 @@ namespace phlex::experimental {
public:
declared_predicate(algorithm_name name,
std::vector<std::string> predicates,
specified_labels input_products);
product_queries input_products);
virtual ~declared_predicate();

virtual tbb::flow::sender<predicate_result>& sender() = 0;
Expand Down Expand Up @@ -70,7 +70,7 @@ namespace phlex::experimental {
std::vector<std::string> predicates,
tbb::flow::graph& g,
AlgorithmBits alg,
specified_labels input_products) :
product_queries input_products) :
declared_predicate{std::move(name), std::move(predicates), std::move(input_products)},
join_{make_join_or_none(g, std::make_index_sequence<N>{})},
predicate_{
Expand Down Expand Up @@ -102,7 +102,7 @@ namespace phlex::experimental {
~predicate_node() { report_cached_results(results_); }

private:
tbb::flow::receiver<message>& port_for(specified_label const& product_label) override
tbb::flow::receiver<message>& port_for(product_query const& product_label) override
{
return receiver_for<N>(join_, input(), product_label);
}
Expand Down
6 changes: 5 additions & 1 deletion phlex/core/declared_transform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace phlex::experimental {
declared_transform::declared_transform(algorithm_name name,
std::vector<std::string> predicates,
specified_labels input_products) :
product_queries input_products) :
products_consumer{std::move(name), std::move(predicates), std::move(input_products)}
{
}
Expand All @@ -19,6 +19,10 @@
spdlog::warn("Transform {} has {} cached stores.", full_name(), stores.size());
}
for (auto const& [hash, store] : stores) {
if (not store) {
spdlog::warn("Store with hash {} is null!", hash);
continue;

Check warning on line 24 in phlex/core/declared_transform.cpp

View check run for this annotation

Codecov / codecov/patch

phlex/core/declared_transform.cpp#L23-L24

Added lines #L23 - L24 were not covered by tests
}
spdlog::debug(" => ID: {} (hash: {})", store->id()->to_string(), hash);
}
}
Expand Down
19 changes: 10 additions & 9 deletions phlex/core/declared_transform.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
#include "phlex/core/fwd.hpp"
#include "phlex/core/input_arguments.hpp"
#include "phlex/core/message.hpp"
#include "phlex/core/product_query.hpp"
#include "phlex/core/products_consumer.hpp"
#include "phlex/core/specified_label.hpp"
#include "phlex/core/store_counters.hpp"
#include "phlex/metaprogramming/type_deduction.hpp"
#include "phlex/model/algorithm_name.hpp"
#include "phlex/model/handle.hpp"
#include "phlex/model/level_id.hpp"
#include "phlex/model/product_specification.hpp"
#include "phlex/model/product_store.hpp"
#include "phlex/model/qualified_name.hpp"
#include "phlex/utilities/simple_ptr_map.hpp"

#include "oneapi/tbb/concurrent_hash_map.h"
Expand All @@ -41,12 +41,12 @@ namespace phlex::experimental {
public:
declared_transform(algorithm_name name,
std::vector<std::string> predicates,
specified_labels input_products);
product_queries input_products);
virtual ~declared_transform();

virtual tbb::flow::sender<message>& sender() = 0;
virtual tbb::flow::sender<message>& to_output() = 0;
virtual qualified_names const& output() const = 0;
virtual product_specifications const& output() const = 0;
virtual std::size_t product_count() const = 0;

protected:
Expand Down Expand Up @@ -79,10 +79,11 @@ namespace phlex::experimental {
std::vector<std::string> predicates,
tbb::flow::graph& g,
AlgorithmBits alg,
specified_labels input_products,
product_queries input_products,
std::vector<std::string> output) :
declared_transform{std::move(name), std::move(predicates), std::move(input_products)},
output_{to_qualified_names(full_name(), std::move(output))},
output_{to_product_specifications(
full_name(), std::move(output), make_output_type_ids<function_t>())},
join_{make_join_or_none(g, std::make_index_sequence<N>{})},
transform_{g,
concurrency,
Expand Down Expand Up @@ -126,7 +127,7 @@ namespace phlex::experimental {
~transform_node() { report_cached_stores(stores_); }

private:
tbb::flow::receiver<message>& port_for(specified_label const& product_label) override
tbb::flow::receiver<message>& port_for(product_query const& product_label) override
{
return receiver_for<N>(join_, input(), product_label);
}
Expand All @@ -135,7 +136,7 @@ namespace phlex::experimental {

tbb::flow::sender<message>& sender() override { return output_port<0>(transform_); }
tbb::flow::sender<message>& to_output() override { return output_port<1>(transform_); }
qualified_names const& output() const override { return output_; }
product_specifications const& output() const override { return output_; }

template <std::size_t... Is>
auto call(function_t const& ft, messages_t<N> const& messages, std::index_sequence<Is...>)
Expand All @@ -154,7 +155,7 @@ namespace phlex::experimental {
}

input_retriever_types<input_parameter_types> input_{input_arguments<input_parameter_types>()};
qualified_names output_;
product_specifications output_;
join_or_none_t<N> join_;
tbb::flow::multifunction_node<messages_t<N>, messages_t<2u>> transform_;
stores_t stores_;
Expand Down
6 changes: 5 additions & 1 deletion phlex/core/declared_unfold.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

declared_unfold::declared_unfold(algorithm_name name,
std::vector<std::string> predicates,
specified_labels input_products) :
product_queries input_products) :
products_consumer{std::move(name), std::move(predicates), std::move(input_products)}
{
}
Expand All @@ -48,6 +48,10 @@
spdlog::warn("Unfold {} has {} cached stores.", full_name(), stores.size());
}
for (auto const& [hash, store] : stores) {
if (not store) {
spdlog::warn("Store with hash {} is null!", hash);
continue;

Check warning on line 53 in phlex/core/declared_unfold.cpp

View check run for this annotation

Codecov / codecov/patch

phlex/core/declared_unfold.cpp#L52-L53

Added lines #L52 - L53 were not covered by tests
}
spdlog::debug(" => ID: {} (hash: {})", store->id()->to_string(), hash);
}
}
Expand Down
18 changes: 10 additions & 8 deletions phlex/core/declared_unfold.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
#include "phlex/model/algorithm_name.hpp"
#include "phlex/model/handle.hpp"
#include "phlex/model/level_id.hpp"
#include "phlex/model/product_specification.hpp"
#include "phlex/model/product_store.hpp"
#include "phlex/model/qualified_name.hpp"
#include "phlex/utilities/simple_ptr_map.hpp"

#include "oneapi/tbb/concurrent_hash_map.h"
Expand Down Expand Up @@ -57,12 +57,12 @@ namespace phlex::experimental {
public:
declared_unfold(algorithm_name name,
std::vector<std::string> predicates,
specified_labels input_products);
product_queries input_products);
virtual ~declared_unfold();

virtual tbb::flow::sender<message>& sender() = 0;
virtual tbb::flow::sender<message>& to_output() = 0;
virtual qualified_names const& output() const = 0;
virtual product_specifications const& output() const = 0;
virtual std::size_t product_count() const = 0;

protected:
Expand Down Expand Up @@ -91,11 +91,13 @@ namespace phlex::experimental {
tbb::flow::graph& g,
Predicate&& predicate,
Unfold&& unfold,
specified_labels product_labels,
product_queries product_labels,
std::vector<std::string> output_products,
std::string new_level_name) :
declared_unfold{std::move(name), std::move(predicates), std::move(product_labels)},
output_{to_qualified_names(full_name(), std::move(output_products))},
output_{to_product_specifications(full_name(),
std::move(output_products),
make_type_ids<skip_first_type<return_type<Unfold>>>())},
new_level_name_{std::move(new_level_name)},
join_{make_join_or_none(g, std::make_index_sequence<N>{})},
unfold_{
Expand Down Expand Up @@ -129,15 +131,15 @@ namespace phlex::experimental {
~unfold_node() { report_cached_stores(stores_); }

private:
tbb::flow::receiver<message>& port_for(specified_label const& product_label) override
tbb::flow::receiver<message>& port_for(product_query const& product_label) override
{
return receiver_for<N>(join_, input(), product_label);
}
std::vector<tbb::flow::receiver<message>*> ports() override { return input_ports<N>(join_); }

tbb::flow::sender<message>& sender() override { return output_port<0>(unfold_); }
tbb::flow::sender<message>& to_output() override { return sender(); }
qualified_names const& output() const override { return output_; }
product_specifications const& output() const override { return output_; }

template <std::size_t... Is>
void call(Predicate const& predicate,
Expand Down Expand Up @@ -175,7 +177,7 @@ namespace phlex::experimental {
std::size_t product_count() const final { return product_count_.load(); }

input_retriever_types<InputArgs> input_{input_arguments<InputArgs>()};
qualified_names output_;
product_specifications output_;
std::string new_level_name_;
join_or_none_t<N> join_;
tbb::flow::multifunction_node<messages_t<N>, messages_t<1u>> unfold_;
Expand Down
10 changes: 6 additions & 4 deletions phlex/core/detail/filter_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
#include <string>

namespace {
phlex::experimental::specified_label const output_dummy{phlex::experimental::qualified_name{
phlex::experimental::algorithm_name{"for_output_only", ""}, "for_output_only"}};
std::vector<phlex::experimental::specified_label> const for_output_only{output_dummy};
phlex::experimental::product_query const output_dummy{phlex::experimental::product_specification{
phlex::experimental::algorithm_name{"for_output_only", ""},
"for_output_only",
phlex::experimental::type_id{}}};
std::vector<phlex::experimental::product_query> const for_output_only{output_dummy};
}

namespace phlex::experimental {
Expand Down Expand Up @@ -50,7 +52,7 @@ namespace phlex::experimental {

void decision_map::erase(accessor& a) { results_.erase(a); }

data_map::data_map(specified_labels const& product_names) :
data_map::data_map(product_queries const& product_names) :
product_names_{&product_names}, nargs_{product_names.size()}
{
assert(nargs_ > 0);
Expand Down
Loading
Loading