-
Notifications
You must be signed in to change notification settings - Fork 225
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'repo-refactor' into cpu-kernels-tests
- Loading branch information
Showing
318 changed files
with
8,540 additions
and
3,628 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
45 changes: 45 additions & 0 deletions
45
lib/compiler/include/compiler/cost_estimator/cost_estimator.h
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#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_estimate_key.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" | ||
#include "pcg/machine_view.dtg.h" | ||
#include <vector> | ||
|
||
namespace FlexFlow { | ||
|
||
struct ICostEstimator { | ||
virtual float estimate_cost(OpCostEstimateKey const &) const = 0; | ||
virtual float estimate_cost(TensorSetMovement const &) const = 0; | ||
|
||
ICostEstimator() = default; | ||
ICostEstimator(ICostEstimator const &) = delete; | ||
ICostEstimator &operator=(ICostEstimator const &) = delete; | ||
|
||
virtual ~ICostEstimator() = default; | ||
}; | ||
CHECK_RC_COPY_VIRTUAL_COMPLIANT(ICostEstimator); | ||
|
||
struct CostEstimator { | ||
float estimate_cost(OpCostEstimateKey const &k) const; | ||
float estimate_cost(TensorSetMovement const &m) const; | ||
|
||
template <typename T, typename... Args> | ||
static typename std::enable_if<std::is_base_of<ICostEstimator, T>::value, | ||
CostEstimator>::type | ||
create(Args &&...args) { | ||
return CostEstimator(std::make_shared<T>(std::forward<Args>(args)...)); | ||
} | ||
|
||
private: | ||
CostEstimator(std::shared_ptr<ICostEstimator> implementation_ptr); | ||
|
||
private: | ||
std::shared_ptr<ICostEstimator> implementation_ptr; | ||
}; | ||
|
||
} // namespace FlexFlow | ||
|
||
#endif |
40 changes: 40 additions & 0 deletions
40
lib/compiler/include/compiler/cost_estimator/op_cost_estimate_key.struct.toml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
namespace = "FlexFlow" | ||
name = "OpCostEstimateKey" | ||
features = [ | ||
"eq", | ||
"ord", | ||
"fmt", | ||
"hash", | ||
] | ||
|
||
includes = [ | ||
"op-attrs/pcg_operator_attrs.dtg.h", | ||
"op-attrs/parallel_tensor_shape.dtg.h", | ||
"<vector>", | ||
"pcg/machine_view.dtg.h", | ||
] | ||
|
||
src_includes = [ | ||
"utils/hash/vector.h", | ||
"utils/fmt/vector.h", | ||
] | ||
|
||
[[fields]] | ||
name = "op_attrs" | ||
type = "::FlexFlow::PCGOperatorAttrs" | ||
|
||
[[fields]] | ||
name = "input_shapes" | ||
type = "std::vector<::FlexFlow::ParallelTensorShape>" | ||
|
||
[[fields]] | ||
name = "weight_shapes" | ||
type = "std::vector<::FlexFlow::ParallelTensorShape>" | ||
|
||
[[fields]] | ||
name = "output_shapes" | ||
type = "std::vector<::FlexFlow::ParallelTensorShape>" | ||
|
||
[[fields]] | ||
name = "machine_view" | ||
type = "::FlexFlow::MachineView" |
30 changes: 30 additions & 0 deletions
30
lib/compiler/include/compiler/cost_estimator/single_tensor_movement.struct.toml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
namespace = "FlexFlow" | ||
name = "SingleTensorMovement" | ||
features = [ | ||
"eq", | ||
"hash", | ||
"fmt", | ||
] | ||
|
||
includes = [ | ||
"op-attrs/parallel_tensor_shape.dtg.h", | ||
"pcg/machine_view.dtg.h", | ||
"<unordered_set>", | ||
] | ||
|
||
src_includes = [ | ||
"utils/hash/unordered_set.h", | ||
"utils/fmt/unordered_set.h", | ||
] | ||
|
||
[[fields]] | ||
name = "parallel_tensor_shape" | ||
type = "::FlexFlow::ParallelTensorShape" | ||
|
||
[[fields]] | ||
name = "src_machine_views" | ||
type = "std::unordered_set<::FlexFlow::MachineView>" | ||
|
||
[[fields]] | ||
name = "dst_machine_views" | ||
type = "std::unordered_set<::FlexFlow::MachineView>" |
21 changes: 21 additions & 0 deletions
21
lib/compiler/include/compiler/cost_estimator/tensor_set_movement.struct.toml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
namespace = "FlexFlow" | ||
name = "TensorSetMovement" | ||
features = [ | ||
"eq", | ||
"hash", | ||
"fmt", | ||
] | ||
|
||
includes = [ | ||
"compiler/cost_estimator/single_tensor_movement.dtg.h", | ||
"<unordered_set>", | ||
] | ||
|
||
src_includes = [ | ||
"utils/fmt/unordered_multiset.h", | ||
"utils/hash/unordered_multiset.h", | ||
] | ||
|
||
[[fields]] | ||
name = "single_tensor_movements" | ||
type = "std::unordered_multiset<::FlexFlow::SingleTensorMovement>" |
16 changes: 16 additions & 0 deletions
16
lib/compiler/include/compiler/graph_optimize_result.struct.toml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
namespace = "FlexFlow" | ||
name = "GraphOptimizeResult" | ||
features = [ ] | ||
|
||
includes = [ | ||
"compiler/machine_mapping/machine_mapping.dtg.h", | ||
"pcg/parallel_computation_graph/parallel_computation_graph.h" | ||
] | ||
|
||
[[fields]] | ||
name = "pcg" | ||
type = "::FlexFlow::ParallelComputationGraph" | ||
|
||
[[fields]] | ||
name = "machine_mapping" | ||
type = "::FlexFlow::MachineMapping" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#ifndef _FLEXFLOW_COMPILER_MCMC_STATE_H | ||
#define _FLEXFLOW_COMPILER_MCMC_STATE_H | ||
|
||
#include "compiler/graph_optimize_result.dtg.h" | ||
|
||
namespace FlexFlow { | ||
|
||
struct GraphOptimizeState { | ||
GraphOptimizeState(GraphOptimizeResult const &graph_optimize_result, | ||
float runtime); | ||
|
||
GraphOptimizeResult graph_optimize_result; | ||
float runtime; | ||
|
||
bool operator==(GraphOptimizeState const &other) const; | ||
bool operator!=(GraphOptimizeState const &other) const; | ||
bool operator<(GraphOptimizeState const &other) const; | ||
}; | ||
|
||
} // namespace FlexFlow | ||
|
||
namespace std { | ||
|
||
template <> | ||
struct hash<::FlexFlow::GraphOptimizeState> { | ||
size_t operator()(::FlexFlow::GraphOptimizeState const &) const; | ||
}; | ||
|
||
} // namespace std | ||
|
||
#endif |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.