Skip to content
New issue

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

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

Already on GitHub? # to your account

[kompile|kprovex] Simplify rules ahead of time #2543

Open
ehildenb opened this issue Apr 16, 2022 · 2 comments
Open

[kompile|kprovex] Simplify rules ahead of time #2543

ehildenb opened this issue Apr 16, 2022 · 2 comments

Comments

@ehildenb
Copy link
Member

ehildenb commented Apr 16, 2022

In KEVM proofs over large bytecodes, the backend spends quite a bit of time on the initial simplification of the configuration, in particular in parsing the input bytecode and calling #computeValidJumpDests.

          <program>   #binRuntime(Vat)                         </program>
          <jumpDests> #computeValidJumpDests(#binRuntime(Vat)) </jumpDests>

Once this simplification happens, it seems that the large concrete set/byte-array stored don't have as significant algorithmic overhead, just the initial simplification (no hard data backing up this observation). I changed the bytecode from the original, to just the bytecode "0x60" instead, and running kompile && kprovex --depth 0 dropped from 276s to 199s. So roughly 75s to simplify the big concrete set, and we have 72/113 KEVM proofs running in under 600s (so 10% speedup on all those), and 15/113 KEVM proofs running in under 180s (so 33% speedup on all those).

These are included in the kompiled definition, so this simplification to the actual large concrete sets could even happen as early as kompile time. If it happened at kompile time, it's more acceptable for it to take a while, because it only needs to happen once. There are two approaches I could see for this to happen at kompile time:

  • Kompile an LLVM backend at komplie-time as well, and store it in a subdirectory. Use it to evaluate specific concrete expressions in the definition. This is probably faster, except for having to build two backends (Haskell and LLVM).
  • Haskell backend exposes a kore-kompile command, which takes a kore definition and applies as many safe simplifications as possible to the definition ahead of time. This approach probably will yield more simplifications ultimately, because the Haskell backend can be much more aggressive about partially evaluating things. The backend could basically just try to simplify the RHS of as many rules as possible, and could even do functional case-splitting if directed to (maybe an attribute on the function symbol? something to consider later). It could tune the simplification over time to produce definitions more suited to its own symbolic execution.
@ehildenb ehildenb changed the title [kprovex] Simplify the initial proof statement where possible with LLVM backend [kompile|kprovex] Simplify parts of rules ahead of time Apr 16, 2022
@ehildenb ehildenb changed the title [kompile|kprovex] Simplify parts of rules ahead of time [kompile|kprovex] Simplify rules ahead of time Apr 16, 2022
@radumereuta
Copy link
Contributor

Please investigate if the haskell backend can do this simplification with a tool that we can call from kompile.

@ana-pantilie
Copy link
Contributor

The backend already simplifies the LHS of rewrite rules and equations at start-up. We could move this to kompile inside the kore-kompile tool described above, and measure the performance outcome. I would say this is a small task, because the functionality already exists and only needs to be moved to a separate tool. After that, we can try doing other simplification as well.

h0nzZik pushed a commit to h0nzZik/k that referenced this issue Nov 24, 2022
…untimeverification#1939)

* haskell-backend/src/main/native/haskell-backend: 39a42a5a - Validate function definitions (runtimeverification#2168)

* haskell-backend/src/main/native/haskell-backend: 97336086 - Issue 2100 follow up (runtimeverification#2574)

* haskell-backend/src/main/native/haskell-backend: 5dcac768 - Update dependency: deps/k_release (runtimeverification#2576)

* haskell-backend/src/main/native/haskell-backend: b16b0417 - NormalizedAc.concreteElements, InternalMap, InternalSet: use HashMap and HashSet (runtimeverification#2543)

* haskell-backend/src/main/native/haskell-backend: 7330ab77 - Update regression tests (runtimeverification#2575)

* haskell-backend/src/main/native/haskell-backend: fc0ae5f7 - Make SideCondition.assumeDefined total (runtimeverification#2577)

* haskell-backend/src/main/native/haskell-backend: 37120f76 - Update dependency: deps/k_release (runtimeverification#2579)

* haskell-backend/src/main/native/haskell-backend: ab0d48cb - Docker build update (runtimeverification#2578)

* haskell-backend/src/main/native/haskell-backend: 314b81b6 - Remove outdated guidance for developers (#2563)

* haskell-backend/src/main/native/haskell-backend: b199d525 - Revert function validation (runtimeverification#2582)

* haskell-backend/src/main/native/haskell-backend: cb2c54e8 - Update dependency: deps/k_release (runtimeverification#2583)

* haskell-backend/src/main/native/haskell-backend: 486dfd5d - kore-repl: call `warnIfLowProductivity` before throwing `ExitSuccess` or `ExitFailure` (runtimeverification#2581)

* haskell-backend/src/main/native/haskell-backend: b0e48e43 - Trim source paths in regression tests (runtimeverification#2588)

* haskell-backend/src/main/native/haskell-backend: 9686e3ca - Remove support for C semantics (#2598)

* haskell-backend/src/main/native/haskell-backend: e439a425 - remove-import-groups.sh: Handle files without terminal newlines (runtimeverification#2590)

* haskell-backend/src/main/native/haskell-backend: f77318a5 - Fix unparsing built-ins (runtimeverification#2540)

* haskell-backend/src/main/native/haskell-backend: 1fede2ca - Use Makefile for generating regression tests (runtimeverification#2580)

* haskell-backend/src/main/native/haskell-backend: 0362ccec - Update dependency: deps/k_release (runtimeverification#2600)

* haskell-backend/src/main/native/haskell-backend: 8cf981da - Validate functions (runtimeverification#2585)

* haskell-backend/src/main/native/haskell-backend: 9ef9184f - kore-0.45.0.0 (runtimeverification#2609)

* haskell-backend/src/main/native/haskell-backend: 6c84752c - Distribute \next over \or in simplifier (runtimeverification#2608)

* haskell-backend/src/main/native/haskell-backend: 8d69854d - Add location information to `WarnIfLowProductivity` (runtimeverification#2594)

* haskell-backend/src/main/native/haskell-backend: d976c2d1 - kore-repl: add session commands when generating a bug report (runtimeverification#2614)

* haskell-backend/src/main/native/haskell-backend: 81cf49ce - Keep Key attributes in KeyAttributes (runtimeverification#2603)

* haskell-backend/src/main/native/haskell-backend: 9099b483 - Implement hooks string2base and base2string over 2 <= base <= 36 (runtimeverification#2618)

* haskell-backend/src/main/native/haskell-backend: ba52e5fc - Update dependency: deps/k_release (runtimeverification#2613)

* haskell-backend/src/main/native/haskell-backend: 7eaef393 - Update dependency: deps/k_release (runtimeverification#2622)

* haskell-backend/src/main/native/haskell-backend: 3cb69096 - Overhaul pattern smart constructors (runtimeverification#2615)

* haskell-backend/src/main/native/haskell-backend: 601f0cb5 - Move Attribute.Pattern to TermLike (runtimeverification#2607)

* haskell-backend/src/main/native/haskell-backend: b39f7e86 - prelude.kore: Fix function equations for LLVM backend (runtimeverification#2629)

* map-symbolic-tests-haskell/assignment-11-spec.k.out: Update results

Co-authored-by: Thomas Tuegel <thomas.tuegel@runtimeverification.com>
Co-authored-by: Thomas Tuegel <ttuegel@mailbox.org>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants