-
Notifications
You must be signed in to change notification settings - Fork 234
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
1,716 additions
and
203 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ lib | ||
, stdenv | ||
, makeWrapper | ||
, gdb | ||
, python3 | ||
, proj | ||
}: | ||
|
||
stdenv.mkDerivation rec { | ||
pname = "ffdb"; | ||
version = "0.1"; | ||
|
||
pythonPath = with python3.pkgs; makePythonPath [ | ||
proj | ||
]; | ||
|
||
dontBuild = true; | ||
|
||
nativeBuildInputs = [ makeWrapper ]; | ||
|
||
src = ./.; | ||
|
||
installPhase = '' | ||
mkdir -p $out/share/ffdb | ||
cp ffdb.py $out/share/ffdb | ||
makeWrapper ${gdb}/bin/gdb $out/bin/gdb \ | ||
--add-flags "-q -x $out/share/ffdb/ffdb.py" \ | ||
--set NIX_PYTHONPATH ${pythonPath} \ | ||
--prefix PATH : ${lib.makeBinPath [ | ||
python3 | ||
]} | ||
cp $out/bin/gdb $out/bin/ffdb | ||
''; | ||
|
||
nativeCheckInputs = [ | ||
gdb | ||
python3 | ||
proj | ||
]; | ||
} |
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,7 @@ | ||
from proj.config_file import get_config_root | ||
from pathlib import Path | ||
import gdb | ||
|
||
gdb.execute(f'directory {get_config_root(Path.cwd())}') | ||
gdb.prompt_hook = lambda x: '(ffdb) ' | ||
gdb.execute('set history save on') |
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,11 @@ | ||
images: | ||
dlami-x64: | ||
platform: "linux" | ||
arch: "x64" | ||
owner: "898082745236" # AWS | ||
name: "Deep Learning Base OSS Nvidia Driver GPU AMI (Ubuntu 22.04)*" | ||
|
||
runners: | ||
gpu-nvidia: | ||
family: ["g4dn.xlarge"] | ||
image: dlami-x64 |
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 |
---|---|---|
@@ -1,3 +1,6 @@ | ||
# gdb history | ||
.gdb_history | ||
|
||
# dtgen files | ||
*.dtg.cc | ||
*.dtg.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
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 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
18 changes: 18 additions & 0 deletions
18
lib/compiler/include/compiler/cost_estimator/op_cost_metrics.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,18 @@ | ||
namespace = "FlexFlow" | ||
name = "OpCostMetrics" | ||
features = [ | ||
"eq", | ||
"fmt", | ||
"hash", | ||
] | ||
|
||
includes = [ | ||
] | ||
|
||
[[fields]] | ||
name = "runtime" | ||
type = "float" | ||
|
||
[[fields]] | ||
name = "memory" | ||
type = "size_t" |
48 changes: 48 additions & 0 deletions
48
...de/compiler/machine_mapping/memory_optimization/get_optimal_machine_mapping_with_memory.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,48 @@ | ||
#ifndef _FLEXFLOW_COMPILER_MACHINE_MAPPING_MEMORY_OPTIMIZATION_GET_OPTIMAL_MACHINE_MAPPING_WITH_MEMORY_H | ||
#define _FLEXFLOW_COMPILER_MACHINE_MAPPING_MEMORY_OPTIMIZATION_GET_OPTIMAL_MACHINE_MAPPING_WITH_MEMORY_H | ||
|
||
#include "compiler/machine_mapping/machine_mapping_cache.dtg.h" | ||
#include "compiler/machine_mapping/machine_mapping_constraints.dtg.h" | ||
#include "compiler/machine_mapping/machine_mapping_context.dtg.h" | ||
#include "compiler/machine_mapping/machine_mapping_problem_tree/machine_mapping_problem_tree.dtg.h" | ||
#include "compiler/machine_mapping/machine_mapping_problem_tree/mm_problem_tree_parallel_split.dtg.h" | ||
#include "compiler/machine_mapping/machine_mapping_problem_tree/mm_problem_tree_series_split.dtg.h" | ||
#include "compiler/machine_mapping/memory_optimization/machine_mapping_with_memory_cache.dtg.h" | ||
#include "compiler/machine_mapping/parallel_split_transformation.dtg.h" | ||
#include "pcg/machine_specification.dtg.h" | ||
|
||
namespace FlexFlow { | ||
|
||
MachineMappingWithMemoryResult get_optimal_machine_mapping_with_memory( | ||
MachineMappingWithMemoryCache &result_cache, | ||
MachineMappingContext const &context, | ||
MachineMappingProblemTree const &problem_tree, | ||
MachineSpecification const &resources, | ||
MachineMappingConstraints const &constraints); | ||
|
||
MachineMappingWithMemoryResult get_optimal_machine_mapping_with_memory( | ||
MachineMappingWithMemoryCache &result_cache, | ||
MachineMappingContext const &context, | ||
MMProblemTreeSeriesSplit const &series_split, | ||
MachineSpecification const &resources, | ||
MachineMappingConstraints const &constraints, | ||
std::optional<ParallelSplitTransformation> const | ||
¶llel_split_transformation); | ||
|
||
MachineMappingWithMemoryResult get_optimal_machine_mapping_with_memory( | ||
MachineMappingWithMemoryCache &result_cache, | ||
MachineMappingContext const &context, | ||
MMProblemTreeParallelSplit const ¶llel_split, | ||
MachineSpecification const &resources, | ||
MachineMappingConstraints const &constraints); | ||
|
||
MachineMappingWithMemoryResult get_optimal_machine_mapping_with_memory( | ||
MachineMappingWithMemoryCache &result_cache, | ||
MachineMappingContext const &, | ||
UnmappedOpCostEstimateKey const &leaf, | ||
MachineSpecification const &resources, | ||
MachineMappingConstraints const &constraints); | ||
|
||
} // namespace FlexFlow | ||
|
||
#endif |
20 changes: 20 additions & 0 deletions
20
...compiler/machine_mapping/memory_optimization/machine_mapping_for_single_layer.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,20 @@ | ||
namespace = "FlexFlow" | ||
name = "MachineMappingForSingleLayer" | ||
features = [ | ||
"eq", | ||
"hash", | ||
"fmt", | ||
] | ||
|
||
includes = [ | ||
"compiler/machine_mapping/parallel_layer_guid_oblivious_machine_mapping.dtg.h", | ||
"compiler/cost_estimator/op_cost_metrics.dtg.h", | ||
] | ||
|
||
[[fields]] | ||
name = "cost" | ||
type = "::FlexFlow::OpCostMetrics" | ||
|
||
[[fields]] | ||
name = "machine_mapping" | ||
type = "::FlexFlow::ParallelLayerGuidObliviousMachineMapping" |
19 changes: 19 additions & 0 deletions
19
.../include/compiler/machine_mapping/memory_optimization/machine_mapping_with_memory_cache.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,19 @@ | ||
#ifndef _FLEXFLOW_LIB_COMPILER_INCLUDE_COMPILER_MACHINE_MAPPING_MEMORY_OPTIMIZATION_MACHINE_MAPPING_CACHE_WITH_MEMORY_H | ||
#define _FLEXFLOW_LIB_COMPILER_INCLUDE_COMPILER_MACHINE_MAPPING_MEMORY_OPTIMIZATION_MACHINE_MAPPING_CACHE_WITH_MEMORY_H | ||
|
||
#include "compiler/machine_mapping/memory_optimization/machine_mapping_with_memory_cache.dtg.h" | ||
|
||
namespace FlexFlow { | ||
|
||
MachineMappingWithMemoryCache empty_machine_mapping_with_memory_cache(); | ||
std::optional<MachineMappingWithMemoryResult> | ||
machine_mapping_with_memory_cache_load( | ||
MachineMappingWithMemoryCache const &, MachineMappingState const &); | ||
void machine_mapping_with_memory_cache_save( | ||
MachineMappingWithMemoryCache &, | ||
MachineMappingState const &, | ||
MachineMappingWithMemoryResult const &); | ||
|
||
} // namespace FlexFlow | ||
|
||
#endif |
22 changes: 22 additions & 0 deletions
22
...ompiler/machine_mapping/memory_optimization/machine_mapping_with_memory_cache.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,22 @@ | ||
namespace = "FlexFlow" | ||
name = "MachineMappingWithMemoryCache" | ||
features = [ | ||
"eq", | ||
"hash", | ||
"fmt", | ||
] | ||
|
||
includes = [ | ||
"<unordered_map>", | ||
"compiler/machine_mapping/machine_mapping_state.dtg.h", | ||
"compiler/machine_mapping/memory_optimization/machine_mapping_with_memory_result.dtg.h", | ||
] | ||
|
||
src_includes = [ | ||
"utils/fmt/unordered_map.h", | ||
"utils/hash/unordered_map.h", | ||
] | ||
|
||
[[fields]] | ||
name = "raw_map" | ||
type = "std::unordered_map<::FlexFlow::MachineMappingState, ::FlexFlow::MachineMappingWithMemoryResult>" |
41 changes: 41 additions & 0 deletions
41
...include/compiler/machine_mapping/memory_optimization/machine_mapping_with_memory_result.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,41 @@ | ||
#ifndef _FLEXFLOW_COMPILER_MACHINE_MAPPING_MEMORY_OPTIMIZATION_MACHINE_MAPPING_RESULT_WITH_MEMORY_H | ||
#define _FLEXFLOW_COMPILER_MACHINE_MAPPING_MEMORY_OPTIMIZATION_MACHINE_MAPPING_RESULT_WITH_MEMORY_H | ||
|
||
#include "compiler/machine_mapping/memory_optimization/machine_mapping_with_memory_result.dtg.h" | ||
#include "compiler/machine_mapping/parallel_split_transformation.dtg.h" | ||
#include <optional> | ||
|
||
namespace FlexFlow { | ||
|
||
[[nodiscard]] MachineMappingWithMemoryResult | ||
empty_machine_mapping_with_memory_result(); | ||
[[nodiscard]] bool is_empty(MachineMappingWithMemoryResult const &); | ||
|
||
[[nodiscard]] MachineMappingWithMemoryResult get_mapping_with_minimal_runtime( | ||
std::unordered_set<MachineMappingWithMemoryResult> const &); | ||
|
||
[[nodiscard]] MachineMappingWithMemoryResult | ||
remove_non_pareto_optimal_machine_mapping_result( | ||
MachineMappingWithMemoryResult const &); | ||
|
||
[[nodiscard]] MachineMappingWithMemoryResult | ||
series_combine(float comm_cost, | ||
MachineMappingWithMemoryResult const &pre_result, | ||
MachineMappingWithMemoryResult const &post_result, | ||
std::optional<ParallelSplitTransformation> const | ||
¶llel_split_transformation); | ||
[[nodiscard]] MachineMappingWithMemoryResult | ||
parallel_combine(MachineMappingWithMemoryResult const &lhs_result, | ||
MachineMappingWithMemoryResult const &rhs_result); | ||
|
||
[[nodiscard]] MachineMappingWithMemoryResult | ||
minimize_runtime(MachineMappingWithMemoryResult const &m1, | ||
MachineMappingWithMemoryResult const &m2); | ||
|
||
[[nodiscard]] MachineMappingWithMemoryResult | ||
make_singleton_machine_mapping_with_memory_result( | ||
OpCostMetrics cost, MachineView const &machine_view); | ||
|
||
} // namespace FlexFlow | ||
|
||
#endif |
20 changes: 20 additions & 0 deletions
20
...mpiler/machine_mapping/memory_optimization/machine_mapping_with_memory_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,20 @@ | ||
namespace = "FlexFlow" | ||
name = "MachineMappingWithMemoryResult" | ||
features = [ | ||
"eq", | ||
"hash", | ||
"fmt", | ||
] | ||
|
||
includes = [ | ||
"compiler/machine_mapping/memory_optimization/machine_mapping_for_single_layer.dtg.h", | ||
] | ||
|
||
src_includes = [ | ||
"utils/hash/unordered_set.h", | ||
"utils/fmt/unordered_set.h", | ||
] | ||
|
||
[[fields]] | ||
name = "machine_mappings" | ||
type = "std::unordered_set<::FlexFlow::MachineMappingForSingleLayer>" |
Oops, something went wrong.