llvm / circt

Circuit IR Compilers and Tools
https://circt.org
Other
1.67k stars 296 forks source link

[FIRRTL] Investigate, Fix Grand Central Slowness #1969

Closed seldridge closed 2 years ago

seldridge commented 3 years ago

The Grand Central (lib/Dialect/FIRRTL/Transforms/GrandCentral.cpp), Grand Central Taps (lib/Dialect/FIRRTL/Transforms/GrandCentralTaps.cpp), and Grand Central Signal Mappings (lib/Dialect/FIRRTL/Transforms/GrandCentralSignalMappings.cpp) have been reported as running slow on large designs (with duplicated modules). Investigate what's going on here and fix it.

Some ideas:

  1. (@fabianschuiki states) that this may just be stemming from the lack of deduplication, so this is the expected scaling we get.
  2. (@Ramlakshmi3733 suggests) exploring parallelizing these passes. There may be some issues here as the passes are mostly just a two-phase process of collecting information during a global walk, then adding IR constructs. The collect information phase could be parallelized (with workers competing to write to a global data store?).
  3. Combine all these passes.
  4. Promote Grand Central information collection to an analysis then remove Grand Central annotations during LowerToHW.
  5. (@fabianschuiki suggests) leaving breadcrumbs on the FIRRTL modules during scattering indicating that they have no GCT-related information. This would speed up the walk by avoiding modules that will not contribute to a GCT construct. (EmitSignalMappings already works this way.)
seldridge commented 2 years ago

Fixed in https://github.com/llvm/circt/pull/2645.