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

Abstract proof trace writer at event level #1136

Merged
merged 7 commits into from
Aug 21, 2024
Merged

Conversation

theo25
Copy link
Collaborator

@theo25 theo25 commented Aug 16, 2024

This PR refactors the proof trace writer to be abstract at the event generation level, rather than the byte stream level. We do this in order to be able to use alternative ways of communicating the proof hints that do not require writing the trace to a file, such as triggering of callback invocations.

The PR can be reviewed commit by commit:

  • the 1st commit removes an unused flag from main.ll
  • the 2nd commit adds the new abstract proof_trace_writer and a subclass that writes in a file as before.
  • the 3rd commit removes the old proof_trace_writer that operated at the level of writing byte streams.

@rv-jenkins rv-jenkins changed the base branch from master to develop August 16, 2024 23:58
@theo25 theo25 force-pushed the abstract-event-writer branch 2 times, most recently from bcb1c56 to 2b6ede1 Compare August 19, 2024 13:55
Copy link
Collaborator

@dwightguth dwightguth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm having trouble tracking all of these changes, but the high level signature of proof_trace_writer looks good, the tests pass, and you seem happy with it as a stepping stone towards the callbacks, so I don't have any comments. I will let Roberto approve, though. I want another set of eyes on it.

Copy link
Collaborator

@Robertorosmaninho Robertorosmaninho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like some clarifications before approving it. But overall, it looks good to me, and if all tests area passing we're good as well.

Comment on lines +47 to +55
* Emit an instruction that has no effect and will be removed by optimization
* passes.
*
* We need this workaround because some callsites will try to use
* llvm::Instruction::insertAfter on the back of the MergeBlock after a proof
* branch is created. If the MergeBlock has no instructions, this has resulted
* in a segfault when printing the IR. Adding an effective no-op prevents this.
*/
llvm::BinaryOperator *emit_no_op(llvm::BasicBlock *insert_at_end);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand that this will be deleted by DCE, but is it really impossible to prevent this writing from being in MergeBlock? Can you elaborate a bit more on this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So there is an issue with the way github presents the diff for this PR. If you notice this is not my code, it has been just deleted from a different place in the file and moved here verbatim. As such I have no comment on what should be done with it and whatever it is that we may decide, it shouldn't be part of this PR anyway.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's pretty awkward indeed.

include/runtime/proof_trace_writer.h Show resolved Hide resolved
include/runtime/proof_trace_writer.h Outdated Show resolved Hide resolved
runtime/util/ConfigurationSerializer.cpp Show resolved Hide resolved
runtime/util/finish_rewriting.cpp Show resolved Hide resolved
runtime/util/util.cpp Outdated Show resolved Hide resolved
Copy link
Collaborator

@Robertorosmaninho Robertorosmaninho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for addressing my comments and explaining to me your modifications!

@rv-jenkins rv-jenkins merged commit 9418f9d into develop Aug 21, 2024
10 checks passed
@rv-jenkins rv-jenkins deleted the abstract-event-writer branch August 21, 2024 21:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants