odb: cache x/y grids in dbTrackGrid#8854
odb: cache x/y grids in dbTrackGrid#8854maliberty merged 3 commits intoThe-OpenROAD-Project:masterfrom
dbTrackGrid#8854Conversation
Signed-off-by: Peter Gadfort <peter.gadfort@gmail.com>
Signed-off-by: Peter Gadfort <peter.gadfort@gmail.com>
Signed-off-by: Peter Gadfort <peter.gadfort@gmail.com>
|
clang-tidy review says "All clean, LGTM! 👍" |
|
Its not that much memory but you'll still pay the inefficiency once. If it is faster there may be no need to cache. There is no reserve call, no need to sort for a single pattern, even multi-pattern could be more efficient than an append and sort. |
|
@maliberty I'm not sure what you mean by faster? The memory is trivial, and the improvements you are suggesting can be implemented, in a different PR. |
|
By faster I mean efficient enough that no cache is needed. Caching tends to be a source of bugs so I avoid it if I can (for instance this PR missed create / destroy invalidation). |
|
On create, there is nothing to do (the grid vector would be empty, thus load loaded). Allocating the memory over and over again is also not particularly efficient. In the profile, insertion still takes real time (at scale). |
| auto* tracks = block->findTrackGrid(layer_); | ||
| if (dir == odb::dbTechLayerDir::HORIZONTAL) { | ||
| tracks->getGridY(grid_); | ||
| grid_ = tracks->getGridY(); |
There was a problem hiding this comment.
You are making a copy here fwiw
|
I think this is unnecessary but not worth arguing over. |
No functional changes expected.
Changes:
dbTrackGrid, these rarely change and take a noticeable amount of time to compute on larger designs (from this weekends testcase, about 45 seconds was spent repeatedly calculating this value in PDN (of course that is an inefficiency there, but this solves it for all)). When the grid is modified the cache is cleared.