Skip to content

perf(native): task deduplication compares whole execution units for every trigger #1982

Closed

Description

@tignear

The native backend spends most of a large design's compile time comparing execution units for task deduplication.

On rtlmeter C906 (integration build of master feba1a5 + #1954 + #1950, release, --two-state), a 4000-cycle probe ran for 19+ minutes without reaching the first testbench output. A 15 s perf record of the process showed:

__memcmp_evex_movbe 54.8%
HashMap<BlockId, BasicBlock> PartialEq::eq 35.7%
backend::native::backend::compile_program 6.8%
SIRTerminator PartialEq::eq 2.7%

collect_comb_apply_compile_tasks and collect_ff_compile_tasks_from (crates/celox/src/backend/native/backend.rs) find an existing task for each trigger with tasks.iter().position(|task| task.units == unit_refs). unit_refs is a Vec<&ExecutionUnit>, so == compares the units deeply, block by block. In the unfused comb-apply case every task starts with all of eval_comb, so each comparison walks the whole combinational program, and the linear search makes it O(triggers² × program size).

Expected

Deduplication cost proportional to the number of triggers (for example, compare unit identity first or key tasks by a hash), with the same set of compiled tasks and bindings as today. Generated code must not change.

Activity

  1. added a commit that references this issue on Oct 25, 2026
    f52c00e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions