This is an archive of the discontinued LLVM Phabricator instance.

[mlir:MultiOpDriver] Add operands to worklist should be checked
ClosedPublic

Authored by Chia-hungDuan on Jun 6 2022, 9:42 PM.

Details

Summary

Operand's defining op may not be valid for adding to the worklist under
stict mode

Diff Detail

Event Timeline

Chia-hungDuan created this revision.Jun 6 2022, 9:42 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 6 2022, 9:42 PM
Chia-hungDuan requested review of this revision.Jun 6 2022, 9:42 PM

@rriddle
I'm not sure if we should do the check in AddToWorklist or just make it as this CL. Besides, I found this bug by the assertion we had before. Do you think we need a test (testing remove/replace/insert operations) or still have the assertion is enough?
What do you think?

Is there a test we can add here?

@rriddle
I'm not sure if we should do the check in AddToWorklist or just make it as this CL. Besides, I found this bug by the assertion we had before. Do you think we need a test (testing remove/replace/insert operations) or still have the assertion is enough?
What do you think?

Ahah, missed this comment before I sent the other one. What do you mean by if we should do the check in AddToWorklist? Also, I think it'd be nice to have a test for this if we can.

@rriddle
I'm not sure if we should do the check in AddToWorklist or just make it as this CL. Besides, I found this bug by the assertion we had before. Do you think we need a test (testing remove/replace/insert operations) or still have the assertion is enough?
What do you think?

Ahah, missed this comment before I sent the other one. What do you mean by if we should do the check in AddToWorklist? Also, I think it'd be nice to have a test for this if we can.

Sorry, didn't say that clearly. I mean things this like

virtual void AddToWorklist(...); // in GreedyPatternRewriteDriver
void AddToWorklist(...) override { // in MultiOpPatternRewriteDriver
  if (strictMode) ...
}

Then we may only need to override notifyOperationRemoved. Not sure which one is better in term of design.

Will add a test in later patch.

@rriddle
I'm not sure if we should do the check in AddToWorklist or just make it as this CL. Besides, I found this bug by the assertion we had before. Do you think we need a test (testing remove/replace/insert operations) or still have the assertion is enough?
What do you think?

Ahah, missed this comment before I sent the other one. What do you mean by if we should do the check in AddToWorklist? Also, I think it'd be nice to have a test for this if we can.

Sorry, didn't say that clearly. I mean things this like

virtual void AddToWorklist(...); // in GreedyPatternRewriteDriver
void AddToWorklist(...) override { // in MultiOpPatternRewriteDriver
  if (strictMode) ...
}

Then we may only need to override notifyOperationRemoved. Not sure which one is better in term of design.

Yeah, let's try switching to that. From a glance that feels like it could be cleaner.

Will add a test in later patch.

Address review comment

h

@rriddle
I'm not sure if we should do the check in AddToWorklist or just make it as this CL. Besides, I found this bug by the assertion we had before. Do you think we need a test (testing remove/replace/insert operations) or still have the assertion is enough?
What do you think?

Ahah, missed this comment before I sent the other one. What do you mean by if we should do the check in AddToWorklist? Also, I think it'd be nice to have a test for this if we can.

Sorry, didn't say that clearly. I mean things this like

virtual void AddToWorklist(...); // in GreedyPatternRewriteDriver
void AddToWorklist(...) override { // in MultiOpPatternRewriteDriver
  if (strictMode) ...
}

Then we may only need to override notifyOperationRemoved. Not sure which one is better in term of design.

Yeah, let's try switching to that. From a glance that feels like it could be cleaner.

Done.

Will add a test in later patch.

Done.

Last commit missed some changes

comment minor update

rriddle accepted this revision.Jun 11 2022, 1:01 AM
This revision is now accepted and ready to land.Jun 11 2022, 1:01 AM