YosysHQ / yosys

Yosys Open SYnthesis Suite
https://yosyshq.net/yosys/
ISC License
3.49k stars 890 forks source link

Difference in results depending on whether Yosys is compiled with Clang or GCC? #3218

Open tcal-x opened 2 years ago

tcal-x commented 2 years ago

Steps to reproduce the issue

Unpack the attached zip.

Run the command in run first using a Yosys compiled with clang, then with a Yosys compiled with gcc. The results will be different.

Expected behavior

Perhaps I'm being naive, but I would expect the output to be the same regardless of how Yosys was compiled (assuming there were no differences in -D defines)

Actual behavior

There were differences that seemed significant in the overall design; when using Yosys compiled with Clang, the max frequency seemed better on average (after nextpnr).

From the reduced design that's included in the zip, enough to show a difference:

With Clang:

   Number of wires:               3817

With GCC:

   Number of wires:               3815
tcal-x commented 2 years ago

repro.zip

nakengelhardt commented 2 years ago

Your script calls ABC, which is well known to be highly sensitive to just about everything in the design. Different compilers lead to different iteration orders in some places (e.g. when sets are used) which can lead to IDs being assigned differently.

In fact to account for that effect when benchmarking we're adding a way to shuffle the private names in #3277 - that's enough to get completely different results.