Skip to content

Commit

Permalink
Move IR minimizer from xls/tools to xls/dev_tools.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 671512083
  • Loading branch information
meheffernan authored and copybara-github committed Sep 5, 2024
1 parent 81edb71 commit d6e14d2
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 83 deletions.
2 changes: 1 addition & 1 deletion docs_src/tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ between versions. If possible, LLVM tools built at the same commit as the JIT
should be used to interact with the generated llvm bytecode. This can be done by
building the LLVM tools using `bazel build` from the XLS repo.
## [`ir_minimizer_main`](https://github.com/google/xls/tree/main/xls/tools/ir_minimizer_main.cc)
## [`ir_minimizer_main`](https://github.com/google/xls/tree/main/xls/dev_tools/ir_minimizer_main.cc)
Tool for reducing IR to a minimal test case based on an external test.
Expand Down
79 changes: 79 additions & 0 deletions xls/dev_tools/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -527,3 +527,82 @@ filegroup(
srcs = ["check_ir_equivalence.sh"],
visibility = ["//xls:xls_users"],
)

cc_binary(
name = "ir_minimizer_main",
srcs = ["ir_minimizer_main.cc"],
data = [
"//xls/tools:opt_main",
],
deps = [
"@com_google_absl//absl/algorithm:container",
"@com_google_absl//absl/container:btree",
"@com_google_absl//absl/container:flat_hash_map",
"@com_google_absl//absl/container:flat_hash_set",
"@com_google_absl//absl/flags:flag",
"@com_google_absl//absl/log",
"@com_google_absl//absl/log:check",
"@com_google_absl//absl/random:bit_gen_ref",
"@com_google_absl//absl/random:distributions",
"@com_google_absl//absl/status",
"@com_google_absl//absl/status:statusor",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/strings:str_format",
"@com_google_absl//absl/types:span",
"//xls/common:exit_status",
"//xls/common:init_xls",
"//xls/common:subprocess",
"//xls/common/file:filesystem",
"//xls/common/file:temp_file",
"//xls/common/logging:log_lines",
"//xls/common/status:ret_check",
"//xls/common/status:status_macros",
"//xls/data_structures:binary_search",
"//xls/data_structures:inline_bitmap",
"//xls/dev_tools:extract_segment",
"//xls/interpreter:ir_interpreter",
"//xls/ir",
"//xls/ir:channel",
"//xls/ir:channel_ops",
"//xls/ir:events",
"//xls/ir:function_builder",
"//xls/ir:ir_parser",
"//xls/ir:node_util",
"//xls/ir:op",
"//xls/ir:source_location",
"//xls/ir:type",
"//xls/ir:value",
"//xls/ir:value_utils",
"//xls/ir:verifier",
"//xls/jit:function_jit",
"//xls/passes:arith_simplification_pass",
"//xls/passes:array_simplification_pass",
"//xls/passes:bit_slice_simplification_pass",
"//xls/passes:concat_simplification_pass",
"//xls/passes:constant_folding_pass",
"//xls/passes:cse_pass",
"//xls/passes:dataflow_simplification_pass",
"//xls/passes:dce_pass",
"//xls/passes:dfe_pass",
"//xls/passes:inlining_pass",
"//xls/passes:map_inlining_pass",
"//xls/passes:optimization_pass",
"//xls/passes:optimization_pass_pipeline",
"//xls/passes:pass_base",
"//xls/passes:proc_state_flattening_pass",
"//xls/passes:proc_state_optimization_pass",
"//xls/passes:unroll_pass",
],
)

py_test(
name = "ir_minimizer_main_test",
srcs = ["ir_minimizer_main_test.py"],
data = ["ir_minimizer_main"],
python_version = "PY3",
srcs_version = "PY3",
deps = [
"@com_google_absl_py//absl/testing:absltest",
"//xls/common:runfiles",
],
)
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from absl.testing import absltest
from xls.common import runfiles

IR_MINIMIZER_MAIN_PATH = runfiles.get_path('xls/tools/ir_minimizer_main')
IR_MINIMIZER_MAIN_PATH = runfiles.get_path('xls/dev_tools/ir_minimizer_main')

