This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Add another test case for 1:N type conversion facilities. (NFC)
ClosedPublic

Authored by ingomueller-net on Mar 27 2023, 10:11 PM.

Details

Summary

This patch adds another test case for the new 1:N type conversion utils
testing that the proper user materializations are applied depending on
which of the ops in are converted by the test pass.

Diff Detail

Event Timeline

ingomueller-net requested review of this revision.Mar 27 2023, 10:11 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 27 2023, 10:11 PM
ingomueller-net retitled this revision from [mlir] Add another test case for 1:N type conversion facilities. to [mlir] Add another test case for 1:N type conversion facilities. (NFC).Mar 27 2023, 10:13 PM
nicolasvasilache accepted this revision.Mar 28 2023, 1:18 AM
This revision is now accepted and ready to land.Mar 28 2023, 1:18 AM
mehdi_amini added inline comments.Apr 9 2023, 9:33 PM
mlir/test/Conversion/OneToNTypeConversion/one-to-n-type-conversion.mlir
126

All of these checks seems much over-constrained for what we're trying to test. Just using SSA numbers directly is already making this a "fragile" test, but in general it's not clear to me what we're testing exactly here (there are also some unused SSA value there).

Can you simplify all theses tests?

mlir/test/Conversion/OneToNTypeConversion/one-to-n-type-conversion.mlir
114

Labels are intended to be unique in the FileCheck input I believe, please rename the second function as well

ingomueller-net marked an inline comment as done.Apr 11 2023, 6:48 AM
ingomueller-net added inline comments.
mlir/test/Conversion/OneToNTypeConversion/one-to-n-type-conversion.mlir
114

Thanks for the suggestion. I did just submitted https://reviews.llvm.org/D148012 to address this.

126

Good catch -- I don't understand how I did not see the hard-coded SSA names... https://reviews.llvm.org/D148012 turns them into patterns. I also used CHECK-DAG instead of CHECK-NEXT to be insensitive to the order.

Does your issue of being fragile and/or over-constraint go beyond that?

The purpose of the test is to test (and illustrate) the 1:N conversion patterns; in particular, the usage of materializations when parts of the IR are converted and others are not. The fact that some SSA values are used is due to the fact how materializations work: on the conversion boundary, the pass adds IR that produces N target-type values for what used to be a single source-type value independently of what they uses are. It may be that the uses get translated such that only a struct subset of these N values are used, so the remaining ones have no uses.

mehdi_amini added inline comments.Apr 12 2023, 10:43 PM
mlir/test/Conversion/OneToNTypeConversion/one-to-n-type-conversion.mlir
126

Does your issue of being fragile and/or over-constraint go beyond that?

I'm not totally sure, I would have to think more into what we're testing here.
I just had these drive by comments because I had to update the test as part of another change of mine and noticed the SSA numbers.
Thanks for the update!

ingomueller-net marked 3 inline comments as done.Apr 13 2023, 3:16 AM
ingomueller-net added inline comments.
mlir/test/Conversion/OneToNTypeConversion/one-to-n-type-conversion.mlir
126

OK, let's leave it as is for now. To my understanding, the tests are in line with the guidelines now. I was just checking whether you had something else in mind..