vyper icon indicating copy to clipboard operation
vyper copied to clipboard

meta: venom IR roadmap

Open harkal opened this issue 9 months ago • 1 comments

Roadmap for the Venom Intermediate Representation Language

Overview

The "Venom" intermediate representation (IR) language is an initiative to enhance the compilation process of the Vyper compiler. The goal is to transition from the existing s-expression based IR to a more efficient, flexible and optimized Venom IR.

Current Status

Currently, "Venom" is being developed as a new form of IR that translates from the existing s-expression based IR. This approach allows for incremental refinement and integration into the existing compilation pipeline.

Proposed Roadmap

Phase 1: Venom IR Development

  • Develop the initial structure and capabilities of Venom IR by translating from the existing s-expression based IR.
  • Key Tasks:
    • [x] Define Venom's data structures and operations.
    • [x] Implement utility data structures and algorithms, like dominator trees, dominance frontier calculation, etc
    • [x] Implement translation mechanisms from s-expression IR to Venom IR.
    • [x] Pass the complete compiler test suite

Phase 2: Implement Basic Optimizations

  • Apply Data Flow Optimizations in order to accommodate for better stack management and variable usage
  • Key Tasks:
    • [x] Utilize Static Single Assignment (SSA) form in Venom to optimize data flow and variable usage.
    • [ ] Optimize stack scheduling
  • Introduce basic optimizations to the new Venom IR to demonstrate immediate benefits.
  • Key Tasks:
    • [x] Apply dead code elimination and constant folding within Venom IR.
    • [ ] Optimize function calling convention
    • [ ] Start replacing segments of s-expression IR with Venom in less critical paths to test and refine the new IR.

Phase 3: Advanced Optimizations and Transition

  • Control Flow Optimizations
  • Key Tasks:
    • [ ] Implement loop unrolling and strength reduction directly in Venom.
    • [ ] Enhance branch prediction strategies within the new IR framework.
  • Gradually phase out s-expression IR, replacing it with Venom IR in all compiler processes.
  • Key Tasks:
    • [ ] Incrementally replace all instances of s-expression IR with Venom.
    • [ ] Validate and ensure the stability and performance of Venom across the compiler.

Phase 4: Performance Testing and Benchmarking

  • Thoroughly benchmark Venom IR to measure and optimize its performance.
  • Key Tasks:
    • [ ] Establish benchmarks specifically designed for Venom's optimizations.
    • [ ] Continuously refine Venom based on real-world data and performance feedback.

Phase 5: Full Integration and Decommission of s-expression IR

  • Fully replace the s-expression IR with Venom and enable direct AST to Venom compilation.
  • Key Tasks:
    • [ ] Finalize the translation logic for direct AST to Venom generation.
    • [ ] Ensure comprehensive compatibility and remove all dependencies on the old IR.

Contributing

We welcome contributors to participate at all stages, particularly in the areas of optimization development and testing. Please refer to the project's GitHub repository for detailed contribution guidelines.

harkal avatar Apr 29 '24 08:04 harkal

we should get the venom optimizer to feature parity with the IRnode optimizer, so we can disable the IRnode optimizer without any performance regressions

charles-cooper avatar May 07 '24 21:05 charles-cooper