Skip to content

Commit

Permalink
Make internal channel operations ignore IO delay.
Browse files Browse the repository at this point in the history
Ref: google#1804
PiperOrigin-RevId: 707617835
  • Loading branch information
grebe authored and copybara-github committed Dec 18, 2024
1 parent d25e26e commit b846c8d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
3 changes: 3 additions & 0 deletions xls/scheduling/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ cc_library(
"//xls/fdo:iterative_sdc_scheduler",
"//xls/fdo:synthesizer",
"//xls/ir",
"//xls/ir:channel",
"//xls/ir:channel_ops",
"//xls/ir:node_util",
"//xls/ir:op",
"@com_google_absl//absl/algorithm:container",
"@com_google_absl//absl/base:log_severity",
Expand Down
15 changes: 15 additions & 0 deletions xls/scheduling/run_pipeline_schedule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,12 @@
#include "xls/fdo/delay_manager.h"
#include "xls/fdo/iterative_sdc_scheduler.h"
#include "xls/fdo/synthesizer.h"
#include "xls/ir/channel.h"
#include "xls/ir/channel_ops.h"
#include "xls/ir/function.h"
#include "xls/ir/function_base.h"
#include "xls/ir/node.h"
#include "xls/ir/node_util.h"
#include "xls/ir/nodes.h"
#include "xls/ir/op.h"
#include "xls/ir/proc.h"
Expand Down Expand Up @@ -344,6 +347,18 @@ absl::StatusOr<PipelineSchedule> RunPipelineSchedule(
DecoratingDelayEstimator io_delay_added(
"io_delay_added", delay_estimator, [&](Node* node, int64_t base_delay) {
if (node->Is<ChannelNode>()) {
if (options.schedule_all_procs()) {
// If we are scheduling all procs, don't add any delay to internal
// send/receive operations.
// TODO: google/xls#1804 - ideally, we'd constrain (send,recv) pairs
// on internal channels such that the scheduler can trade off delay
// across procs.
absl::StatusOr<Channel*> chan = GetChannelUsedByNode(node);
CHECK_OK(chan.status());
if ((*chan)->supported_ops() == ChannelOps::kSendReceive) {
return base_delay;
}
}
return base_delay + max_io_delay;
}
if (node->function_base()->IsFunction()) {
Expand Down

0 comments on commit b846c8d

Please sign in to comment.