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

Adding to unity substitution set #1594

Open
wants to merge 93 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
510c2d9
Start on pcg builder
lockshaw Jun 4, 2024
7b55ed1
Add tests and some implementation for pcg builder
lockshaw Jun 4, 2024
c379efd
Add pcg tests, make dtgen constructors explicit to fix bug
lockshaw Jun 10, 2024
35fa653
Add remainder of PCG tests
lockshaw Jun 10, 2024
865a28e
Merge remote-tracking branch 'origin/repo-refactor' into pcg-builder
lockshaw Jun 10, 2024
f379539
Fix build issues in local-execution
lockshaw Jun 10, 2024
2dbb3b9
Format
lockshaw Jun 10, 2024
4050c99
Address Reyna comments, add topological_order function for PCG
lockshaw Jun 17, 2024
42c1968
Pre multidigraph refactor
lockshaw Jun 19, 2024
3be816f
Removing visitable from sp code
lockshaw Jun 21, 2024
6d68324
Add open dataflow graph, start to replace pcg dataflow graph
lockshaw Jun 23, 2024
64a3403
Start refactoring substitutions
lockshaw Jun 24, 2024
7d4c7be
Add utility functions to support pattern matching
lockshaw Jun 25, 2024
9ab9eb2
Pre-refactor inputs
lockshaw Jun 26, 2024
7ae7c65
Merge remote-tracking branch 'origin/repo-refactor' into dataflow-graph
lockshaw Jun 26, 2024
f9b129e
Fix proj url
lockshaw Jun 26, 2024
cf73f08
Get back to substitutions, now with unordered graph inputs
lockshaw Jul 7, 2024
5fd666d
Get substitutions building
lockshaw Jul 13, 2024
5f0c88a
substitutions-tests now builds
lockshaw Jul 13, 2024
3228f2d
Fix bug in filter, pass some initial substitution tests
lockshaw Jul 14, 2024
5f4cc01
Add tests for fmt::to_string, fix some substitutions bugs
lockshaw Jul 15, 2024
ad60be0
Pass initial unit tests for find_pattern_matches
lockshaw Jul 15, 2024
a972da2
Start on unit tests for pcg pattern
lockshaw Jul 15, 2024
bcf776e
Pass initial test for find_pattern_matches
lockshaw Jul 19, 2024
e28400e
Merge remote-tracking branch 'origin/repo-refactor' into dataflow-graph
lockshaw Jul 19, 2024
fe6d65d
Fix small build issue in tests
lockshaw Jul 19, 2024
e647af7
Format
lockshaw Jul 19, 2024
8b58760
Sync tests in CI with tests in proj
lockshaw Jul 19, 2024
1fafb9d
Fix minor build errors in kernels and local-execution
lockshaw Jul 19, 2024
0804314
Format
lockshaw Jul 19, 2024
dd5465c
Remove outdated code
lockshaw Jul 20, 2024
29ec5b8
More outdated code removal
lockshaw Jul 20, 2024
ff41743
More cleanup, add test for sp decomposition
lockshaw Jul 20, 2024
e71d200
Pull apart containers.h
lockshaw Jul 21, 2024
c06710c
More sp testing and fixes
lockshaw Jul 21, 2024
2f75566
Break up graph algorithms.h
lockshaw Jul 21, 2024
c81d3a4
Pre- full SP algo commit
lockshaw Jul 23, 2024
2a11c7e
Add initial implementation and tests for cbc decomposition and invers…
lockshaw Jul 23, 2024
71a9e0f
Pass test for get_inverse_line_graph
lockshaw Jul 24, 2024
25eb1db
Add new multidigraph
lockshaw Jul 24, 2024
64f1932
Fix get_inverse_line_graph to return a MultiDiGraph instead of a DiGraph
lockshaw Jul 24, 2024
31c8d17
Add tests for parallel and series reduction finding
lockshaw Jul 24, 2024
19e7e28
Add really rough implementation of valdez sp decomposition
lockshaw Jul 24, 2024
3791e86
Fix local-execution build
lockshaw Jul 25, 2024
267b72d
Add implementations and tests for applying series/parallel reductions
lockshaw Jul 25, 2024
bb2769a
Format
lockshaw Jul 26, 2024
39cb7b3
Clean up sp decomposition interface and tests
lockshaw Jul 27, 2024
ce0234d
Format
lockshaw Jul 27, 2024
3dc3ec6
Add comments for top-level substitutions functions, add proj doxygen …
lockshaw Jul 31, 2024
ee518c2
Start sketching out substitutions code
lockshaw Jul 31, 2024
f69b95a
Merge branch 'dataflow-graph' into substitutions-fix
lockshaw Jul 31, 2024
3c06b88
Fix build errors
lockshaw Aug 1, 2024
3d6f681
Add ability to permute node ids
lockshaw Aug 1, 2024
098a9d1
Cleanup and start to test new substitutions code
lockshaw Aug 4, 2024
9bd4f14
Add test case for evaluate_substitution_output
lockshaw Aug 5, 2024
101083b
Add naive isomorphism detection code
lockshaw Aug 5, 2024
9fec50c
Add graph inputs to open dataflow graph isomorphism
lockshaw Aug 6, 2024
7c60736
Add input permutation to evaluate_substitution_output
lockshaw Aug 6, 2024
cb6eab2
Fix permute_node_ids
lockshaw Aug 8, 2024
2f3d67a
Add test for permute_input_ids
lockshaw Aug 8, 2024
03cbd02
Migrate over to mutable implementation of apply_substitution
lockshaw Aug 23, 2024
4a8deae
Add fast isomorphism checking and an initial implementation of full s…
lockshaw Aug 24, 2024
0757e94
Pass initial full substitutions test
lockshaw Aug 24, 2024
ba0a174
Cleanup old isomorphism checking code
lockshaw Aug 24, 2024
4dfa403
Merge remote-tracking branch 'origin/repo-refactor' into substitution…
lockshaw Aug 24, 2024
f156f96
Fix post-merge bugs
lockshaw Aug 24, 2024
5f09298
Fix broken pcg builder test
lockshaw Aug 26, 2024
deff4f8
Format
lockshaw Aug 26, 2024
d71d24f
Reorganize code and remove some outdated code pre-code-review
lockshaw Aug 26, 2024
1a63f90
Format
lockshaw Aug 26, 2024
1d4ab09
Restarting work on this after working on export-model-arch
lockshaw Sep 10, 2024
7928864
Merge remote-tracking branch 'flexflow/repo-refactor' into substituti…
lockshaw Sep 10, 2024
f2c8e7b
Merge branch 'substitution-builder' into master
Jan 9, 2025
030b0e8
Merge branch 'master' into merge-substitution-builder
victorli2002 Jan 15, 2025
f5c49c7
Adding in some a simple function to get the currently available subst…
Jan 17, 2025
3e4c357
Merge branch 'master' into merge-substitution-builder
victorli2002 Jan 17, 2025
30f2b6e
Merge branch 'master' into merge-substitution-builder
lockshaw Jan 20, 2025
47cc58a
nonnegative_int additions, code cleanup, etc.
Jan 24, 2025
f8df37e
Merge remote-tracking branch 'origin/master' into victor-substitution…
lockshaw Jan 25, 2025
3728251
A bunch more moving over to nonnegative_int
lockshaw Jan 28, 2025
f27d31b
Even more nonnegative_int updating
lockshaw Jan 31, 2025
9f8762e
Fix build
lockshaw Jan 31, 2025
5edb6f0
Fix failing tests
lockshaw Feb 1, 2025
97338c7
Merge branch 'master' into merge-substitution-builder
lockshaw Feb 1, 2025
88370c0
Format
lockshaw Feb 1, 2025
9c2007e
Merge remote-tracking branch 'refs/remotes/victorli2002/merge-substit…
lockshaw Feb 1, 2025
600e074
Format
lockshaw Feb 1, 2025
0dd487c
Adding more to unity substitution set
Feb 7, 2025
1c18cdd
Merge branch 'master' into merge-substitution-builder
victorli2002 Feb 7, 2025
12f8717
Fixing unity substituion tests
Feb 10, 2025
d5c9be9
Adding more to unity substitution set
Feb 21, 2025
1394173
Merge remote-tracking branch 'origin/master' into merge-substitution-…
Feb 21, 2025
4fe85ed
Updating unity substitution set to work with new PCG interface
Feb 24, 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
Get back to substitutions, now with unordered graph inputs
  • Loading branch information