ADD_IR = """package foo
Expand Down
2 changes: 1 addition & 1 deletion xls/fuzzer/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,7 @@ cc_library(
data = [
":find_failing_input_main",
":sample_runner_main",
"//xls/tools:ir_minimizer_main",
"//xls/dev_tools:ir_minimizer_main",
],
deps = [
":sample",
Expand Down
2 changes: 1 addition & 1 deletion xls/fuzzer/cpp_run_fuzz.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace xls {
namespace {

absl::StatusOr<std::filesystem::path> GetIrMinimizerMainPath() {
return GetXlsRunfilePath("xls/tools/ir_minimizer_main");
return GetXlsRunfilePath("xls/dev_tools/ir_minimizer_main");
}

absl::StatusOr<std::filesystem::path> GetSampleRunnerMainPath() {
Expand Down
79 changes: 0 additions & 79 deletions xls/tools/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -460,73 +460,6 @@ py_test(
],
)

cc_binary(
name = "ir_minimizer_main",
srcs = ["ir_minimizer_main.cc"],
data = [
":opt_main",
],
deps = [
"//xls/common:exit_status",
"//xls/common:init_xls",
"//xls/common:subprocess",
"//xls/common/file:filesystem",
"//xls/common/file:temp_file",
"//xls/common/logging:log_lines",
"//xls/common/status:ret_check",
"//xls/common/status:status_macros",
"//xls/data_structures:binary_search",
"//xls/data_structures:inline_bitmap",
"//xls/dev_tools:extract_segment",
"//xls/interpreter:ir_interpreter",
"//xls/ir",
"//xls/ir:channel",
"//xls/ir:channel_ops",
"//xls/ir:events",
"//xls/ir:function_builder",
"//xls/ir:ir_parser",
"//xls/ir:node_util",
"//xls/ir:op",
"//xls/ir:source_location",
"//xls/ir:type",
"//xls/ir:value",
"//xls/ir:value_utils",
"//xls/ir:verifier",
"//xls/jit:function_jit",
"//xls/passes:arith_simplification_pass",
"//xls/passes:array_simplification_pass",
"//xls/passes:bit_slice_simplification_pass",
"//xls/passes:concat_simplification_pass",
"//xls/passes:constant_folding_pass",
"//xls/passes:cse_pass",
"//xls/passes:dataflow_simplification_pass",
"//xls/passes:dce_pass",
"//xls/passes:dfe_pass",
"//xls/passes:inlining_pass",
"//xls/passes:map_inlining_pass",
"//xls/passes:optimization_pass",
"//xls/passes:optimization_pass_pipeline",
"//xls/passes:pass_base",
"//xls/passes:proc_state_flattening_pass",
"//xls/passes:proc_state_optimization_pass",
"//xls/passes:unroll_pass",
"@com_google_absl//absl/algorithm:container",
"@com_google_absl//absl/container:btree",
"@com_google_absl//absl/container:flat_hash_map",
"@com_google_absl//absl/container:flat_hash_set",
"@com_google_absl//absl/flags:flag",
"@com_google_absl//absl/log",
"@com_google_absl//absl/log:check",
"@com_google_absl//absl/random:bit_gen_ref",
"@com_google_absl//absl/random:distributions",
"@com_google_absl//absl/status",
"@com_google_absl//absl/status:statusor",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/strings:str_format",
"@com_google_absl//absl/types:span",
],
)

py_test(
name = "mul_folding_overlarge",
srcs = ["run_opt_main.py"],
Expand Down Expand Up @@ -929,18 +862,6 @@ cc_binary(
],
)

py_test(
name = "ir_minimizer_main_test",
srcs = ["ir_minimizer_main_test.py"],
data = ["ir_minimizer_main"],
python_version = "PY3",
srcs_version = "PY3",
deps = [
"//xls/common:runfiles",
"@com_google_absl_py//absl/testing:absltest",
],
)

# TODO(b/147004555): Add a JIT (or legacy) version of this test once
# the JIT supports enough functionality to pass.
py_test(
Expand Down

0 comments on commit d6e14d2

Please sign in to comment.