-
Notifications
You must be signed in to change notification settings - Fork 23
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
Shared memory ringbuffer based parser for proof hints #1108
Conversation
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.
The PR, so far LGTM! I couldn’t spot why it’s failing in macOS, though, so I think this is the last thing needed to merge this PR.
I would like to see if it’s possible to have a more C++ style for the ringbuffer definition in the future. We should also have some Python bindings to expose this to MPG. The code was very well inline-documented, and the PR description helped a lot during the review.
Thanks for your hard work on this!
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.
LGTM, and works on my machine.
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.
I left a couple of suggestions for the internal data structure that would let you improve the code quality a little, but feel free to stick with your current implementation if you'd rather.
I have managed to fix the issues with MacOS. There were 2 main issues:
|
@theo25, if you're confident that this PR is ready to merge, go ahead and merge it. We can deal with the C++ style later, just create an issue for that. That's a low priority atm. |
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.
Thanks for addressing our comments. LGTM!
Co-authored-by: Bruce Collie <brucecollie82@gmail.com>
This PR adds a shared memory ringbuffer based subclass for the
proof_trace_buffer
abstract class that is used by the proof trace parser to abstract away the mechanism in which the proof trace is being read. The new subclass reads the proof trace from a ringbuffer located in shared memory. In the future, we plan to add a corresponding writer for the hint generator that will output the proof trace in the shared memory ringbuffer. We do this in order to reduce the overhead of the hint generation.Some important notes/disclaimers for this PR:
kore-proof-trace-shm-writer
, that reads a proof trace file (the only kind of output currently supported by the hint generator) and writes its contents to the shared memory ringbuffer. In the future, we will add support for the hint generator to opt to write the proof trace straight into the ringbuffer, and at that point thekore-proof-trace-shm-writer
can be removed.kore-proof-trace
when it is passed a new flag, namely--shared-memory
. If the flag is passed then the<input filename>
positional argument serves as the name of the shared memory object. The same name must be passed tokore-proof-trace-shm-writer
in order for the IPC to work. Moreover, thekore-proof-trace-shm-writer
invocation needs to allow some time forkore-proof-trace
to finish the setup. That is why we usesleep 1
in CI between the two invocations.The structure of the PR content is as follows:
include/kllvm/binary/ringbuffer.h
andlib/binary/ringbuffer.cpp
, contain the API and implementation for the ringbuffer data structure.proof_trace_buffer
, namelyproof_trace_ringbuffer
is added toinclude/kllvm/binary/deserializer.h
. This subclass implements the abstract API for various types of reads and peeks, all based on two basic read and peek functions that contain the synchronization logic on the reader's side.tools/kore-proof-trace/main.cpp
program, that does the setup of the shared memory object and the initialization of the semaphores and invokes the shared memory/ringbuffer based hint parser.tool/kore-proof-trace-shm-writer
that reads a binary hint file and writes its contents to a provided shared memory object. The tool contains the synchronization logic on the writer's side.test/lit.cg.py
to allow parsing the hint file with the new shared memory/ringbuffer based parser for all tests that involve hint generation.