lockshaw committed Jul 7, 2024
commit cf73f08e930f1a4bae7a544f746c62e2c85f1c7e
2 changes: 2 additions & 0 deletions lib/op-attrs/test/src/ops/conv_2d.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#include "doctest/doctest.h"
#include "utils/integer_conversions.h"

using namespace ::FlexFlow;

TEST_SUITE(FF_TEST_SUITE) {
TEST_CASE("Conv2D shape inference") {
int out_channels = 4;
Expand Down
8 changes: 6 additions & 2 deletions lib/pcg/include/pcg/create_grad.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
#ifndef _FLEXFLOW_PCG_INCLUDE_PCG_CREATE_GRAD_H
#define _FLEXFLOW_PCG_INCLUDE_PCG_CREATE_GRAD_H

#include "pcg/create_grad_t.h"
#include "pcg/create_grad.dtg.h"

namespace FlexFlow {}
namespace FlexFlow {

bool bool_from_create_grad(CreateGrad);

}

#endif
37 changes: 0 additions & 37 deletions lib/pcg/include/pcg/dataflow_graph/algorithms.h

This file was deleted.

This file was deleted.

4 changes: 2 additions & 2 deletions lib/pcg/src/pcg/computation_graph_builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ TensorShape ComputationGraphBuilder::get_shape(tensor_guid_t const &t) const {
}

tensor_guid_t ComputationGraphBuilder::create_tensor(TensorShape const &shape,
bool create_grad) {
CreateGrad create_grad) {
TensorAttrs tensor_attrs =
TensorAttrs{shape, std::nullopt, create_grad, std::nullopt};
TensorAttrs{shape, std::nullopt, std::nullopt, create_grad};
LayerAttrs layer_attrs = LayerAttrs{
ComputationGraphOpAttrs{InputAttrs{}},
std::nullopt,
Expand Down
17 changes: 17 additions & 0 deletions lib/pcg/src/pcg/create_grad.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include "pcg/create_grad.h"
#include "utils/exception.h"

namespace FlexFlow {

bool bool_from_create_grad(CreateGrad cg) {
switch (cg) {
case CreateGrad::YES:
return true;
case CreateGrad::NO:
return false;
default:
throw mk_runtime_error(fmt::format("Unknown CreateGrad value {}", cg));
}
}

} // namespace FlexFlow
1 change: 0 additions & 1 deletion lib/pcg/src/pcg/dataflow_graph/algorithms.cc

This file was deleted.

76 changes: 0 additions & 76 deletions lib/pcg/test/src/pcg/dataflow_graph/algorithms.cc

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ TEST_SUITE(FF_TEST_SUITE) {
parallel_tensor_guid_t tensor3 = get_only(layer3_added.outputs);

std::vector<parallel_layer_guid_t> result = topological_ordering(pcg);
std::vector<parallel_layer_guid_t> correct = {layer1, layer2, layer3};
CHECK(result == correct);
// std::vector<parallel_layer_guid_t> correct = {layer1, layer2, layer3};
// CHECK(result == correct);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ includes = [
"substitutions/operator_pattern/operator_attribute_key.dtg.h",
"substitutions/output_graph/output_operator_attribute_expr.dtg.h",
"<unordered_map>",
"utils/hash/unordered_map.h",
]

# NOTE(@wmdi): Not sure if it aligns with other design. Or alternatively we can
Expand Down
4 changes: 2 additions & 2 deletions lib/substitutions/include/substitutions/substitution.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "sub_parallel_computation_graph.dtg.h"
#include "substitutions/substitution.dtg.h"
#include "substitutions/unlabelled/multidigraph_pattern_match.dtg.h"
#include "substitutions/unlabelled/unlabelled_dataflow_graph_pattern_match.dtg.h"

namespace FlexFlow {

Expand All @@ -12,7 +12,7 @@ bool is_valid_substitution(Substitution const &);
SubParallelComputationGraph
apply_substitution(SubParallelComputationGraph const &,
Substitution const &,
MultiDiGraphPatternMatch const &);
UnlabelledDataflowGraphPatternMatch const &);

} // namespace FlexFlow

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef _FLEXFLOW_LIB_SUBSTITUTIONS_INCLUDE_SUBSTITUTIONS_TENSOR_PATTERN_EVAL_LIST_ACCESS_H
#define _FLEXFLOW_LIB_SUBSTITUTIONS_INCLUDE_SUBSTITUTIONS_TENSOR_PATTERN_EVAL_LIST_ACCESS_H

#include "pcg/parallel_tensor_attrs.dtg.h"
#include "pcg/parallel_computation_graph/parallel_tensor_attrs.dtg.h"
#include "substitutions/tensor_pattern/tensor_attribute_list_access.dtg.h"
#include "substitutions/tensor_pattern/tensor_attribute_value.dtg.h"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef _FLEXFLOW_LIB_SUBSTITUTIONS_INCLUDE_SUBSTITUTIONS_TENSOR_PATTERN_EVAL_LIST_SIZE_H
#define _FLEXFLOW_LIB_SUBSTITUTIONS_INCLUDE_SUBSTITUTIONS_TENSOR_PATTERN_EVAL_LIST_SIZE_H

#include "pcg/parallel_tensor_attrs.dtg.h"
#include "pcg/parallel_computation_graph/parallel_tensor_attrs.dtg.h"
#include "substitutions/tensor_pattern/tensor_attribute_list_size.dtg.h"
#include "substitutions/tensor_pattern/tensor_attribute_value.dtg.h"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef _FLEXFLOW_LIB_SUBSTITUTIONS_INCLUDE_SUBSTITUTIONS_TENSOR_PATTERN_GET_ATTRIBUTE_H
#define _FLEXFLOW_LIB_SUBSTITUTIONS_INCLUDE_SUBSTITUTIONS_TENSOR_PATTERN_GET_ATTRIBUTE_H

#include "pcg/parallel_tensor_attrs.dtg.h"
#include "pcg/parallel_computation_graph/parallel_tensor_attrs.dtg.h"
#include "substitutions/tensor_pattern/tensor_attribute_key.dtg.h"
#include "substitutions/tensor_pattern/tensor_attribute_value.dtg.h"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef _FLEXFLOW_LIB_SUBSTITUTIONS_INCLUDE_SUBSTITUTIONS_TENSOR_PATTERN_SATISFIES_CONSTRAINT_H
#define _FLEXFLOW_LIB_SUBSTITUTIONS_INCLUDE_SUBSTITUTIONS_TENSOR_PATTERN_SATISFIES_CONSTRAINT_H

#include "pcg/parallel_tensor_attrs.dtg.h"
#include "pcg/parallel_computation_graph/parallel_tensor_attrs.dtg.h"
#include "substitutions/tensor_pattern/tensor_attribute_constraint.dtg.h"

namespace FlexFlow {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef _FLEXFLOW_LIB_SUBSTITUTIONS_INCLUDE_SUBSTITUTIONS_TENSOR_PATTERN_TENSOR_ATTRIBUTE_EXPR_H
#define _FLEXFLOW_LIB_SUBSTITUTIONS_INCLUDE_SUBSTITUTIONS_TENSOR_PATTERN_TENSOR_ATTRIBUTE_EXPR_H

#include "pcg/parallel_tensor_attrs.dtg.h"
#include "pcg/parallel_computation_graph/parallel_tensor_attrs.dtg.h"
#include "substitutions/tensor_pattern/tensor_attribute_expr.dtg.h"
#include "substitutions/tensor_pattern/tensor_attribute_value.dtg.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ features = [
includes = [
"<unordered_set>",
"substitutions/tensor_pattern/tensor_attribute_constraint.dtg.h",
"utils/hash-utils.h",
"utils/hash/unordered_set.h",
"utils/fmt/unordered_set.h",
]

[[fields]]
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

20 changes: 10 additions & 10 deletions lib/substitutions/include/substitutions/unlabelled/edge_splits.h
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
#ifndef _FLEXFLOW_LIB_SUBSTITUTIONS_INCLUDE_SUBSTITUTIONS_UNLABELLED_EDGE_SPLITS_H
#define _FLEXFLOW_LIB_SUBSTITUTIONS_INCLUDE_SUBSTITUTIONS_UNLABELLED_EDGE_SPLITS_H

#include "substitutions/unlabelled/closed_pattern_edge.dtg.h"
#include "substitutions/unlabelled/edge_splits.dtg.h"
#include "substitutions/unlabelled/input_pattern_edge.dtg.h"
#include "substitutions/unlabelled/output_pattern_edge.dtg.h"
// #include "substitutions/unlabelled/closed_pattern_edge.dtg.h"
// #include "substitutions/unlabelled/edge_splits.dtg.h"
// #include "substitutions/unlabelled/input_pattern_edge.dtg.h"
// #include "substitutions/unlabelled/output_pattern_edge.dtg.h"
#include <utility>

namespace FlexFlow {

std::pair<OutputPatternEdge, InputPatternEdge>
get_split_edges(UnlabelledPatternEdgeSplits const &,
ClosedPatternEdge const &);

std::vector<std::tuple<ClosedPatternEdge, OutputPatternEdge, InputPatternEdge>>
as_closed_output_input_tuples(UnlabelledPatternEdgeSplits const &);
// std::pair<OutputPatternEdge, InputPatternEdge>
// get_split_edges(UnlabelledPatternEdgeSplits const &,
// ClosedPatternEdge const &);
//
// std::vector<std::tuple<ClosedPatternEdge, OutputPatternEdge, InputPatternEdge>>
// as_closed_output_input_tuples(UnlabelledPatternEdgeSplits const &);

} // namespace FlexFlow

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
#define _FLEXFLOW_LIB_SUBSTITUTIONS_INCLUDE_SUBSTITUTIONS_UNLABELLED_FIND_PATTERN_MATCHES_H

#include "substitutions/unlabelled/match_additional_criterion.dtg.h"
#include "substitutions/unlabelled/multidigraph_pattern_match.dtg.h"
#include "substitutions/unlabelled/unlabelled_dataflow_graph_pattern_match.dtg.h"
#include "substitutions/unlabelled/unlabelled_graph_pattern.dtg.h"
#include "utils/graph.h"

namespace FlexFlow {

std::vector<MultiDiGraphPatternMatch>
std::vector<UnlabelledDataflowGraphPatternMatch>
find_pattern_matches(UnlabelledGraphPattern const &pattern,
OpenMultiDiGraphView const &graph,
OpenDataflowGraphView const &graph,
MatchAdditionalCriterion const &additional_criterion);

} // namespace FlexFlow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@
#define _FLEXFLOW_LIB_SUBSTITUTIONS_INCLUDE_SUBSTITUTIONS_UNLABELLED_INPUT_PATTERN_EDGE_H

#include "substitutions/unlabelled/input_pattern_edge.dtg.h"
#include "substitutions/unlabelled/pattern_input.dtg.h"
#include "substitutions/unlabelled/pattern_node.dtg.h"

namespace FlexFlow {

PatternInput get_src_input(InputPatternEdge const &);
PatternNode get_dst_node(InputPatternEdge const &);
int get_dst_idx(InputPatternEdge const &);

} // namespace FlexFlow

Expand Down
Loading