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
13 changes: 11 additions & 2 deletions xls/dev_tools/benchmark_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -892,8 +892,17 @@ absl::Status RealMain(std::string_view path) {
std::cout << proc_info;

if (absl::GetFlag(FLAGS_run_evaluators)) {
XLS_RETURN_IF_ERROR(
RunInterpreterAndJit(package->blocks()[0].get(), "block"));
FunctionBase* top_block = nullptr;
if (package->GetTop().has_value() &&
package->GetTop().value()->IsBlock()) {
top_block = package->GetTop().value();
} else {
XLS_RET_CHECK(!package->blocks().empty())
<< "Expected at least one block after codegen.";
top_block = package->blocks()[0].get();
}
VLOG(1) << "Evaluating block: " << top_block->name();
XLS_RETURN_IF_ERROR(RunInterpreterAndJit(top_block, "block"));
}
}

Expand Down
7 changes: 5 additions & 2 deletions xls/dev_tools/benchmark_main_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ die () {
exit 1
}

# Run the benchmark
${MY_BENCHMARK_FILE} || die "Failed in ${MY_BENCHMARK_FILE}"
# Run the benchmark and verify that block evaluation elaborates the top
# container block (ProcName) rather than blocks()[0].
BENCHMARK_LOG="${TEST_TMPDIR}/proc_network_benchmark.log"
${MY_BENCHMARK_FILE} --vmodule=benchmark_main=1 --stderrthreshold=0 2> "${BENCHMARK_LOG}" || die "Failed in ${MY_BENCHMARK_FILE}"
grep -F "Evaluating block: ProcName" "${BENCHMARK_LOG}" || die "Expected benchmark_main to evaluate top block ProcName, got: $(cat "${BENCHMARK_LOG}")"

# Verify fractional square-micron area is preserved without integer truncation.
BENCHMARK_MAIN="./xls/dev_tools/benchmark_main"
Expand Down
2 changes: 1 addition & 1 deletion xls/examples/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -1384,7 +1384,7 @@ xls_dslx_ir(
dslx_top = "Initiator",
ir_conv_args = {
"lower_to_proc_scoped_channels": "true",
"default_fifo_config": "depth: 2, bypass: true, " +
"default_fifo_config": "depth: 0, bypass: true, " +
"register_push_outputs: false, register_pop_outputs: false",
},
ir_file = "proc_network.ir",
Expand Down
8 changes: 7 additions & 1 deletion xls/examples/proc_network.x
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#![feature(channel_attributes)]
#![feature(explicit_state_access)]
#![feature(generics)]

Expand Down Expand Up @@ -86,7 +87,12 @@ impl Initiator {
fn new(ext_in: chan<s32> in, ext_out: chan<s32> out) -> Self {
let (c_ext, init_rcv) = chan<s32>("init_in_chans");
let (init_snd, a_ext) = chan<s32>("init_out_chans");
let (a_to_b1_out, a_to_b1_in) = chan<s32>("a_to_b1");

// Register push outputs on one edge shared by both the A->B->C->A and
// Initiator->A->B->C->Initiator loops so ready backpressure does not
// form a combinational cycle.
let (a_to_b1_out, a_to_b1_in) = #[channel(depth=2, bypass=true, register_push_outputs=true, register_pop_outputs=false)]
chan<s32>("a_to_b1");
let (b1_to_b2_out, b1_to_b2_in) = chan<s32>("b1_to_b2");
let (b2_to_b3_out, b2_to_b3_in) = chan<s32>("b2_to_b3");
let (b3_to_c_out, b3_to_c_in) = chan<s32>("b3_to_c");
Expand Down
Loading