Git Product home page Git Product logo

Comments (2)

nikola-matic avatar nikola-matic commented on June 8, 2024 1

Hi @hedgar2017, I can confirm that this is an issue, so thank for the report.

from solidity.

cameel avatar cameel commented on June 8, 2024

I also managed to reproduce it earlier today and it looks like it's specifically the SSATransform step in the optimizer sequence that triggers this.

Repro on the CLI (after extracting PoseidonT3.sol)

solc PoseidonT3.sol --via-ir --optimize --yul-optimizations a

I let it run for > 20 min and it ended up eating all memory on a machine with 32 GB RAM and being killed by the OOM killer.

It only happens with Yul optimizer enabled and is reproducible down to v0.8.10 (with --experimental-via-ir), which seems to be the version that introduced the optimized EVM transform and also included various changes to data flow analyzer. Before that it compiles fine.

I also took a quick look at the call stack in a debugger and the relevant bits look like this:

  • OptimiserSuite::run()
  • StackCompressor::run()
  • eliminateVariablesOptimizedCodegen()
  • Rematerialiser::run()
  • DataFlowAnalyzer::operator(Block)
  • Then lots of alternating between calls to Rematerialiser, ASTModifier and DataFlowAnalyzer
  • Then deep chains of calls into the CodeCost metric

The stack is generally pretty deep and getting a little deeper each time I pause the execution. Got up to something like ~575 calls deep after ~10 min (in a debug build, so not necessarily comparable with the ~20 I mentioned above). The call chains measured by the metric seem weirdly long. Much longer than what I'd expect from nesting visible in unoptimized IR and there are no recursive calls there.

What it looks like to me is that probably StackCompressor keeps repeatedly using Rematerialiser to inline all those intermediate variables and ending up with very deep nesting, which is then very expensive to measure and analyze. Still not sure if it is actually doing infinite recursion or if it would finish eventually but is just pathologically costly to run.

from solidity.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.