Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
wmdi committed Dec 18, 2024
1 parent 7778377 commit 0315160
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef _FLEXFLOW_LIB_COMPILER_INCLUDE_COMPILER_COST_ESTIMATOR_COST_ESTIMATOR_H
#define _FLEXFLOW_LIB_COMPILER_INCLUDE_COMPILER_COST_ESTIMATOR_COST_ESTIMATOR_H

#include "compiler/cost_estimator/op_cost_metrics.dtg.h"
#include "compiler/cost_estimator/op_cost_estimate_key.dtg.h"
#include "compiler/cost_estimator/op_cost_metrics.dtg.h"
#include "compiler/cost_estimator/tensor_set_movement.dtg.h"
#include "op-attrs/parallel_tensor_shape.dtg.h"
#include "op-attrs/pcg_operator_attrs.dtg.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#include "compiler/machine_mapping/machine_mapping_constraints.h"
#include "compiler/machine_mapping/machine_mapping_problem_tree/machine_mapping_problem_tree.h"
#include "compiler/machine_mapping/machine_mapping_problem_tree/unmapped_op_cost_estimate_key.h"
#include "compiler/machine_mapping/memory_optimization/machine_mapping_with_memory_result.h"
#include "compiler/machine_mapping/memory_optimization/machine_mapping_with_memory_cache.h"
#include "compiler/machine_mapping/memory_optimization/machine_mapping_with_memory_result.h"
#include "compiler/machine_mapping/transitive_reduced_pcg.h"
#include "compiler/series_parallel/pcg/pcg_binary_sp_decomposition.dtg.h"
#include "compiler/series_parallel/pcg/pcg_binary_sp_decomposition.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
namespace FlexFlow {

TestCostEstimator::TestCostEstimator(
std::function<OpCostMetrics(OpCostEstimateKey const &)> const &get_operator_cost,
std::function<OpCostMetrics(OpCostEstimateKey const &)> const
&get_operator_cost,
std::function<float(TensorSetMovement const &)> const
&get_communication_cost)
: get_operator_cost(get_operator_cost),
get_communication_cost(get_communication_cost) {}

OpCostMetrics TestCostEstimator::estimate_cost(OpCostEstimateKey const &k) const {
OpCostMetrics
TestCostEstimator::estimate_cost(OpCostEstimateKey const &k) const {
return this->get_operator_cost(k);
}

Expand All @@ -20,11 +22,12 @@ float TestCostEstimator::estimate_cost(TensorSetMovement const &m) const {
}

CostEstimator make_fake_cost_estimator(
std::function<OpCostMetrics(OpCostEstimateKey const &)> const &get_operator_cost,
std::function<OpCostMetrics(OpCostEstimateKey const &)> const
&get_operator_cost,
std::function<float(TensorSetMovement const &)> const
&get_communication_cost) {
return CostEstimator::create<TestCostEstimator>(
get_operator_cost, get_communication_cost);
return CostEstimator::create<TestCostEstimator>(get_operator_cost,
get_communication_cost);
}

CostEstimator make_fake_cost_estimator(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ struct TestCostEstimator : public ICostEstimator {
};

CostEstimator make_fake_cost_estimator(
std::function<OpCostMetrics(OpCostEstimateKey const &)> const &get_operator_cost,
std::function<OpCostMetrics(OpCostEstimateKey const &)> const
&get_operator_cost,
std::function<float(TensorSetMovement const &)> const
&get_communication_cost);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,11 @@ TEST_SUITE(FF_TEST_SUITE) {
printf("Before constructing cost_estimator\n");

auto map1 = std::unordered_map<OpCostEstimateKey, OpCostMetrics>{{
{map_unmapped_op_cost_estimate_key(k1, mv1), OpCostMetrics(1.0, 0)},
{map_unmapped_op_cost_estimate_key(k2, mv1), OpCostMetrics(2.0, 0)},
{map_unmapped_op_cost_estimate_key(k1, mv2), OpCostMetrics(1.5, 0)},
{map_unmapped_op_cost_estimate_key(k2, mv2), OpCostMetrics(2.5, 0)},
}};
{map_unmapped_op_cost_estimate_key(k1, mv1), OpCostMetrics(1.0, 0)},
{map_unmapped_op_cost_estimate_key(k2, mv1), OpCostMetrics(2.0, 0)},
{map_unmapped_op_cost_estimate_key(k1, mv2), OpCostMetrics(1.5, 0)},
{map_unmapped_op_cost_estimate_key(k2, mv2), OpCostMetrics(2.5, 0)},
}};

printf("After constructing map1\n");

Expand All @@ -171,10 +171,12 @@ TEST_SUITE(FF_TEST_SUITE) {

// CostEstimator cost_estimator = make_fake_cost_estimator(
// std::unordered_map<OpCostEstimateKey, OpCostMetrics>{{
// {map_unmapped_op_cost_estimate_key(k1, mv1), OpCostMetrics(1.0, 0)},
// {map_unmapped_op_cost_estimate_key(k2, mv1), OpCostMetrics(2.0, 0)},
// {map_unmapped_op_cost_estimate_key(k1, mv2), OpCostMetrics(1.5, 0)},
// {map_unmapped_op_cost_estimate_key(k2, mv2), OpCostMetrics(2.5, 0)},
// {map_unmapped_op_cost_estimate_key(k1, mv1), OpCostMetrics(1.0,
// 0)}, {map_unmapped_op_cost_estimate_key(k2, mv1),
// OpCostMetrics(2.0, 0)}, {map_unmapped_op_cost_estimate_key(k1,
// mv2), OpCostMetrics(1.5, 0)},
// {map_unmapped_op_cost_estimate_key(k2, mv2), OpCostMetrics(2.5,
// 0)},
// }},
// std::unordered_map<TensorSetMovement, float>{{
// {TensorSetMovement{{}}, 0.0},
Expand Down

0 comments on commit 0315160

Please sign in to comment.