Skip to content

xls/dev_tools/benchmark_main: Evaluate top block instead of blocks()[0] - #5373

Draft
copybara-service[bot] wants to merge 1 commit into
mainfrom
test_1018685728
Draft

copybara-service[bot] wants to merge 1 commit into
mainfrom
test_1018685728

Conversation

@copybara-service

@copybara-service copybara-service Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

xls/dev_tools/benchmark_main: Evaluate top block instead of blocks()[0]

After Codegen runs in benchmark_main, package->GetTop().value() is the top-level block, whereas package->blocks()[0] is whatever block happens to be first in the package. For multi-proc designs where a child proc is converted to a block before the stitched top-level container block is created, package->blocks()[0] evaluated only a single leaf block and skipped elaborating/benchmarking the stitched top container block.

  • Update benchmark_main.cc to evaluate package->GetTop().value() when the package top is a Block*, falling back to package->blocks()[0].get() after checking !package->blocks().empty(), and log the evaluated block name at VLOG(1).
  • Default proc_network_ir in xls/examples/BUILD to depth: 0 FIFOs and override only a_to_b1 in xls/examples/proc_network.x with #[channel(depth=2, bypass=true, register_push_outputs=true, register_pop_outputs=false)] so ready backpressure across the A -> B1 -> B2 -> B3 -> C -> A and Initiator -> A -> B1 -> B2 -> B3 -> C -> Initiator loops does not form a combinational cycle when the stitched top block ProcName is elaborated.
  • Update benchmark_main_test.sh to verify via proc_network_opt_ir_benchmark that benchmark_main evaluates ProcName rather than blocks()[0].

After `Codegen` runs in `benchmark_main`, `package->GetTop().value()` is the top-level block, whereas `package->blocks()[0]` is whatever block happens to be first in the package. For multi-proc designs where a child proc is converted to a block before the stitched top-level container block is created, `package->blocks()[0]` evaluated only a single leaf block and skipped elaborating/benchmarking the stitched top container block.

* Update `benchmark_main.cc` to evaluate `package->GetTop().value()` when the package top is a `Block*`, falling back to `package->blocks()[0].get()` after checking `!package->blocks().empty()`, and log the evaluated block name at `VLOG(1)`.
* Default `proc_network_ir` in `xls/examples/BUILD` to `depth: 0` FIFOs and override only `a_to_b1` in `xls/examples/proc_network.x` with `#[channel(depth=2, bypass=true, register_push_outputs=true, register_pop_outputs=false)]` so ready backpressure across the `A -> B1 -> B2 -> B3 -> C -> A` and `Initiator -> A -> B1 -> B2 -> B3 -> C -> Initiator` loops does not form a combinational cycle when the stitched top block `ProcName` is elaborated.
* Update `benchmark_main_test.sh` to verify via `proc_network_opt_ir_benchmark` that `benchmark_main` evaluates `ProcName` rather than `blocks()[0]`.

PiperOrigin-RevId: 1018685728
@copybara-service copybara-service Bot changed the title Evaluate top block instead of blocks()[0] in benchmark_main xls/dev_tools/benchmark_main: Evaluate top block instead of blocks()[0] Nov 20, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant