diff --git a/docs_src/bazel_rules_macros.md b/docs_src/bazel_rules_macros.md index 1cbff29f51..dcde2f87ba 100755 --- a/docs_src/bazel_rules_macros.md +++ b/docs_src/bazel_rules_macros.md @@ -327,7 +327,7 @@ Examples: | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | | name | A unique name for this target. | Name | required | | -| benchmark_ir_args | Arguments of the benchmark IR tool. For details on the arguments, refer to the benchmark_main application at //xls/tools/benchmark_main.cc. | Dictionary: String -> String | optional | `{}` | +| benchmark_ir_args | Arguments of the benchmark IR tool. For details on the arguments, refer to the benchmark_main application at //xls/dev_tools/benchmark_main.cc. | Dictionary: String -> String | optional | `{}` | | dep | The xls_dslx_opt_ir target to test. | Label | optional | `None` | | dslx_test_args | Arguments of the DSLX interpreter executable. For details on the arguments, refer to the interpreter_main application at //xls/dslx/interpreter_main.cc. | Dictionary: String -> String | optional | `{}` | | expect_equivalent | If true this test fails if IRs are not equivalent. If false the test only passes if the IRs are not equivalent. | Boolean | optional | `True` | @@ -335,7 +335,7 @@ Examples: | input_validator_expr | The expression to validate an input for the test function. Mutually exclusive with "input_validator". | String | optional | `""` | | ir_equivalence_args | Arguments of the IR equivalence tool. For details on the arguments, refer to the check_ir_equivalence_main application at //xls/dev_tools/check_ir_equivalence_main.cc. The 'function' argument is not assigned using this attribute. | Dictionary: String -> String | optional | `{}` | | ir_eval_args | Arguments of the IR interpreter. For details on the arguments, refer to the eval_ir_main application at //xls/tools/eval_ir_main.cc.The 'top' argument is not assigned using this attribute. | Dictionary: String -> String | optional | `{"random_inputs": "100", "optimize_ir": "true"}` | -| scheduling_options_proto | Protobuf filename of scheduling arguments to the benchmark IR tool. For details on the arguments, refer to the benchmark_main application at //xls/tools/benchmark_main.cc. | Label | optional | `None` | +| scheduling_options_proto | Protobuf filename of scheduling arguments to the benchmark IR tool. For details on the arguments, refer to the benchmark_main application at //xls/dev_tools/benchmark_main.cc. | Label | optional | `None` | | top | The (*mangled*) name of the entry point. See get_mangled_ir_symbol. Defines the 'top' argument of the IR tool/application. | String | optional | `""` | @@ -706,7 +706,7 @@ Examples: refer to the codegen_main application at //xls/tools/codegen_main.cc. benchmark_ir_args: Arguments of the benchmark IR tool. For details on the arguments, refer - to the benchmark_main application at //xls/tools/benchmark_main.cc. + to the benchmark_main application at //xls/dev_tools/benchmark_main.cc. standard_cells: Label for the PDK (possibly specifying a non-default corner), with the assumption that $location will return the timing (Liberty) library for the PDK corner. Unused if synthesize == False. diff --git a/docs_src/delay_estimation.md b/docs_src/delay_estimation.md index 9433220c3f..cf6c11cc38 100644 --- a/docs_src/delay_estimation.md +++ b/docs_src/delay_estimation.md @@ -313,7 +313,7 @@ given IR should be in a form suitable for code generation; e.g. it has run through the `opt_main` binary). ``` -$ bazel run -c opt //xls/tools:benchmark_main -- $PWD/bazel-bin/xls/examples/crc32.opt.ir --clock_period_ps=500 --delay_model=sky130 +$ bazel run -c opt //xls/dev_tools:benchmark_main -- $PWD/bazel-bin/xls/examples/crc32.opt.ir --clock_period_ps=500 --delay_model=sky130 Critical path delay: 8351ps Critical path entry count: 43 diff --git a/docs_src/tools.md b/docs_src/tools.md index a0a0fa9d9c..717da4c185 100644 --- a/docs_src/tools.md +++ b/docs_src/tools.md @@ -9,7 +9,7 @@ various statistics about the BDD. BDD construction can be very slow in pathological cases and this utility is useful for identifying the underlying causes. Accepts arbitrary IR as input or a benchmark specified by name. -## [`benchmark_main`](https://github.com/google/xls/tree/main/xls/tools/benchmark_main.cc) +## [`benchmark_main`](https://github.com/google/xls/tree/main/xls/dev_tools/benchmark_main.cc) Prints numerous metrics and other information about an XLS IR file including: total delay, critical path, codegen information, optimization time, etc. This @@ -17,7 +17,7 @@ tool may be run against arbitrary IR not just the fixed set of XLS benchmarks. The output of this tool is scraped by `run_benchmarks` to construct a table comparing metrics against a mint CL across the benchmark suite. -## [`booleanify_main`](https://github.com/google/xls/tree/main/xls/tools/booleanify_main.cc) +## [`booleanify_main`](https://github.com/google/xls/tree/main/xls/dev_tools/booleanify_main.cc) Rewrites an XLS IR function in terms of its ops' fundamental AND/OR/NOT constituents, i.e., makes all operations boolean, thus it's "booleanifying" the diff --git a/xls/build_rules/xls_ir_rules.bzl b/xls/build_rules/xls_ir_rules.bzl index a2b000025f..574c7f26a5 100644 --- a/xls/build_rules/xls_ir_rules.bzl +++ b/xls/build_rules/xls_ir_rules.bzl @@ -1075,14 +1075,14 @@ xls_benchmark_ir_attrs = { "benchmark_ir_args": attr.string_dict( doc = "Arguments of the benchmark IR tool. For details on the " + "arguments, refer to the benchmark_main application at " + - "//xls/tools/benchmark_main.cc.", + "//xls/dev_tools/benchmark_main.cc.", ), "scheduling_options_proto": attr.label( allow_single_file = True, default = None, doc = "Protobuf filename of scheduling arguments to the benchmark IR tool. " + "For details on the arguments, refer to the benchmark_main application at " + - "//xls/tools/benchmark_main.cc.", + "//xls/dev_tools/benchmark_main.cc.", ), } diff --git a/xls/build_rules/xls_macros.bzl b/xls/build_rules/xls_macros.bzl index 9597cbaae5..b3f65a151d 100644 --- a/xls/build_rules/xls_macros.bzl +++ b/xls/build_rules/xls_macros.bzl @@ -537,7 +537,7 @@ Examples: refer to the codegen_main application at //xls/tools/codegen_main.cc. benchmark_ir_args: Arguments of the benchmark IR tool. For details on the arguments, refer - to the benchmark_main application at //xls/tools/benchmark_main.cc. + to the benchmark_main application at //xls/dev_tools/benchmark_main.cc. standard_cells: Label for the PDK (possibly specifying a non-default corner), with the assumption that $location will return the timing (Liberty) library for the PDK corner. Unused if synthesize == False. diff --git a/xls/build_rules/xls_toolchains.bzl b/xls/build_rules/xls_toolchains.bzl index e6c7b8e73b..4154bb4d08 100644 --- a/xls/build_rules/xls_toolchains.bzl +++ b/xls/build_rules/xls_toolchains.bzl @@ -37,9 +37,9 @@ _DEFAULT_IR_EQUIVALENCE_TARGET = "//xls/dev_tools:check_ir_equivalence_main" _DEFAULT_EVAL_IR_TARGET = "//xls/tools:eval_ir_main" -_DEFAULT_BENCHMARK_TARGET = "//xls/tools:benchmark_main" +_DEFAULT_BENCHMARK_TARGET = "//xls/dev_tools:benchmark_main" -_DEFAULT_BENCHMARK_CODEGEN_TARGET = "//xls/tools:benchmark_codegen_main" +_DEFAULT_BENCHMARK_CODEGEN_TARGET = "//xls/dev_tools:benchmark_codegen_main" _DEFAULT_CODEGEN_TARGET = "//xls/tools:codegen_main" diff --git a/xls/dev_tools/BUILD b/xls/dev_tools/BUILD index 6c6656a71b..81d871d16e 100644 --- a/xls/dev_tools/BUILD +++ b/xls/dev_tools/BUILD @@ -606,3 +606,125 @@ py_test( "//xls/common:runfiles", ], ) + +filegroup( + name = "benchmark_test_sh", + srcs = ["benchmark_test.sh"], + visibility = ["//xls:xls_users"], +) + +filegroup( + name = "benchmark_eval_test_sh", + srcs = ["benchmark_eval_test.sh"], + visibility = ["//xls:xls_users"], +) + +cc_binary( + name = "benchmark_main", + srcs = ["benchmark_main.cc"], + visibility = ["//xls:xls_users"], + deps = [ + "@com_google_absl//absl/algorithm:container", + "@com_google_absl//absl/container:flat_hash_map", + "@com_google_absl//absl/flags:flag", + "@com_google_absl//absl/log", + "@com_google_absl//absl/log:check", + "@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/time", + "@com_google_absl//absl/types:span", + "//xls/codegen:module_signature", + "//xls/common:exit_status", + "//xls/common:init_xls", + "//xls/common/file:filesystem", + "//xls/common/status:ret_check", + "//xls/common/status:status_macros", + "//xls/data_structures:binary_decision_diagram", + "//xls/estimators/delay_model:analyze_critical_path", + "//xls/estimators/delay_model:delay_estimator", + "//xls/estimators/delay_model:delay_estimators", + "//xls/fdo:grpc_synthesizer", + "//xls/fdo:synthesized_delay_diff_utils", + "//xls/fdo:synthesizer", + "//xls/interpreter:block_evaluator", + "//xls/interpreter:ir_interpreter", + "//xls/interpreter:random_value", + "//xls/ir", + "//xls/ir:events", + "//xls/ir:ir_parser", + "//xls/ir:op", + "//xls/ir:type", + "//xls/ir:value", + "//xls/jit:block_jit", + "//xls/jit:function_jit", + "//xls/jit:jit_channel_queue", + "//xls/jit:jit_runtime", + "//xls/jit:orc_jit", + "//xls/jit:proc_jit", + "//xls/passes:bdd_function", + "//xls/passes:bdd_query_engine", + "//xls/passes:optimization_pass", + "//xls/passes:optimization_pass_pipeline", + "//xls/passes:pass_base", + "//xls/passes:query_engine", + "//xls/scheduling:pipeline_schedule", + "//xls/tools:codegen", + "//xls/tools:codegen_flags", + "//xls/tools:codegen_flags_cc_proto", + "//xls/tools:scheduling_options_flags", + "//xls/tools:scheduling_options_flags_cc_proto", + ], +) + +cc_binary( + name = "benchmark_codegen_main", + srcs = ["benchmark_codegen_main.cc"], + deps = [ + "@com_google_absl//absl/flags:flag", + "@com_google_absl//absl/log", + "@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/time", + "//xls/codegen:block_metrics", + "//xls/codegen:codegen_options", + "//xls/codegen:combinational_generator", + "//xls/codegen:module_signature", + "//xls/codegen:pipeline_generator", + "//xls/codegen:xls_metrics_cc_proto", + "//xls/common:exit_status", + "//xls/common:init_xls", + "//xls/common/file:filesystem", + "//xls/common/status:ret_check", + "//xls/common/status:status_macros", + "//xls/estimators/delay_model:delay_estimator", + "//xls/ir", + "//xls/ir:ir_parser", + "//xls/scheduling:pipeline_schedule", + "//xls/scheduling:run_pipeline_schedule", + "//xls/scheduling:scheduling_options", + "//xls/tools:codegen", + "//xls/tools:codegen_flags", + "//xls/tools:codegen_flags_cc_proto", + "//xls/tools:scheduling_options_flags", + "//xls/tools:scheduling_options_flags_cc_proto", + ], +) + +py_test( + name = "benchmark_codegen_main_test", + srcs = ["benchmark_codegen_main_test.py"], + data = [ + ":benchmark_codegen_main", + ], + python_version = "PY3", + srcs_version = "PY3", + deps = [ + "@com_google_absl_py//absl/testing:absltest", + "//xls/common:runfiles", + "//xls/common:test_base", + ], +) diff --git a/xls/tools/benchmark_codegen_main.cc b/xls/dev_tools/benchmark_codegen_main.cc similarity index 100% rename from xls/tools/benchmark_codegen_main.cc rename to xls/dev_tools/benchmark_codegen_main.cc diff --git a/xls/tools/benchmark_codegen_main_test.py b/xls/dev_tools/benchmark_codegen_main_test.py similarity index 99% rename from xls/tools/benchmark_codegen_main_test.py rename to xls/dev_tools/benchmark_codegen_main_test.py index 9a3f405457..7591f47bbb 100644 --- a/xls/tools/benchmark_codegen_main_test.py +++ b/xls/dev_tools/benchmark_codegen_main_test.py @@ -21,7 +21,7 @@ from xls.common import test_base BENCHMARK_CODEGEN_MAIN_PATH = runfiles.get_path( - 'xls/tools/benchmark_codegen_main' + 'xls/dev_tools/benchmark_codegen_main' ) OPT_IR = """package add diff --git a/xls/tools/benchmark_eval_test.sh b/xls/dev_tools/benchmark_eval_test.sh similarity index 100% rename from xls/tools/benchmark_eval_test.sh rename to xls/dev_tools/benchmark_eval_test.sh diff --git a/xls/tools/benchmark_main.cc b/xls/dev_tools/benchmark_main.cc similarity index 100% rename from xls/tools/benchmark_main.cc rename to xls/dev_tools/benchmark_main.cc diff --git a/xls/tools/benchmark_test.sh b/xls/dev_tools/benchmark_test.sh similarity index 95% rename from xls/tools/benchmark_test.sh rename to xls/dev_tools/benchmark_test.sh index 2e0f7fa334..c2f0347664 100755 --- a/xls/tools/benchmark_test.sh +++ b/xls/dev_tools/benchmark_test.sh @@ -14,6 +14,6 @@ # limitations under the License. -./xls/tools/benchmark_main \ +./xls/dev_tools/benchmark_main \ --vmodule=delay_estimator_main=1 --alsologtostderr "$@" || exit -1 echo "PASS!" diff --git a/xls/dev_tools/check_examples_have_targets.py b/xls/dev_tools/check_examples_have_targets.py index a87f262993..70beadf200 100644 --- a/xls/dev_tools/check_examples_have_targets.py +++ b/xls/dev_tools/check_examples_have_targets.py @@ -164,8 +164,8 @@ def test_collect_x_files_for_library(): - - + + diff --git a/xls/tools/BUILD b/xls/tools/BUILD index e76a64f6a5..8a63dd67df 100644 --- a/xls/tools/BUILD +++ b/xls/tools/BUILD @@ -791,77 +791,6 @@ py_test( ], ) -filegroup( - name = "benchmark_test_sh", - srcs = ["benchmark_test.sh"], - visibility = ["//xls:xls_users"], -) - -filegroup( - name = "benchmark_eval_test_sh", - srcs = ["benchmark_eval_test.sh"], - visibility = ["//xls:xls_users"], -) - -cc_binary( - name = "benchmark_main", - srcs = ["benchmark_main.cc"], - visibility = ["//xls:xls_users"], - deps = [ - ":codegen", - ":codegen_flags", - ":codegen_flags_cc_proto", - ":scheduling_options_flags", - ":scheduling_options_flags_cc_proto", - "//xls/codegen:module_signature", - "//xls/common:exit_status", - "//xls/common:init_xls", - "//xls/common/file:filesystem", - "//xls/common/status:ret_check", - "//xls/common/status:status_macros", - "//xls/data_structures:binary_decision_diagram", - "//xls/estimators/delay_model:analyze_critical_path", - "//xls/estimators/delay_model:delay_estimator", - "//xls/estimators/delay_model:delay_estimators", - "//xls/fdo:grpc_synthesizer", - "//xls/fdo:synthesized_delay_diff_utils", - "//xls/fdo:synthesizer", - "//xls/interpreter:block_evaluator", - "//xls/interpreter:ir_interpreter", - "//xls/interpreter:random_value", - "//xls/ir", - "//xls/ir:events", - "//xls/ir:ir_parser", - "//xls/ir:op", - "//xls/ir:type", - "//xls/ir:value", - "//xls/jit:block_jit", - "//xls/jit:function_jit", - "//xls/jit:jit_channel_queue", - "//xls/jit:jit_runtime", - "//xls/jit:orc_jit", - "//xls/jit:proc_jit", - "//xls/passes:bdd_function", - "//xls/passes:bdd_query_engine", - "//xls/passes:optimization_pass", - "//xls/passes:optimization_pass_pipeline", - "//xls/passes:pass_base", - "//xls/passes:query_engine", - "//xls/scheduling:pipeline_schedule", - "@com_google_absl//absl/algorithm:container", - "@com_google_absl//absl/container:flat_hash_map", - "@com_google_absl//absl/flags:flag", - "@com_google_absl//absl/log", - "@com_google_absl//absl/log:check", - "@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/time", - "@com_google_absl//absl/types:span", - ], -) - # TODO(b/147004555): Add a JIT (or legacy) version of this test once # the JIT supports enough functionality to pass. py_test( @@ -1117,57 +1046,6 @@ cc_binary( ], ) -cc_binary( - name = "benchmark_codegen_main", - srcs = ["benchmark_codegen_main.cc"], - deps = [ - ":codegen", - ":codegen_flags", - ":codegen_flags_cc_proto", - ":scheduling_options_flags", - ":scheduling_options_flags_cc_proto", - "//xls/codegen:block_metrics", - "//xls/codegen:codegen_options", - "//xls/codegen:combinational_generator", - "//xls/codegen:module_signature", - "//xls/codegen:pipeline_generator", - "//xls/codegen:xls_metrics_cc_proto", - "//xls/common:exit_status", - "//xls/common:init_xls", - "//xls/common/file:filesystem", - "//xls/common/status:ret_check", - "//xls/common/status:status_macros", - "//xls/estimators/delay_model:delay_estimator", - "//xls/ir", - "//xls/ir:ir_parser", - "//xls/scheduling:pipeline_schedule", - "//xls/scheduling:run_pipeline_schedule", - "//xls/scheduling:scheduling_options", - "@com_google_absl//absl/flags:flag", - "@com_google_absl//absl/log", - "@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/time", - ], -) - -py_test( - name = "benchmark_codegen_main_test", - srcs = ["benchmark_codegen_main_test.py"], - data = [ - ":benchmark_codegen_main", - ], - python_version = "PY3", - srcs_version = "PY3", - deps = [ - "//xls/common:runfiles", - "//xls/common:test_base", - "@com_google_absl_py//absl/testing:absltest", - ], -) - py_test( name = "delay_info_main_test", srcs = ["delay_info_main_test.py"],