Skip to content

Zero alloc bounded join of witnesses#1472

Closed
gretay-js wants to merge 4 commits intooxcaml:mainfrom
gretay-js:zero_alloc_bounded_join_of_witnesses
Closed

Zero alloc bounded join of witnesses#1472
gretay-js wants to merge 4 commits intooxcaml:mainfrom
gretay-js:zero_alloc_bounded_join_of_witnesses

Conversation

@gretay-js
Copy link
Copy Markdown
Contributor

On top of #1471. Only last two commits are new. Best review commit by commit.

The analysis keeps track of all witness instructions that lead to Top at function entry, even if the flag -checkmach-details-cutoff n limits the number of witnesses to be included in error message to some n > 0. This PR uses n as the apper bound on the size of the set of witnesses to be propagated.

There are two commits. The first is a simple change to join to implement the above functionality.
The second commit is refactoring of Witnesses.t type to keep track of whether join was in fact bounded or not, and propagate this information to function entry. This information is then used to print "..." at the end of error messages so the user knows when list of witnesses is partial. I am not entirely sure that the "dots" are worth the extra memory overhead of boolean field to track them. I'd be fine without it but wanted to get feedback first, or maybe there is a cheaper way to track it. I thought about tracking it per function but it breaks the abstractions.

@gretay-js
Copy link
Copy Markdown
Contributor Author

gretay-js commented Jun 9, 2023

In terms of build performance and memory overhead, this PR won't have noticeable effect in a large code base. The bound will only trigger on large functions that have lots of allocations (more than the bound) and are annotated with [@zero_alloc], making this unlikely to be the steady state of the code: annotation will probably be removed or the check disabled, so previous PRs ensure that no witnesses would be tracked for the function. The effect of the PR may be noticeable for users who are interactively working through their code to annotate it in an optimized (slow) build for the first time.

@gretay-js gretay-js marked this pull request as draft March 28, 2024 17:56
@gretay-js
Copy link
Copy Markdown
Contributor Author

closing as very very outdated, will open a new PR after this is reworked to handle fixpoint.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant