Skip to content

Commit 3e6a439

Browse files
angelomatni1copybara-github
authored andcommitted
Ensure folding graph nodes and edges are ordered. Refactor the folding graph out into its own library for ease of unit testing.
PiperOrigin-RevId: 823692102
1 parent 0eabd3e commit 3e6a439

File tree

5 files changed

+749
-532
lines changed

5 files changed

+749
-532
lines changed

xls/passes/BUILD

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,13 +1035,32 @@ cc_library(
10351035
],
10361036
)
10371037

1038+
cc_library(
1039+
name = "folding_graph",
1040+
srcs = ["folding_graph.cc"],
1041+
hdrs = ["folding_graph.h"],
1042+
deps = [
1043+
"//xls/ir",
1044+
"//xls/ir:function_builder",
1045+
"//xls/ir:op",
1046+
"@com_google_absl//absl/container:flat_hash_map",
1047+
"@com_google_absl//absl/container:flat_hash_set",
1048+
"@com_google_absl//absl/log",
1049+
"@com_google_absl//absl/log:check",
1050+
"@com_google_absl//absl/types:span",
1051+
"@com_google_ortools//ortools/graph",
1052+
"@com_google_ortools//ortools/graph:cliques",
1053+
],
1054+
)
1055+
10381056
xls_pass(
10391057
name = "resource_sharing_pass",
10401058
srcs = ["resource_sharing_pass.cc"],
10411059
hdrs = ["resource_sharing_pass.h"],
10421060
pass_class = "ResourceSharingPass",
10431061
deps = [
10441062
":bdd_query_engine",
1063+
":folding_graph",
10451064
":optimization_pass",
10461065
":pass_base",
10471066
":post_dominator_analysis",
@@ -4256,6 +4275,24 @@ cc_test(
42564275
],
42574276
)
42584277

4278+
cc_test(
4279+
name = "folding_graph_test",
4280+
srcs = ["folding_graph_test.cc"],
4281+
deps = [
4282+
":folding_graph",
4283+
"//xls/common:xls_gunit_main",
4284+
"//xls/common/fuzzing:fuzztest",
4285+
"//xls/common/status:matchers",
4286+
"//xls/ir",
4287+
"//xls/ir:bits",
4288+
"//xls/ir:function_builder",
4289+
"//xls/ir:ir_test_base",
4290+
"//xls/ir:op",
4291+
"@com_google_absl//absl/types:span",
4292+
"@googletest//:gtest",
4293+
],
4294+
)
4295+
42594296
cc_test(
42604297
name = "resource_sharing_pass_test",
42614298
srcs = ["resource_sharing_pass_test.cc"],

0 commit comments

Comments
 (0)