llvm / llvm/circt

[ExportVerilog] Improve concurrency approach for performance

Open
#2,330 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
2.2k
Forks
524
Avg merge
3d 2h
Merged PRs (30d)
46

Description

We use a parallel foreach loop for the bulk of the work in export verilog which works reasonably well, except when you have a large module near the end of the circuit. The issue is that you get one worker handling the long talk large module because it gets kicked off late.

To help this, we should get an approximate side for each module in the early prepare pass, and sort the "modules to be processed" vector by size (so largest modules are at the beginning). This will reduce the amount of long tail work one a single core.

This pattern would be useful to generalize to other passes as well, but ExportVerilog seems the most egregious and already has multiple passes.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the ExportVerilog implementation, its early prepare pass, and the parallel foreach over modules. Inspect how the modules-to-be-processed vector is built and identify where approximate module sizes can be computed. Done means processing order uses those sizes so the largest modules begin earlier and the long-tail single-worker work is reduced.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers, performance
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.