Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions xls/codegen/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,7 @@ cc_test(
"//xls/ir:value_utils",
"//xls/ir:xls_type_cc_proto",
"//xls/jit:block_jit",
"//xls/passes",
"//xls/public:ir_parser",
"//xls/scheduling:scheduling_options",
"//xls/tools:codegen",
Expand Down Expand Up @@ -1170,6 +1171,7 @@ cc_test(
"//xls/common/status:matchers",
"//xls/common/status:ret_check",
"//xls/common/status:status_macros",
"//xls/estimators",
"//xls/estimators/delay_model:delay_estimator",
"//xls/interpreter:block_evaluator",
"//xls/interpreter:ir_interpreter",
Expand All @@ -1188,6 +1190,7 @@ cc_test(
"//xls/ir:source_location",
"//xls/ir:value",
"//xls/ir:verifier",
"//xls/passes",
"//xls/scheduling:pipeline_schedule",
"//xls/scheduling:run_pipeline_schedule",
"//xls/scheduling:scheduling_options",
Expand Down Expand Up @@ -1792,6 +1795,7 @@ cc_test(
"//xls/ir:source_location",
"//xls/ir:type",
"//xls/ir:value",
"//xls/passes",
"//xls/passes:optimization_pass",
"//xls/passes:pass_base",
"//xls/scheduling:pipeline_schedule",
Expand Down
6 changes: 4 additions & 2 deletions xls/codegen/side_effect_condition_pass_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,10 @@ class SideEffectConditionPassTest
SchedulingOptions scheduling_options = kDefaultSchedulingOptions) {
// First, schedule.
OptimizationContext optimization_context;
std::unique_ptr<SchedulingPass> scheduling_pipeline =
CreateSchedulingPassPipeline(optimization_context, scheduling_options);
XLS_ASSIGN_OR_RETURN(
std::unique_ptr<SchedulingPass> scheduling_pipeline,
CreateSchedulingPassPipeline(optimization_context, scheduling_options),
_ << "Unable to create scheduling pass pipeline");
XLS_RET_CHECK(p->GetTop().has_value());
FunctionBase* top = p->GetTop().value();
auto scheduling_context =
Expand Down
4 changes: 4 additions & 0 deletions xls/codegen_v_1_5/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,10 @@ cc_test(
"//xls/common:xls_gunit_main",
"//xls/common/status:matchers",
"//xls/common/status:status_macros",
"//xls/estimators",
"//xls/ir:function_builder",
"//xls/ir:ir_test_base",
"//xls/passes",
"//xls/scheduling:scheduling_options",
"@googletest//:gtest",
],
Expand Down Expand Up @@ -292,9 +294,11 @@ cc_test(
"//xls/common/status:matchers",
"//xls/common/status:ret_check",
"//xls/common/status:status_macros",
"//xls/estimators",
"//xls/ir",
"//xls/ir:ir_parser",
"//xls/ir:ir_test_base",
"//xls/passes",
"//xls/passes:pass_base",
"//xls/scheduling:scheduling_options",
"//xls/scheduling:scheduling_result",
Expand Down
2 changes: 2 additions & 0 deletions xls/contrib/mlir/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ cc_library(
":xls_transforms_passes_inc_gen",
":xls_translate_lib",
"//xls/passes:pass_pipeline_cc_proto",
"//xls/public:passes_and_estimators",
"//xls/tools:opt",
"@com_google_absl//absl/status",
"@com_google_protobuf//:protobuf",
Expand Down Expand Up @@ -538,6 +539,7 @@ cc_library(
"//xls/public:function_builder",
"//xls/public:ir",
"//xls/public:ir_parser",
"//xls/public:passes_and_estimators",
"//xls/public:runtime_codegen_actions",
"//xls/public:runtime_dslx_actions",
"//xls/scheduling:pipeline_schedule_cc_proto",
Expand Down
1 change: 1 addition & 0 deletions xls/contrib/xlscc/unit_tests/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ cc_library(
"//xls/ir:state_element",
"//xls/ir:value",
"//xls/ir:value_utils",
"//xls/passes",
"//xls/simulation:sim_test_base",
"//xls/tools:codegen",
"//xls/tools:codegen_flags_cc_proto",
Expand Down
1 change: 1 addition & 0 deletions xls/dev_tools/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,7 @@ cc_binary(
"//xls/estimators/delay_model:delay_estimator",
"//xls/ir",
"//xls/ir:ir_parser",
"//xls/passes",
"//xls/scheduling:pipeline_schedule",
"//xls/scheduling:scheduling_options",
"//xls/scheduling:scheduling_result",
Expand Down
2 changes: 2 additions & 0 deletions xls/fuzzer/verilog_fuzzer/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ cc_test(
":verilog_fuzz_domain",
"//xls/common:xls_gunit_main",
"//xls/common/fuzzing:fuzztest",
"//xls/estimators",
"//xls/passes",
"//xls/tools:codegen_flags_cc_proto",
"//xls/tools:scheduling_options_flags_cc_proto",
"@com_google_absl//absl/status",
Expand Down
4 changes: 3 additions & 1 deletion xls/scheduling/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ cc_test(
"//xls/ir",
"//xls/ir:ir_test_base",
"//xls/ir:op",
"//xls/passes",
"//xls/passes:optimization_pass",
"//xls/passes:pass_base",
"//xls/tools:scheduling_options_flags_cc_proto",
Expand Down Expand Up @@ -454,11 +455,12 @@ cc_library(
":scheduling_options",
":scheduling_pass",
":scheduling_wrapper_pass",
"//xls/passes",
"//xls/common/status:status_macros",
"//xls/passes:dce_pass",
"//xls/passes:optimization_pass",
"//xls/passes:optimization_pass_pipeline",
"@com_google_absl//absl/log:check",
"@com_google_absl//absl/status:statusor",
],
)

Expand Down
5 changes: 3 additions & 2 deletions xls/scheduling/scheduling_options_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,9 @@ top proc main(__state: bits[1], init={0}) {
SchedulingContext sched_ctx =
SchedulingContext::CreateForWholePackage(p.get());
PassResults results;
XLS_ASSERT_OK(CreateSchedulingPassPipeline(opt_ctx, options)
->Run(p.get(), pass_options, &results, sched_ctx));
XLS_ASSERT_OK_AND_ASSIGN(auto pipeline,
CreateSchedulingPassPipeline(opt_ctx, options));
XLS_ASSERT_OK(pipeline->Run(p.get(), pass_options, &results, sched_ctx));
XLS_ASSERT_OK_AND_ASSIGN(Proc * proc, p->GetTopAsProc());
EXPECT_EQ(NumberOfOp(proc, Op::kSend), merge_on_mutual_exclusion ? 1 : 2);
}
Expand Down
18 changes: 11 additions & 7 deletions xls/scheduling/scheduling_pass_pipeline.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <utility>

#include "absl/log/check.h"
#include "xls/common/status/status_macros.h"
#include "xls/passes/dce_pass.h"
#include "xls/passes/optimization_pass.h"
#include "xls/passes/optimization_pass_pipeline.h"
Expand All @@ -34,8 +35,9 @@

namespace xls {

std::unique_ptr<SchedulingCompoundPass> CreateSchedulingPassPipeline(
OptimizationContext& context, const SchedulingOptions& options) {
absl::StatusOr<std::unique_ptr<SchedulingCompoundPass>>
CreateSchedulingPassPipeline(OptimizationContext& context,
const SchedulingOptions& options) {
auto top = std::make_unique<SchedulingCompoundPass>(
"scheduling", "Top level scheduling pass pipeline");
top->AddInvariantChecker<SchedulingChecker>();
Expand All @@ -53,11 +55,13 @@ std::unique_ptr<SchedulingCompoundPass> CreateSchedulingPassPipeline(
// TODO(allight): We might want to move this pre-scheduling mutex pass (and
// the earlier legalization pass) into the opt-main pipeline to avoid
// needing to do this.
auto pipeline =
GetOptimizationPipelineGenerator().GeneratePipeline("scheduling-opt");
CHECK_OK(pipeline.status())
<< "Unable to create scheduling-opt pass. This is a bug.";
top->Add<SchedulingWrapperPass>(*std::move(pipeline), context,
XLS_ASSIGN_OR_RETURN(
auto pipeline,
GetOptimizationPipelineGenerator().GeneratePipeline("scheduling-opt"),
_ << "Unable to create scheduling-opt pass. The linked passes must "
"include a pass named 'scheduling-opt'. Did you link "
"'//xls/passes'?");
top->Add<SchedulingWrapperPass>(std::move(pipeline), context,
options.opt_level(), eliminate_noop_next);
}
top->Add<SchedulingWrapperPass>(std::make_unique<DeadCodeEliminationPass>(),
Expand Down
6 changes: 4 additions & 2 deletions xls/scheduling/scheduling_pass_pipeline.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,17 @@

#include <memory>

#include "absl/status/statusor.h"
#include "xls/passes/optimization_pass.h"
#include "xls/scheduling/scheduling_options.h"
#include "xls/scheduling/scheduling_pass.h"

namespace xls {

// Returns the scheduling pass pipeline which runs on a package.
std::unique_ptr<SchedulingCompoundPass> CreateSchedulingPassPipeline(
OptimizationContext& context, const SchedulingOptions& options);
absl::StatusOr<std::unique_ptr<SchedulingCompoundPass>>
CreateSchedulingPassPipeline(OptimizationContext& context,
const SchedulingOptions& options);

} // namespace xls

Expand Down
5 changes: 3 additions & 2 deletions xls/tools/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,6 @@ cc_library(
"//xls/ir:ir_parser",
"//xls/ir:ram_rewrite_cc_proto",
"//xls/ir:verifier",
"//xls/passes",
"//xls/passes:optimization_pass",
"//xls/passes:optimization_pass_pipeline",
"//xls/passes:optimization_pass_pipeline_cc_proto",
Expand Down Expand Up @@ -785,6 +784,7 @@ cc_binary(
"//xls/estimators",
"//xls/ir:ir_parser",
"//xls/ir:verifier",
"//xls/passes",
"//xls/scheduling:pipeline_schedule",
"//xls/scheduling:scheduling_options",
"//xls/scheduling:scheduling_result",
Expand Down Expand Up @@ -1135,8 +1135,9 @@ cc_binary(
"//xls/common:init_xls",
"//xls/common/status:status_macros",
"//xls/dev_tools:tool_timeout",
"//xls/estimators/delay_model/models",
"//xls/estimators",
"//xls/fdo:grpc_synthesizer",
"//xls/passes",
"@com_google_absl//absl/log",
"@com_google_absl//absl/status",
"@com_google_absl//absl/strings:str_format",
Expand Down
5 changes: 3 additions & 2 deletions xls/tools/codegen.cc
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,9 @@ absl::StatusOr<SchedulingResult> RunSchedulingPipeline(
sched_options.delay_estimator = delay_estimator;
sched_options.synthesizer = synthesizer;
OptimizationContext optimization_context;
std::unique_ptr<SchedulingCompoundPass> scheduling_pipeline =
CreateSchedulingPassPipeline(optimization_context, scheduling_options);
XLS_ASSIGN_OR_RETURN(
std::unique_ptr<SchedulingCompoundPass> scheduling_pipeline,
CreateSchedulingPassPipeline(optimization_context, scheduling_options));
XLS_RETURN_IF_ERROR(main->package()->SetTop(main));
auto scheduling_context =
(scheduling_options.schedule_all_procs())
Expand Down
Loading