Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local execution e2e training #1472

Open
wants to merge 46 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
6adb290
temporary weight adjust index
reyna-abhyankar Aug 25, 2024
61697c2
Loss function
reyna-abhyankar Aug 27, 2024
b56c046
Add cuda test for loss function
reyna-abhyankar Aug 27, 2024
f75a3d4
Format
reyna-abhyankar Aug 27, 2024
f74711f
Refactor and build optimizer kernels, op
reyna-abhyankar Aug 27, 2024
40c6252
Finish optimizer local backing
reyna-abhyankar Aug 27, 2024
ad9b9ea
Format
reyna-abhyankar Aug 27, 2024
1ddfade
E2E update test
reyna-abhyankar Aug 27, 2024
dde9496
Format
reyna-abhyankar Aug 27, 2024
59635d8
Small fixes
reyna-abhyankar Sep 11, 2024
103ef07
Format
reyna-abhyankar Sep 11, 2024
f48f9ff
Fix test and small issues
reyna-abhyankar Sep 18, 2024
189c9c8
Format
reyna-abhyankar Sep 18, 2024
d93f464
Merge branch 'repo-refactor' into local-e2e-training
reyna-abhyankar Oct 1, 2024
b5647c8
Pass tests after merge
reyna-abhyankar Oct 1, 2024
f5ff91e
Fix input/weight differentiation
reyna-abhyankar Oct 1, 2024
7470e71
Fix signature to use unified rep
reyna-abhyankar Oct 1, 2024
deece1b
Fix model training instance abstraction
reyna-abhyankar Oct 1, 2024
1d3cc94
Change subcase test name
reyna-abhyankar Oct 1, 2024
3cf5d08
Quick fixes
reyna-abhyankar Oct 16, 2024
79ef4c9
Refactor training backing and instance
reyna-abhyankar Oct 22, 2024
a73b1c3
Expose op folders publicly
reyna-abhyankar Nov 13, 2024
c6fed29
Add tensor type, operate over reduced tensor
reyna-abhyankar Nov 13, 2024
0cdfb1a
Fixes
reyna-abhyankar Jan 7, 2025
9d252b3
Remove tensor lower
reyna-abhyankar Jan 15, 2025
895c117
Add tensor and task lowering scheme
reyna-abhyankar Jan 17, 2025
411017d
Build local exec
reyna-abhyankar Jan 22, 2025
0128abb
Disaggregate local backend
reyna-abhyankar Feb 1, 2025
277f8c2
Update task binding interface and cost estimator
reyna-abhyankar Feb 1, 2025
377c6aa
Merge master into local execution
reyna-abhyankar Feb 4, 2025
8efaec7
Build
reyna-abhyankar Feb 6, 2025
1dc1398
Format
reyna-abhyankar Feb 6, 2025
17ad5c8
Split task spec files
reyna-abhyankar Feb 6, 2025
639c2c1
Delete outdated sim environment file
reyna-abhyankar Feb 6, 2025
a697044
Finish API
reyna-abhyankar Feb 13, 2025
187a8d5
Add tests for allocated and unallocated
reyna-abhyankar Feb 13, 2025
a0f8113
Fix nonnegative
reyna-abhyankar Feb 13, 2025
b1eab94
Format
reyna-abhyankar Feb 13, 2025
b532c50
Pass allocated-unallocated tests
reyna-abhyankar Feb 13, 2025
f28e5c2
Update task registry tests
reyna-abhyankar Feb 13, 2025
89752fa
Move local tensor backing to dtgen
reyna-abhyankar Feb 22, 2025
aef8ad5
Remove lowered tensor source
reyna-abhyankar Feb 22, 2025
f0a4285
Loss and update tests
reyna-abhyankar Feb 24, 2025
9047edc
Merge master
reyna-abhyankar Feb 24, 2025
350babf
Passing tests after merge issues
reyna-abhyankar Feb 24, 2025
aef7c6e
Pass gpu tests
reyna-abhyankar Feb 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge master
  • Loading branch information
