Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.1] disable CFL Alias Analysis by default; fixes known cases of indeterministic build output #309

Merged
merged 3 commits into from
Aug 22, 2024

Conversation

spoonincode
Copy link
Member

We've struggled with cdt generating slightly different outputs build-to-build. Typically the number of output permutations is low which allows eventually coming to a consensus between two independent build environments (e.g. two individuals building a contract) by just building over and over until matching up, but clearly this is not ideal behavior and may not always be the case.

The CFL Alias Analysis optimization looks to be the source of the build indeterminism. Disable it by default, and switch the exposed option to allow it to be reenabled in case someone out there really needs it, or finds some severe regression due to the removal of this optimization. (I'm tempted to just remove it entirely: LLVM 9 documents this optimization pass as experimental)

Technically this is a breaking change (removal of -fno-cfl-aa option). An alternative is to add the new -fcfl-aa and keep the existing -fno-cfl-aa. But then I have to figure out how to properly handle repeated options here (someone passing -fcfl-aa -fno-cfl-aa -fcfl-aa). I am not really convinced it's worth making this more complex; but we can discuss if someone has a strong opinion about it w.r.t. no breaking changes in a minor release.

Disabling this optimization makes a very marginal increase in contract size; I measured two contracts' size in bytes:

contract with CFL AA no CFL AA Increase
eosio.system 371557 371589 <0.01%
eosio.evm 478959 480609 0.3%

FWIW, eosio.evm's stack/data did not increase. I do not have any performance metrics. With such a small change in compiled size it's unlikely there is a significant performance delta, but there is still a chance.

@spoonincode spoonincode merged commit f2e8e92 into release/4.1 Aug 22, 2024
7 checks passed
@spoonincode spoonincode deleted the disable_cffaa_default_41 branch August 22, 2024 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants