-
Notifications
You must be signed in to change notification settings - Fork 2
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
Offline Partial Eval #55
Conversation
Correct visit order bug in StatefulIntToBit, support register type
Some common idioms can be easily rewritten, avoiding complexity udring dis. Currently unused.
Masks are never symbolic, so they can be trivially rewritten as a masking and equiv test if needed.
May want to make this a configuration option to dis
Cuts of prefix early, even if prefix does not end with terminal
Assumes no mixed use of array indices
Capable of extracting and simplifying behaviours for most of the instruction encodings on AArch64. Offline gen is missing specs for primitives as well as the prelude required for the ocaml backend.
Some differences in exception printing, unclear
If feeding in a larger bit rep, its necessary to slice down
Given (e - (a + b)) apply existing rules as ((e - a) - b)
Don't remove dead globals to maintain coverage results Set CRC support
We no longer have any stage 2,3 or 4 failures!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing!! You can merge this whenever you're ready, #53 can merge cleanly on top of this.
The naive offline transform treats all runtime variables as temporaries that must be declared in the runtime program. Often these temporaries simply hold intermediate calculations and can be trivially removed through a copy prop pass. As we do not want to introduce a copy prop into the generated lifter, we can mimic its effects over the produced lifter by identifying candidate temporaries and changing them to directly hold the intermediate calculations, rather than representing runtime variables.
Apologies, made a few improvements. After splitting the OCaml program across multiple files, build times are now down to ~1min. Also managed to get the copy prop pass implemented. Will merge once the tests pass. |
Wrapper around existing online partial evaluation work to perform offline partial evaluation. Rather than producing the semantics for a single instruction opcode, this approach produces a lifter for some subset of the architecture.
The process looks roughly like the following:
what is known at lifttime vs runtime
against an assumed interface
The above works for a significant portion of AArch64 matching the existing lifters coverage for all but
aarch64_memory_vector_single_post_inc
,aarch64_memory_vector_single_no_wb
,aarch64_memory_vector_multiple_post_inc
,aarch64_memory_vector_multiple_no_wb
. However, the resulting OCaml program is ~200k lines long and takes ~5min to build. This can mostly be attributed to some aggressive specialisation in stage 4 and the resulting unrolling transforms introduced by stage 5.There are still a decent number of things to do:
if X = '1' then c
should replace X with '1' in c)Given the compile time issues, this PR includes a generate lifter that supports no instructions.
A new lifter can be generated using
echo ':gen A64 aarch64.+' | dune exec asli
from the project directory.A subsequent
dune build
will compile the new lifter.There are two entry points to the lifter:
asloff-sem OPCODE
will dump the semantics of OPCODEasloff-coverage PAT
will run the coverage test for all instruction encodings matching PAT