OpenROAD icon indicating copy to clipboard operation
OpenROAD copied to clipboard

odb: shrink dbGCellGrid::GCellData fields uint -> uint8_t

Open openroad-robot opened this issue 1 year ago • 14 comments

Shrinkg 6_final.odb from 3.6G to 2.1G on gf12/bp_single. The effect on gzipped size is minimal as it effective compresses out this inefficiency.

openroad-robot avatar Feb 02 '24 07:02 openroad-robot

clang-tidy review says "All clean, LGTM! :+1:"

github-actions[bot] avatar Feb 02 '24 07:02 github-actions[bot]

You could potentially write those variables out as var ints and move them to uint16s if you want the extra headroom

QuantamHD avatar Feb 02 '24 08:02 QuantamHD

https://sqlite.org/src4/doc/trunk/www/varint.wiki#:~:text=A%20variable%20length%20integer%20is,(and%20less%20common)%20values.

QuantamHD avatar Feb 02 '24 08:02 QuantamHD

@maliberty Does this reduce RAM requirements of OpenROAD too or is this only disk requirements?

oharboe avatar Feb 02 '24 13:02 oharboe

@oharboe It would reduce RAM as well @QuantamHD I think varints are an interesting idea for serialization. I don't think they would help with the in memory representation though as these fields are part of a struct.

I'm sitting on this PR as I may make more changes before merging in order to minimize the number of schema updates.

maliberty avatar Feb 02 '24 19:02 maliberty

@QuantamHD that particular scheme is good for ints up to 64 bits. Since many uses are 32bit there may be a better scheme for those cases.

maliberty avatar Feb 02 '24 19:02 maliberty

If you expect most things to be within 7 bits I don't see why it wouldn't also be helpful 32 bits.

QuantamHD avatar Feb 02 '24 20:02 QuantamHD

If you expect most things to be within 7 bits I don't see why it wouldn't also be helpful 32 bits.

Because I want to shrink the in memory representation too by restricting to 1 byte. Varints aren't useful in memory.

maliberty avatar Feb 02 '24 23:02 maliberty

If that's the primary purpose then sure, but as I suggested I worry about these low limits and maybe moving to uint16_t is worth the extra memory for the peace of mind.

QuantamHD avatar Feb 02 '24 23:02 QuantamHD

If that's the primary purpose then sure, but as I suggested I worry about these low limits and maybe moving to uint16_t is worth the extra memory for the peace of mind.

Why? A gcell is ~15 tracks. Even 10X would still fix in a byte.

maliberty avatar Feb 02 '24 23:02 maliberty

Smaller memory footprint is always good. Why store it on disk at all ? I’m assuming that it’s derived from the route guides and some blockages, no ? How long does it take to compute this data ?

stefanottili avatar Feb 03 '24 15:02 stefanottili

We would have to separate out the capacity calculation in grt to be separately callable and traverse all the guides so it is possible but not trivial to avoid storing it. Once whittled down I'm not sure it will be as important.

maliberty avatar Feb 03 '24 19:02 maliberty

How does grt take blockages or power routing into account ? There must be a pre processing step, right ? Can I get a global route resource map by reading e.g. ispd19 results (routed def) ?

stefanottili avatar Feb 03 '24 20:02 stefanottili

How does grt take blockages or power routing into account ? There must be a pre processing step, right ? Can I get a global route resource map by reading e.g. ispd19 results (routed def) ?

grt does consider such in computing available tracks. You have to run the global router to get the map. You could delete the routing, then run the global router if you really want it.

maliberty avatar Feb 03 '24 21:02 maliberty

@maliberty I've made a bunch of updates to remove unused data from dbGCellGrid, with some modifications to the GPL-GRT API to allow us to remove the blockage data from the gcell grid.

eder-matheus avatar Feb 27 '24 14:02 eder-matheus

clang-tidy review says "All clean, LGTM! :+1:"

github-actions[bot] avatar Feb 27 '24 16:02 github-actions[bot]

clang-tidy review says "All clean, LGTM! :+1:"

github-actions[bot] avatar Feb 28 '24 02:02 github-actions[bot]

@maliberty Now it should be ready to review.

eder-matheus avatar Feb 28 '24 13:02 eder-matheus

clang-tidy review says "All clean, LGTM! :+1:"

github-actions[bot] avatar Mar 05 '24 17:03 github-actions[bot]