-
Notifications
You must be signed in to change notification settings - Fork 2
Implement rewrite validator #55
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
Conversation
Not to confuse it with the nonlocal insertion
Small bike-shedding: any opinions on (cc @topolarity) |
I've merged the other PR, which has made a bit of a mess of the history of this one. Maybe easiest to just squash this down and rebase, but I'll let you take it as you see fit. |
I still don't understand the |
I am a little bit worried that we are doing the structural analysis on differing IR. The validation only works if we get the exact same equation/variable numbers so if the IR differs that's not guaranteed. I need to take a closer look at that, but I don't think it needs to block merging. |
Looks good in general, I think there's some further tweaks to be done on the rewrite logic, but I think it'd make sense to get this merged first, so let's figure out the residual sign thing, get this rebased and merged, and then we can tackle that. |
I'd be happy to get rid of
Yes, so far I tried to make things correspond but we should have robust tests/guarantees for that. In particular, even if it was 100% consistent with the current implementation, future changes might break that. We can work on that first after merging this initial implementation. |
That's probably because I cherry-picked instead of merged the state of the other branch while working on this one. I resolved conflicts with |
Yes, I think we should try to maintain that invariant. As I said, I possibly wasn't particularly careful about it in the existing implementation, because it doesn't matter too much there, but it's good to be consistent. |
Since CI is passing, I'll just merge this as is and do follow-on suggestions in a PR, so we can discuss there. |
Closes #47.
Introduces a
compute_residual_vectors
function which returns a pair of residuals, one corresponding to the unoptimized pipeline (no tearing, no scheduling), and one corresponding to the standard (optimized) pipeline.Tests were added in
test/validation.jl
to ensure we give the same residuals in both cases, with a few tests adapted from IPO tests. The thermal fluid benchmark currently gives inconsistent results for both, and will require fixing; it may be that the unoptimized pipeline or its residual mapping is incorrect, or that we have correctness issues with the current codegen, or both. At least we have as a target to make both results match and then we'll be more confident that our codegen is sound.Support for the ODE mode was not added in this PR, but being able to have validation tests for the DAE mode should help a long way already. We can have a follow-up PR to address this if/when we deem it important.
This PR is based on #54, for a clean view of the changes see the comparison against that PR.