reyna-abhyankar committed Feb 24, 2025
commit 9047edce81c68daf31692e9c9d24be77787bfa56
4 changes: 4 additions & 0 deletions bin/export-model-arch/src/export_model_arch.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "export_model_arch/json_sp_model_export.dtg.h"
#include "models/bert/bert.h"
#include "models/candle_uno/candle_uno.h"
#include "models/dlrm/dlrm.h"
#include "models/inception_v3/inception_v3.h"
#include "models/split_test/split_test.h"
#include "models/transformer/transformer.h"
Expand Down Expand Up @@ -69,6 +70,8 @@ tl::expected<ComputationGraph, std::string>
return get_candle_uno_computation_graph(get_default_candle_uno_config());
} else if (model_name == "bert") {
return get_bert_computation_graph(get_default_bert_config());
} else if (model_name == "dlrm") {
return get_dlrm_computation_graph(get_default_dlrm_config());
} else if (model_name == "split_test") {
nonnegative_int batch_size = 8_n;
return get_split_test_computation_graph(batch_size);
Expand Down Expand Up @@ -144,6 +147,7 @@ int main(int argc, char **argv) {
"inception_v3",
"candle_uno",
"bert",
"dlrm",
"split_test",
"single_operator"};
CLIArgumentKey key_model_name = cli_add_positional_argument(
Expand Down
14 changes: 7 additions & 7 deletions cmake/doctestlib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ include(aliasing)
if (FF_USE_EXTERNAL_DOCTEST)
find_package(doctest REQUIRED)
include(doctest) # import doctest_discover_tests

target_compile_definitions(
doctest::doctest
INTERFACE
DOCTEST_CONFIG_REQUIRE_STRINGIFICATION_FOR_ALL_USED_TYPES
)
alias_library(doctest doctest::doctest)
else()
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/deps/doctest)
include(${CMAKE_CURRENT_SOURCE_DIR}/deps/doctest/scripts/cmake/doctest.cmake)
endif()

target_compile_definitions(
doctest::doctest
INTERFACE
DOCTEST_CONFIG_REQUIRE_STRINGIFICATION_FOR_ALL_USED_TYPES
)
alias_library(doctest doctest::doctest)
13 changes: 13 additions & 0 deletions lib/compiler/include/compiler/graph_optimize_result.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#ifndef _FLEXFLOW_LIB_COMPILER_INCLUDE_COMPILER_GRAPH_OPTIMIZE_RESULT_H
#define _FLEXFLOW_LIB_COMPILER_INCLUDE_COMPILER_GRAPH_OPTIMIZE_RESULT_H

#include "compiler/graph_optimize_result.dtg.h"

namespace FlexFlow {

std::string format_as(GraphOptimizeResult const &);
std::ostream &operator<<(std::ostream &, GraphOptimizeResult const &);

} // namespace FlexFlow

#endif
7 changes: 5 additions & 2 deletions lib/compiler/include/compiler/graph_optimize_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
namespace FlexFlow {

struct GraphOptimizeState {
GraphOptimizeState(GraphOptimizeResult const &graph_optimize_result,
float runtime);
explicit GraphOptimizeState(GraphOptimizeResult const &graph_optimize_result,
float runtime);

GraphOptimizeResult graph_optimize_result;
float runtime;
Expand All @@ -17,6 +17,9 @@ struct GraphOptimizeState {
bool operator<(GraphOptimizeState const &other) const;
};

std::string format_as(GraphOptimizeState const &);
std::ostream &operator<<(std::ostream &, GraphOptimizeState const &);

} // namespace FlexFlow

namespace std {
Expand Down
11 changes: 11 additions & 0 deletions lib/compiler/src/compiler/graph_optimize_state.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "compiler/graph_optimize_state.h"
#include "compiler/graph_optimize_result.h"
#include "pcg/parallel_computation_graph/parallel_tensor_guid_t.h"

namespace FlexFlow {
Expand Down Expand Up @@ -54,6 +55,16 @@ bool GraphOptimizeState::operator<(GraphOptimizeState const &other) const {
return runtime < other.runtime;
}

std::string format_as(GraphOptimizeState const &st) {
return fmt::format("<GraphOptimizeState graph_optimize_result={} runtime={}>",
st.graph_optimize_result,
st.runtime);
}

std::ostream &operator<<(std::ostream &s, GraphOptimizeState const &st) {
return (s << fmt::to_string(st));
}

} // namespace FlexFlow

namespace std {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ std::string render_preprocessed_computation_graph_for_sp_decomposition(
ComputationGraph const &cg) {
std::unordered_set<layer_guid_t> weight_and_input_layers =
filter(get_layers(cg), [&](layer_guid_t const &l) {
ComputationGraphOpAttrs op_attrs = get_layer_attrs(cg, l).attrs;
ComputationGraphOpAttrs op_attrs = get_layer_attrs(cg, l).op_attrs;
return op_attrs.has<WeightAttrs>() || op_attrs.has<InputAttrs>();
});

Expand All @@ -41,7 +41,7 @@ std::string render_preprocessed_computation_graph_for_sp_decomposition(
return "FAKE";
}
LayerAttrs a = cg.raw_graph.at(n);
RecordFormatter r = as_dot(a.attrs);
RecordFormatter r = as_dot(a.op_attrs);

if (a.name.has_value()) {
RecordFormatter rr;
Expand Down Expand Up @@ -75,7 +75,7 @@ std::optional<SeriesParallelDecomposition>
DiGraphView preprocessed_digraph = [&] {
std::unordered_set<layer_guid_t> weight_and_input_layers =
filter(get_layers(cg), [&](layer_guid_t const &l) {
ComputationGraphOpAttrs op_attrs = get_layer_attrs(cg, l).attrs;
ComputationGraphOpAttrs op_attrs = get_layer_attrs(cg, l).op_attrs;
return op_attrs.has<WeightAttrs>() || op_attrs.has<InputAttrs>();
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,80 @@
#include "compiler/series_parallel/pcg/get_pcg_series_parallel_decomposition.h"
#include "op-attrs/pcg_operator_attrs.h"
#include "pcg/parallel_computation_graph/parallel_computation_graph.h"
#include "utils/containers/get_only.h"
#include "utils/graph/digraph/algorithms/materialize_digraph_view.h"
#include "utils/graph/instances/adjacency_digraph.h"
#include "utils/graph/series_parallel/get_series_parallel_decomposition.h"

namespace FlexFlow {

std::optional<SeriesParallelDecomposition>
get_pcg_series_parallel_decomposition(ParallelComputationGraph const &) {
NOT_IMPLEMENTED();
get_pcg_series_parallel_decomposition(ParallelComputationGraph const &pcg) {
{
DiGraphView unpreprocessed_digraph = pcg.raw_graph;
std::optional<SeriesParallelDecomposition> unpreprocessed_sp_decomposition =
get_series_parallel_decomposition(unpreprocessed_digraph);
if (unpreprocessed_sp_decomposition.has_value()) {
return unpreprocessed_sp_decomposition.value();
}
}

auto layer_is_weight_or_input = [&](parallel_layer_guid_t const &l) {
PCGOperatorAttrs op_attrs = get_parallel_layer_attrs(pcg, l).op_attrs;
return op_attrs.has<WeightAttrs>() || op_attrs.has<InputAttrs>();
};

auto layer_is_parallel_op = [&](parallel_layer_guid_t const &l) {
PCGOperatorAttrs op_attrs = get_parallel_layer_attrs(pcg, l).op_attrs;
return is_parallel_op(op_attrs);
};

std::function<parallel_layer_guid_t(parallel_layer_guid_t const &)>
follow_to_last_parallel_op =
[&](parallel_layer_guid_t const &starting_point)
-> parallel_layer_guid_t {
assert(layer_is_weight_or_input(starting_point) ||
layer_is_parallel_op(starting_point));

std::unordered_set<parallel_layer_guid_t> successors =
get_successors(pcg, starting_point);

if (successors.size() != 1) {
return starting_point;
}

parallel_layer_guid_t successor =
get_only(get_successors(pcg, starting_point));

assert(!layer_is_weight_or_input(successor));
if (layer_is_parallel_op(successor)) {
return follow_to_last_parallel_op(successor);
} else {
return starting_point;
}
};

DiGraphView preprocessed_digraph = [&] {
std::unordered_set<parallel_layer_guid_t> weight_and_input_layers =
filter(get_parallel_layers(pcg), layer_is_weight_or_input);

std::unordered_set<parallel_layer_guid_t> par_chain_endpoints =
transform(weight_and_input_layers, follow_to_last_parallel_op);

std::unordered_set<parallel_layer_guid_t> par_chain_endpoint_successors =
get_subgraph_successors(pcg, par_chain_endpoints);

DiGraph digraph = materialize_digraph_view<AdjacencyDiGraph>(pcg.raw_graph);
for (parallel_layer_guid_t const &src : par_chain_endpoints) {
for (parallel_layer_guid_t const &dst : par_chain_endpoint_successors) {
digraph.add_edge(DirectedEdge{src.raw_graph_node, dst.raw_graph_node});
}
}

return digraph;
}();

return get_series_parallel_decomposition(preprocessed_digraph);
}

} // namespace FlexFlow
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ TaskGraphExecutionTrace simulate_task_graph_execution(
"simulate_task_graph_execution cannot simulate cyclic directed graphs");
}

TaskGraphExecutionState execution_state =
TaskGraphExecutionState{/*ready_tasks=*/set_of(get_sources(task_graph)),
/*in_progress_tasks=*/{},
/*finished_tasks=*/{},
/*current_time=*/0.0};
TaskGraphExecutionState execution_state = TaskGraphExecutionState{
/*ready_tasks=*/set_of(get_initial_nodes(task_graph)),
/*in_progress_tasks=*/{},
/*finished_tasks=*/{},
/*current_time=*/0.0};

std::unordered_set<TaskProfile> task_profiles;

Expand Down
15 changes: 15 additions & 0 deletions lib/compiler/test/src/compiler/graph_optimize_result.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include "compiler/graph_optimize_result.h"

namespace FlexFlow {

std::string format_as(GraphOptimizeResult const &r) {
return fmt::format("<GraphOptimizeResult\npcg={}\nmachine_mapping={}>",
as_dot(r.pcg),
r.machine_mapping);
}

std::ostream &operator<<(std::ostream &s, GraphOptimizeResult const &r) {
return (s << fmt::to_string(r));
}

} // namespace FlexFlow
Loading
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.