-
Notifications
You must be signed in to change notification settings - Fork 0
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
Investigate analysis results #2
Comments
I added the missing PDL verifiers, and I now only generate verifying PDL.
Though I'm not sure what these number means? |
Oh, must have been tired while writing this. It should be correct now.
The bottom right 99% number is encouraging, though it's still interesting that we deem 45 rewrites as invalid that still succeed dynamically. |
Okay, I have discovered some weird behavior. On my setup the mlir-opt binary does not have the pass As far as I can see this is because this code here. It assumes MLIR ran successfully when neither of the Exceptions occur. However, in some cases it seems to be possible that the generator created by We probably should have a sanity check in the beginning with a very simple input IR, rewrite and expected IR to make sure that MLIR actually runs correctly @math-fehr I think this part was written by you, do you know why this might return no region? The specific rewrite this failed with is:
Which is deemed incorrect by the analysis (the matching dag is not connected) and should also fail MLIR execution |
I'm on it now! |
Here is the newest table with a proper MLIR build (that I spent 3h generating 😅 ):
The 65% in the top right indicate to me that our static analysis is still too weak to catch many cases that make MLIR fail dynamically. I did not investigate this yet. the 3% in the bottom left where MLIR does not fail, yet our analysis thinks the rewrite is invalid looks to me as if we do not generate complex enough inputs to the MLIR rewrite. From investigating the results a little this behavior shows when e.g. an operation is replaced by itself, which is unsafe as the replacement degenerates to an erasure. But the inputs the fuzzer generated for this rewrite did not use the matched op in any of the cases. What do you think @math-fehr |
Yeah that makes a lot of sense! I'll look into the fuzzer! |
I just added multithreading, so if you have a good machine this should speed up things greatly. |
I also improved the printer in the table so we actually print the seeds that are failing/succeeding, and I added the |
That's great! It generates much faster now. 👍 |
I looked into the category "Analysis failed, MLIR execution succeeded" and these are the results: 1 - replacement with itself: regarding 1: MLIR does not complain about the replacement with itself and that only breaks when there are actually uses outside of the matched IR. regarding 3:
because the scope of %4 is not picked up correctly.
regarding 4: I am not quite sure why this is the error here, have to look deeper into this one regarding 5: I am not sure why these pass MLIR, the do a replacement with the wrong number of values (number of results of the replaced op have to match!). I know MLIR has an assertion for this, but it does not trigger here. @math-fehr We should think about a sanity check whether our generated IR actually provides a match for the corresponding rewrite. I am worried we generate a bunch of inputs, run them through MLIR, find no matches, i.e. successful return code and assume correctness. Or do we have something like this already? |
Nice! For 3, I think I have a good idea on how to fix that, which should also speedup our checks. |
I'll also try to implement the sanity check tomorrow with your debug-only solution! |
1-2 is implemented with the last commit now |
I realized I was really wrong with problem 3, there is no "worst case" scenario. |
I wrote a new fuzzing algorithm, it seems to work!
This will actually succeed, because the operation that is being added will be removed directly, so even if it accessed non-dominated operands, it will still pass the verifier at the end. |
Another one that should be accepted (696391871):
Despite being replaced with itself, it has no results, so this cannot go wrong |
Also, I added a check, and indeed all generated programs are matched by pdl |
And finally, this kind of rewrite is accepted by our analysis, but not by MLIR,
|
Hey Mathieu,
Can it be that the seeds changed with the new approach to fuzzing? At least I could not regenerate your examples from your seeds, but managed to find similar ones.
Yes, I will add that soon as well, I think we do not yet handle replacement with values quite well. In general we should look to only make the analysis stronger, never remove certain inputs. I will soon start looking into cases where the analysis returns success and the rewrite fails in MLIR, as the analysis should ideally be strictly stronger, i.e. conservative than the dynamic execution. |
Really nice! |
Cheers guys,
The biggest issues we have are:
@math-fehr What are your thoughts? Do you think we can generate counter examples for these? |
I'll take a look today and see what I can generate! I thought I generated a use for the root op, we'll see if I made a mistake or if it's something else! |
So just after looking at it, for problem |
For problem |
And for problem |
Indeed, I missed that 👍 . I fixed this with my latest commit |
Wait, categories 2 as well? My feeling is that this is an MLIR bug right? Or is it a misunderstanding in my part that these PDL rewrites should be allowed? |
Sorry, too many numbers flying around. I meant category 3. |
To be fair, I feel that we should keep the analysis you had in category 3. |
Yes, I agree. I should put in a variable to disable it. |
It took longer than expected, but now I have an algorithm for category 2 that should generate all possible matches. However, in the 4 examples you sent, actually none of them are fixed by it. Here is an example of program that we can now generate a counter-example correctly:
|
|
Investigate why we have so many entries in the entry "Fails statically but passes dynamically".
Suspicion is that this relates to Exceptions thrown in the Analysis when the rewrite is illegal from a PDL IR perspective.
e.g. bottom left in this table
The text was updated successfully, but these errors were encountered: