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

Cadence Compiler - phase 2 (WIP) #3692

Open
5 of 8 tasks
j1010001 opened this issue Nov 22, 2024 · 0 comments
Open
5 of 8 tasks

Cadence Compiler - phase 2 (WIP) #3692

j1010001 opened this issue Nov 22, 2024 · 0 comments

Comments

@j1010001
Copy link
Member

j1010001 commented Nov 22, 2024

Cadence compiler project end-goal (Long-term):

Build Cadence compiler and VM to enable execution of Cadence code as efficiently as possible (as close to the native machine code of the used execution node architecture as practical), to achieve the maximum transaction throughput on the execution node.

Phase 2 goal:

Complete Cadence compiler & VM using custom bytecode. This is middle-ground between current execution using Cadence Interpreter and the end-goal with compilation + VM to native machine code.
Replace the Cadence interpreter with concurrent on-chain compilation of contracts + transactions and their execution by custom-bytecode VM. The custom bytecode is designed to achieve this goal with minimal complexity, mapping as closely as possible to the existing Cadence language functionality/operations, which makes it possible to partially reuse existing interpreter code in the custom VM.

Phase 2 goal Outcomes:

  • Build the foundation for the next phase - gradual targeted compiler + VM optimizations to move the execution stack to lower-level / native code.
  • Custom bytecode provides new abstraction layer in the execution stack, which improves our ability to add new features into the language without braking promise of backwards-compatible runtime.
  • Reduce the execution stack complexity
    • Metering can be performed at the bytecode level, which is much easier than the current approach with instrumentation of interpreter functionality which is much larger surface to cover.
  • We are not expecting significant performance improvement in this phase, the goal is to achieve correctness parity & comparable performance with the existing Cadence interpreter.

Phase 2 timeline:

Q1 2025 - brake down and estimate remaining Cadence interpreter operations to be implemented, discuss & plan the integration of concurrent compilation & VM into the execution node stack. Provide estimation of remaining effort for compiler phase 2 before the end of Q1 2025. Start implementation.

Main Tasks (WIP)

Preview Give feedback
  1. Improvement Technical Debt
    turbolent
  2. Performance Research
    SupunS jsproz
    turbolent
  3. RZhang05
  4. Feedback Improvement
    turbolent
  5. Research
    turbolent

Stretch-goals

Preview Give feedback
  1. Improvement Performance

Notes
Based on internal notes: https://www.notion.so/flowfoundation/Compilation-Discussion-1441aee1232480c897aed36c8f763e30

Phase 1 outcomes (completed):

  • Better understanding of what target(s) to consider - Ruled out Move VM and WebAssembly.
@j1010001 j1010001 changed the title Cadence Compiler - phase 2 Cadence Compiler - phase 2 (WIP) Dec 19, 2024
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

No branches or pull requests

1 participant