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

Verifier #291

Merged
merged 23 commits into from
Feb 12, 2025
Merged

Verifier #291

merged 23 commits into from
Feb 12, 2025

Conversation

bzhang1945
Copy link
Contributor

Description

Integrated the PAST program equivalence check tool into Allo, allowing for semantic verification between Allo schedules that have gone through transformations through Allo customizations.

Proposed Solutions

Imported PAST and its bindings into Allo externals, which is then used by verify.py that creates and processes schedules into their generated VHLS code to be verified by PAST.

Once the VHLS code is generated, the verifier adds pocc_pragmas to demarcate the call regions to verify on, replaces unsupported types by PAST (e.g. int_64_t -> int), identifies the live-out/output variable, prior to running the two programs through verification.

Examples

To use the verifier, we simply need two Allo schedules:
s1 = allo.customize(foo)
s2 = allo.customize(bar)

verifier = allo.verify(s1, s2) # returns either True or False

Testing

Basic testing is run on the verifier under tests/test_verify.py.

@zhangzhiru
Copy link

If the verifier returns False, do we provide meaningful information to help users identify the source of the mismatch?

@bzhang1945
Copy link
Contributor Author

If the verifier returns False, do we provide meaningful information to help users identify the source of the mismatch?

I have added a diff highlighter that logs the differences observed between the two generated VHLS schedules if the verifier deems the two to be not equivalent. We could potentially provide more information through inspecting the IRs, but I believe not much more can be systematically logged given that all of the grunt work of semantic canonicalisation is done by PAST, and the verifier here simply passes everything along to PAST.

Copy link
Member

@chhzh123 chhzh123 left a comment

Choose a reason for hiding this comment

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

Thanks for submitting this PR! It mostly looks great! To enable CI testing, I think you need to change the requirement.txt file to include this dependency.
https://github.com/cornell-zhang/allo/blob/main/requirements.txt

If no direct pip installation of the past package is provided, then you need to change the CI configuration file to install it manually.
https://github.com/cornell-zhang/allo/blob/main/.github/workflows/config.yml#L35

allo/verify.py Outdated
import os
import re
import difflib
import past
Copy link
Member

Choose a reason for hiding this comment

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

Use the following structure, not all the users need to install past.

try:
    import past
except:
    pass

@bzhang1945 bzhang1945 marked this pull request as ready for review February 12, 2025 05:16
Copy link
Member

@chhzh123 chhzh123 left a comment

Choose a reason for hiding this comment

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

It looks great! Thanks for making the CI work

@chhzh123 chhzh123 merged commit 2afcd32 into cornell-zhang:main Feb 12, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants