tensorflow / mlir

"Multi-Level Intermediate Representation" Compiler Infrastructure
1.74k stars 259 forks source link

Bugfix: Keep worklistMap in sync with worklist in GreedyPatternRewriter #211

Closed dcaballe closed 5 years ago

dcaballe commented 5 years ago

When we removed a pattern, we removed it from worklist but not from worklistMap. Then, when we tried to add a new pattern on the same Operation again, the pattern wasn't added since it already existed in the worklistMap (but not in the worklist).

joker-eph commented 5 years ago

Do you see a way to exercise this in a test?

dcaballe commented 5 years ago

Do you see a way to exercise this in a test?

I couldn't find a simple way. This bug was exposed by https://github.com/tensorflow/mlir/pull/212 and only one test failed out of multiple tests using that feature. At least, that test is indirectly covering it. IIRC, the failure only happened when adding and removing patterns for 2 ops multiple times. Please, let me know if you have any idea.