Skip to content

Commit

Permalink
Post-merge fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lockshaw committed Oct 10, 2024
1 parent c9f6e8a commit 3579ee4
Show file tree
Hide file tree
Showing 46 changed files with 203 additions and 163 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include "compiler/machine_mapping/machine_mapping.h"
#include "utils/containers.h"
#include "utils/containers/are_disjoint.h"
#include "utils/containers/keys.h"
#include "utils/containers/merge_maps.h"
Expand Down
3 changes: 2 additions & 1 deletion lib/pcg/src/pcg/operator_task_space.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "utils/containers/range.h"
#include "utils/containers/transform.h"
#include "utils/containers/unordered_set_of.h"
#include "utils/fmt/unordered_set.h"

namespace FlexFlow {

Expand All @@ -25,7 +26,7 @@ std::unordered_set<TaskSpaceCoordinate>

TaskSpaceCoordinate
get_task_space_maximum_coordinate(OperatorTaskSpace const &task) {
return maximum(get_task_space_coordinates(task)).value();
return maximum(get_task_space_coordinates(task));
}

size_t num_dims(OperatorTaskSpace const &task) {
Expand Down
4 changes: 1 addition & 3 deletions lib/utils/include/utils/fmt/optional.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ std::ostream &operator<<(std::ostream &s, std::optional<T> const &t) {
return s << fmt::to_string(t);
}

inline std::ostream &operator<<(std::ostream &s, std::nullopt_t) {
return s << "nullopt";
}
std::ostream &operator<<(std::ostream &, std::nullopt_t);

} // namespace FlexFlow

Expand Down
3 changes: 2 additions & 1 deletion lib/utils/src/utils/cli/cli_get_help_message.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "utils/containers/concat_vectors.h"
#include "utils/containers/maximum.h"
#include "utils/containers/transform.h"
#include "utils/fmt/vector.h"
#include "utils/integer_conversions.h"
#include "utils/join_strings.h"
#include <sstream>
Expand Down Expand Up @@ -53,7 +54,7 @@ std::string cli_get_help_message(std::string const &program_name,

if (!all_arg_columns.empty()) {
int max_column_width =
std::min(int_from_size_t(maximum(all_arg_column_widths).value()), 20);
std::min(int_from_size_t(maximum(all_arg_column_widths)), 20);

auto render_column = [&](std::string const &key,
std::optional<std::string> const &description) {
Expand Down
8 changes: 8 additions & 0 deletions lib/utils/src/utils/fmt/optional.cc
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
#include "utils/fmt/optional.h"

namespace FlexFlow {

std::ostream &operator<<(std::ostream &s, std::nullopt_t) {
return (s << std::string{"nullopt"});
}

} // namespace FlexFlow
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
#include "utils/graph/digraph/algorithms/complete_bipartite_composite/get_cbc_decomposition.h"
#include "utils/containers/are_disjoint.h"
#include "utils/containers/extend.h"
#include "utils/containers/get_first.h"
#include "utils/containers/set_minus.h"
#include "utils/containers/set_of.h"
#include "utils/containers/values.h"
#include "utils/containers/vector_of.h"
#include "utils/fmt/set.h"
#include "utils/graph/algorithms.h"
#include "utils/graph/digraph/algorithms.h"
#include "utils/graph/digraph/algorithms/complete_bipartite_composite/is_complete_bipartite_digraph.h"
Expand All @@ -16,7 +13,6 @@
#include "utils/graph/digraph/algorithms/get_successors.h"
#include "utils/graph/digraph/algorithms/get_weakly_connected_components.h"
#include "utils/graph/node/algorithms.h"
#include "utils/hash/unordered_set.h"
#include <queue>

namespace FlexFlow {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include "utils/graph/digraph/algorithms/complete_bipartite_composite/is_complete_bipartite_digraph.h"
#include "utils/containers/get_first.h"
#include "utils/containers/set_minus.h"
#include "utils/graph/digraph/algorithms.h"
#include "utils/graph/node/algorithms.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ struct StringMaker<std::optional<T>> {
}
};

template <>
struct StringMaker<std::nullopt_t> {
static String convert(std::nullopt_t const &);
};

} // namespace doctest

#endif
8 changes: 8 additions & 0 deletions lib/utils/test/common/src/test/utils/doctest/fmt/optional.cc
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
#include "test/utils/doctest/fmt/optional.h"

namespace doctest {

String StringMaker<std::nullopt_t>::convert(std::nullopt_t const &m) {
return toString(fmt::to_string(m));
}

} // namespace doctest
17 changes: 0 additions & 17 deletions lib/utils/test/src/utils/containers/as_vector.cc

This file was deleted.

2 changes: 1 addition & 1 deletion lib/utils/test/src/utils/containers/compare_by.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "utils/containers/compare_by.h"
#include "utils/fmt/vector.h"
#include "test/utils/doctest/fmt/vector.h"
#include <algorithm>
#include <doctest/doctest.h>
#include <string>
Expand Down
3 changes: 2 additions & 1 deletion lib/utils/test/src/utils/containers/enumerate.cc
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#include "utils/containers/enumerate.h"
#include "test/utils/doctest/fmt/map.h"
#include "test/utils/doctest/fmt/pair.h"
#include "test/utils/doctest/fmt/unordered_multiset.h"
#include "test/utils/doctest/fmt/unordered_set.h"
#include "test/utils/doctest/fmt/vector.h"
#include "utils/containers/keys.h"
#include "utils/containers/unordered_set_of.h"
#include "utils/containers/unordered_multiset_of.h"
#include "utils/containers/values.h"
#include "utils/containers/vector_of.h"
#include <doctest/doctest.h>
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/test/src/utils/containers/filter_keys.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "utils/containers/filter_keys.h"
#include "utils/fmt/unordered_map.h"
#include "test/utils/doctest/fmt/unordered_map.h"
#include <doctest/doctest.h>
#include <string>
#include <unordered_map>
Expand Down
3 changes: 2 additions & 1 deletion lib/utils/test/src/utils/containers/find.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "utils/containers/find.h"
#include "test/utils/doctest.h"
#include "test/utils/doctest/check_without_stringify.h"
#include <algorithm>
#include <doctest/doctest.h>
#include <set>
#include <unordered_set>
#include <vector>
Expand Down
2 changes: 2 additions & 0 deletions lib/utils/test/src/utils/containers/flatmap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "test/utils/doctest/fmt/pair.h"
#include "test/utils/doctest/fmt/unordered_map.h"
#include "test/utils/doctest/fmt/unordered_set.h"
#include "test/utils/doctest/fmt/vector.h"
#include "utils/containers/map_keys.h"
#include "utils/hash/pair.h"
#include <doctest/doctest.h>
Expand Down Expand Up @@ -41,6 +42,7 @@ TEST_SUITE(FF_TEST_SUITE) {
"1", "2", "4", "3", "4", "8", "9", "10", "20"};
CHECK(result == correct);
}
}

