From 9d741dc86e9bf06a92edf8e9268bb839c3d901b6 Mon Sep 17 00:00:00 2001 From: Colin Unger Date: Sat, 8 Feb 2025 19:50:56 -0800 Subject: [PATCH] Format --- flake.lock | 6 +-- ...ion_graph_series_parallel_decomposition.cc | 53 ++++++++----------- .../graph/digraph/algorithms/random_dag.cc | 19 ++++--- .../graph/digraph/algorithms/random_dag.h | 1 - .../digraph/algorithms/transitive_closure.cc | 7 +-- .../algorithms/transitive_reduction.cc | 7 +-- .../utils/archetypes/ordered_value_type.h | 2 +- .../include/utils/archetypes/value_type.h | 2 +- 8 files changed, 45 insertions(+), 52 deletions(-) diff --git a/flake.lock b/flake.lock index 39e90decf4..fd082340f1 100644 --- a/flake.lock +++ b/flake.lock @@ -66,11 +66,11 @@ ] }, "locked": { - "lastModified": 1739070025, - "narHash": "sha256-kLMZOL8E06S9DoPfQpnrFX/RfTY7itc1xs+/fV02BSA=", + "lastModified": 1739072952, + "narHash": "sha256-8Y5Ljq2DtitTeYa8HvedBzugWTI1gSTK5steaEn5T/A=", "owner": "lockshaw", "repo": "proj", - "rev": "99974d492a90f26ac2dbfb62716d7b64b542e056", + "rev": "a48269850edfafb4df406ea956ffd9be3918190f", "type": "github" }, "original": { diff --git a/lib/compiler/benchmark/src/compiler/series_parallel/computation_graph/get_computation_graph_series_parallel_decomposition.cc b/lib/compiler/benchmark/src/compiler/series_parallel/computation_graph/get_computation_graph_series_parallel_decomposition.cc index 4757616919..fe6cc6c80d 100644 --- a/lib/compiler/benchmark/src/compiler/series_parallel/computation_graph/get_computation_graph_series_parallel_decomposition.cc +++ b/lib/compiler/benchmark/src/compiler/series_parallel/computation_graph/get_computation_graph_series_parallel_decomposition.cc @@ -1,49 +1,42 @@ #include "compiler/series_parallel/computation_graph/get_computation_graph_series_parallel_decomposition.h" +#include "models/bert/bert.h" +#include "models/candle_uno/candle_uno.h" +#include "models/inception_v3/inception_v3.h" #include "models/split_test/split_test.h" #include "models/transformer/transformer.h" -#include "models/inception_v3/inception_v3.h" -#include "models/candle_uno/candle_uno.h" -#include "models/bert/bert.h" #include using namespace ::FlexFlow; -static void -benchmark_get_computation_graph_series_parallel_decomposition(benchmark::State &state, ComputationGraph const &cg) { +static void benchmark_get_computation_graph_series_parallel_decomposition( + benchmark::State &state, ComputationGraph const &cg) { // ComputationGraph cg = state.range(0); - // get_split_test_computation_graph(/*batch_size=*/8); + // get_split_test_computation_graph(/*batch_size=*/8); for (auto _ : state) { get_computation_graph_series_parallel_decomposition(cg); } } -BENCHMARK_CAPTURE( - benchmark_get_computation_graph_series_parallel_decomposition, - split_test, - get_split_test_computation_graph(/*batch_size=*/8_n) -); +BENCHMARK_CAPTURE(benchmark_get_computation_graph_series_parallel_decomposition, + split_test, + get_split_test_computation_graph(/*batch_size=*/8_n)); BENCHMARK_CAPTURE( - benchmark_get_computation_graph_series_parallel_decomposition, - transformer, - get_transformer_computation_graph(get_default_transformer_config()) -); + benchmark_get_computation_graph_series_parallel_decomposition, + transformer, + get_transformer_computation_graph(get_default_transformer_config())); -BENCHMARK_CAPTURE( - benchmark_get_computation_graph_series_parallel_decomposition, - bert, - get_bert_computation_graph(get_default_bert_config()) -); - -BENCHMARK_CAPTURE( - benchmark_get_computation_graph_series_parallel_decomposition, - candle_uno, - get_candle_uno_computation_graph(get_default_candle_uno_config()) -); +BENCHMARK_CAPTURE(benchmark_get_computation_graph_series_parallel_decomposition, + bert, + get_bert_computation_graph(get_default_bert_config())); BENCHMARK_CAPTURE( - benchmark_get_computation_graph_series_parallel_decomposition, - inception_v3, - get_inception_v3_computation_graph(get_default_inception_v3_training_config()) -); + benchmark_get_computation_graph_series_parallel_decomposition, + candle_uno, + get_candle_uno_computation_graph(get_default_candle_uno_config())); + +BENCHMARK_CAPTURE(benchmark_get_computation_graph_series_parallel_decomposition, + inception_v3, + get_inception_v3_computation_graph( + get_default_inception_v3_training_config())); diff --git a/lib/utils/benchmark/src/utils/graph/digraph/algorithms/random_dag.cc b/lib/utils/benchmark/src/utils/graph/digraph/algorithms/random_dag.cc index 9fc06ac445..186d070be7 100644 --- a/lib/utils/benchmark/src/utils/graph/digraph/algorithms/random_dag.cc +++ b/lib/utils/benchmark/src/utils/graph/digraph/algorithms/random_dag.cc @@ -1,28 +1,27 @@ #include "./random_dag.h" #include "utils/containers/vector_of.h" #include "utils/graph/algorithms.h" -#include "utils/nonnegative_int/nonnegative_int.h" #include "utils/graph/instances/adjacency_digraph.h" +#include "utils/nonnegative_int/nonnegative_int.h" #include "utils/random_utils.h" namespace FlexFlow { -DiGraphView random_dag(nonnegative_int num_nodes, - float edges_fraction) { - assert (edges_fraction <= 1.0); - assert (edges_fraction >= 0.0); +DiGraphView random_dag(nonnegative_int num_nodes, float edges_fraction) { + assert(edges_fraction <= 1.0); + assert(edges_fraction >= 0.0); int max_num_edges = [&] { int nn = num_nodes.unwrap_nonnegative(); return (nn * (nn - 1)) / 2; - }(); + }(); nonnegative_int num_edges = nonnegative_int{ - static_cast(max_num_edges * edges_fraction), + static_cast(max_num_edges * edges_fraction), }; - assert (num_edges <= max_num_edges); + assert(num_edges <= max_num_edges); DiGraph g = DiGraph::create(); std::vector n = add_nodes(g, num_nodes.unwrap_nonnegative()); @@ -32,7 +31,7 @@ DiGraphView random_dag(nonnegative_int num_nodes, Node n1 = select_random(n); Node n2 = select_random(n); - if (n1 == n2) { + if (n1 == n2) { continue; } @@ -47,4 +46,4 @@ DiGraphView random_dag(nonnegative_int num_nodes, return g; } -} +} // namespace FlexFlow diff --git a/lib/utils/benchmark/src/utils/graph/digraph/algorithms/random_dag.h b/lib/utils/benchmark/src/utils/graph/digraph/algorithms/random_dag.h index 0625cdb162..4a7363ca51 100644 --- a/lib/utils/benchmark/src/utils/graph/digraph/algorithms/random_dag.h +++ b/lib/utils/benchmark/src/utils/graph/digraph/algorithms/random_dag.h @@ -8,7 +8,6 @@ namespace FlexFlow { DiGraphView random_dag(nonnegative_int num_nodes, float edges_fraction); - } // namespace FlexFlow #endif diff --git a/lib/utils/benchmark/src/utils/graph/digraph/algorithms/transitive_closure.cc b/lib/utils/benchmark/src/utils/graph/digraph/algorithms/transitive_closure.cc index 87db61698f..a22b41ee6c 100644 --- a/lib/utils/benchmark/src/utils/graph/digraph/algorithms/transitive_closure.cc +++ b/lib/utils/benchmark/src/utils/graph/digraph/algorithms/transitive_closure.cc @@ -7,7 +7,8 @@ using namespace ::FlexFlow; static void benchmark_transitive_closure(benchmark::State &state) { int edge_percentage = 100 - state.range(0); int num_nodes = state.range(1); - DiGraphView g = random_dag(nonnegative_int{num_nodes}, static_cast(edge_percentage) / 100.0); + DiGraphView g = random_dag(nonnegative_int{num_nodes}, + static_cast(edge_percentage) / 100.0); for (auto _ : state) { transitive_closure(g); @@ -16,6 +17,6 @@ static void benchmark_transitive_closure(benchmark::State &state) { BENCHMARK(benchmark_transitive_closure) ->ArgsProduct({ - benchmark::CreateDenseRange(25, 75, /*step=*/25), - benchmark::CreateRange(16, 256, /*multi=*/54), + benchmark::CreateDenseRange(25, 75, /*step=*/25), + benchmark::CreateRange(16, 256, /*multi=*/54), }); diff --git a/lib/utils/benchmark/src/utils/graph/digraph/algorithms/transitive_reduction.cc b/lib/utils/benchmark/src/utils/graph/digraph/algorithms/transitive_reduction.cc index b67b483000..bbb3d238a2 100644 --- a/lib/utils/benchmark/src/utils/graph/digraph/algorithms/transitive_reduction.cc +++ b/lib/utils/benchmark/src/utils/graph/digraph/algorithms/transitive_reduction.cc @@ -7,7 +7,8 @@ using namespace ::FlexFlow; static void benchmark_transitive_reduction(benchmark::State &state) { int edge_percentage = state.range(0); int num_nodes = state.range(1); - DiGraphView g = random_dag(nonnegative_int{num_nodes}, static_cast(edge_percentage) / 100.0); + DiGraphView g = random_dag(nonnegative_int{num_nodes}, + static_cast(edge_percentage) / 100.0); for (auto _ : state) { transitive_reduction(g); @@ -16,6 +17,6 @@ static void benchmark_transitive_reduction(benchmark::State &state) { BENCHMARK(benchmark_transitive_reduction) ->ArgsProduct({ - benchmark::CreateDenseRange(25, 75, /*step=*/25), - benchmark::CreateRange(16, 256, /*multi=*/54), + benchmark::CreateDenseRange(25, 75, /*step=*/25), + benchmark::CreateRange(16, 256, /*multi=*/54), }); diff --git a/lib/utils/include/utils/archetypes/ordered_value_type.h b/lib/utils/include/utils/archetypes/ordered_value_type.h index b54761acc9..5218794fd1 100644 --- a/lib/utils/include/utils/archetypes/ordered_value_type.h +++ b/lib/utils/include/utils/archetypes/ordered_value_type.h @@ -1,8 +1,8 @@ #ifndef _FLEXFLOW_LIB_UTILS_INCLUDE_UTILS_ARCHETYPES_ORDERED_VALUE_TYPE_H #define _FLEXFLOW_LIB_UTILS_INCLUDE_UTILS_ARCHETYPES_ORDERED_VALUE_TYPE_H -#include #include +#include namespace FlexFlow { diff --git a/lib/utils/include/utils/archetypes/value_type.h b/lib/utils/include/utils/archetypes/value_type.h index 1ecf049c34..1a60e23fd3 100644 --- a/lib/utils/include/utils/archetypes/value_type.h +++ b/lib/utils/include/utils/archetypes/value_type.h @@ -1,9 +1,9 @@ #ifndef _FLEXFLOW_LIB_UTILS_INCLUDE_UTILS_ARCHETYPES_VALUE_TYPE_H #define _FLEXFLOW_LIB_UTILS_INCLUDE_UTILS_ARCHETYPES_VALUE_TYPE_H -#include #include #include +#include #include #include