parallaxsw / OpenSTA

GNU General Public License v3.0
52 stars 23 forks source link

Long runtimes when reading SDCs that include a lot of `get_pins -hier` #78

Closed gadfort closed 3 months ago

gadfort commented 3 months ago

I noticed that on one of our designs when attempting to time it the read_sdc was taking several minutes to complete, in other tools these SDCs only take a few seconds at most to read. Unfortunately I'm unable to share the real testcase, but the one attached demonstrates the issue on a smaller scale.

In profiling the code with vtune, there were two function calls that seems to consume most of the runtime (using the script from the attached testcase):

  1. printString (~10.9 seconds)
  2. staToSdc (~4.3 second) Out of the total time of 25 seconds.

Replacing: https://github.com/parallaxsw/OpenSTA/blob/e8a6ebe5123a74d5cf1e42ef4713c14374966249/network/Network.cc#L1051 with

    string pin_name = inst_name + divider_ + port_name;
    // stringPrint(pin_name, "%s%c%s", inst_name.c_str(), divider_, port_name);

Shaves off about ~10 seconds of runtime dropping the same script down to 15 seconds.

In the case of staToSdc most of the time is spent in makeTmpString (about 2.9 seconds of the 4.3 seconds).

Attached is a testcase you can use to better be able to see the issue.

tar xvf testcase.tar.gz
sta script.tcl

Please let me know if you need any additional testcases or information.

jjcherry56 commented 3 months ago

I pushed your change. I also removed the locks on TmpStrings which should help a bit.

As for the time spent in printString, I am guessing you mean Report::printString, which is for reporting/printing to the console. THis can't be part of read_sdc unless there are a lot of warnings being printed.

gadfort commented 3 months ago

@jjcherry56 thanks. I just tried it out and it's about 45% faster. I misspoke when I said printString, I meant stringPrint, which was addressed by the changes you made.