TEST_CASE("flatmap(std::unordered_set<T>, F)") {
auto get_chars = [](std::string const &s) {
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/test/src/utils/containers/index_of.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "utils/containers/index_of.h"
#include "utils/fmt/optional.h"
#include "test/utils/doctest/fmt/optional.h"
#include <doctest/doctest.h>
#include <optional>
#include <vector>
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/test/src/utils/containers/keys.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "utils/containers/keys.h"
#include "utils/fmt/unordered_set.h"
#include "test/utils/doctest/fmt/unordered_set.h"
#include <doctest/doctest.h>
#include <string>
#include <unordered_map>
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/test/src/utils/containers/map_keys.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "utils/containers/map_keys.h"
#include "utils/fmt/unordered_map.h"
#include "test/utils/doctest/fmt/unordered_map.h"
#include <doctest/doctest.h>
#include <string>
#include <unordered_map>
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/test/src/utils/containers/map_values.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "utils/containers/map_values.h"
#include "utils/fmt/unordered_map.h"
#include "test/utils/doctest/fmt/unordered_map.h"
#include <doctest/doctest.h>
#include <string>
#include <unordered_map>
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/test/src/utils/containers/maximum.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "utils/containers/maximum.h"
#include "test/utils/doctest/fmt/vector.h"
#include <doctest/doctest.h>
#include <stdexcept>
#include <vector>

using namespace ::FlexFlow;
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/test/src/utils/containers/merge_maps.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "utils/containers/merge_maps.h"
#include "utils/fmt/unordered_map.h"
#include "test/utils/doctest/fmt/unordered_map.h"
#include <doctest/doctest.h>
#include <unordered_map>

Expand Down
3 changes: 2 additions & 1 deletion lib/utils/test/src/utils/containers/restrict_keys.cc
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#include "utils/containers/restrict_keys.h"
#include "utils/fmt/unordered_map.h"
#include "test/utils/doctest/fmt/unordered_map.h"
#include <doctest/doctest.h>
#include <string>

using namespace FlexFlow;

TEST_SUITE(FF_TEST_SUITE) {
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/test/src/utils/containers/set_union.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "utils/containers/set_union.h"
#include "utils/fmt/unordered_set.h"
#include "test/utils/doctest/fmt/unordered_set.h"
#include <doctest/doctest.h>
#include <unordered_set>

Expand Down
2 changes: 1 addition & 1 deletion lib/utils/test/src/utils/containers/sorted_by.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "utils/containers/sorted_by.h"
#include "utils/fmt/vector.h"
#include "test/utils/doctest/fmt/vector.h"
#include <doctest/doctest.h>
#include <unordered_set>
#include <vector>
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/test/src/utils/containers/subvec.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "utils/containers/subvec.h"
#include "utils/fmt/vector.h"
#include "test/utils/doctest/fmt/vector.h"
#include <doctest/doctest.h>
#include <vector>

Expand Down
4 changes: 2 additions & 2 deletions lib/utils/test/src/utils/containers/value_all.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "utils/containers/value_all.h"
#include "utils/fmt/optional.h"
#include "utils/fmt/vector.h"
#include "test/utils/doctest/fmt/optional.h"
#include "test/utils/doctest/fmt/vector.h"
#include <doctest/doctest.h>
#include <optional>
#include <vector>
Expand Down
10 changes: 5 additions & 5 deletions lib/utils/test/src/utils/containers/values.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "utils/containers/values.h"
#include "utils/containers/sorted.h"
#include "utils/fmt/vector.h"
#include "test/utils/doctest/fmt/unordered_multiset.h"
#include <doctest/doctest.h>
#include <string>
#include <unordered_map>
Expand All @@ -12,8 +11,9 @@ TEST_SUITE(FF_TEST_SUITE) {
TEST_CASE("values") {
std::unordered_map<int, std::string> m = {
{1, "one"}, {2, "two"}, {3, "three"}, {33, "three"}};
std::vector<std::string> result = values(m);
std::vector<std::string> correct = {"one", "two", "three", "three"};
CHECK(sorted(result) == sorted(correct));
std::unordered_multiset<std::string> result = values(m);
std::unordered_multiset<std::string> correct = {
"one", "two", "three", "three"};
CHECK(result == correct);
}
}
2 changes: 1 addition & 1 deletion lib/utils/test/src/utils/containers/vector_split.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "utils/containers/vector_split.h"
#include "utils/fmt/vector.h"
#include "test/utils/doctest/fmt/vector.h"
#include <doctest/doctest.h>
#include <stdexcept>
#include <vector>
Expand Down
2 changes: 2 additions & 0 deletions lib/utils/test/src/utils/deduplicated_priority_queue.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include "utils/deduplicated_priority_queue.h"
#include <doctest/doctest.h>

using namespace ::FlexFlow;

TEST_SUITE(FF_TEST_SUITE) {
TEST_CASE("DeduplicatedPriorityQueue push and pop") {
DeduplicatedPriorityQueue<int> queue;
Expand Down
4 changes: 2 additions & 2 deletions lib/utils/test/src/utils/disjoint_set.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "utils/disjoint_set.h"
#include "test/utils/doctest.h"
#include "utils/fmt/optional.h"
#include "test/utils/doctest/fmt/optional.h"
#include <doctest/doctest.h>

using namespace FlexFlow;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include "utils/graph/multidigraph/multidigraph.h"
#include "test/utils/doctest.h"
#include "utils/containers/contains.h"
#include "utils/graph/instances/adjacency_multidigraph.h"
#include "utils/graph/multidigraph/multidiedge_query.h"
#include "utils/graph/query_set.h"
#include <doctest/doctest.h>
#include <unordered_set>
#include <vector>

Expand Down
Loading

0 comments on commit 3579ee4

Please sign in to comment.