This is an archive of the discontinued LLVM Phabricator instance.

[mlir][spirv] Use UnrealizedConversionCast in ArithmeticToSPIRV
ClosedPublic

Authored by antiagainst on Jun 11 2022, 8:48 AM.

Details

Summary

This avoids pulling in function converion patterns, which is not
part of what we want to test in ArithmeticToSPIRV. It also allows
using ConvertArithmeticToSPIRVPass as a standalone step.

Diff Detail

Event Timeline

antiagainst created this revision.Jun 11 2022, 8:48 AM
antiagainst requested review of this revision.Jun 11 2022, 8:48 AM
ThomasRaoux added inline comments.Jun 12 2022, 9:07 PM
mlir/lib/Conversion/ArithmeticToSPIRV/ArithmeticToSPIRV.cpp
881–889

should this go in the type converter so that all the convertToSPIRV pass would have it?

antiagainst marked an inline comment as done.Jun 13 2022, 9:31 AM
antiagainst added inline comments.
mlir/lib/Conversion/ArithmeticToSPIRV/ArithmeticToSPIRV.cpp
881–889

That would mean to force all downstream passes to accept the unrealized_conversion_cast as a legal op and allow generating them. I'd prefer to actually give the option to downstream passes cause that's where we pull all patterns together, so we have the flexibility to either use one pass to convert all or use multiple passes to bridge the conversion step by step. These few lines of code will be duplicated for sure but I think it's okay.

ThomasRaoux accepted this revision.Jun 13 2022, 9:43 AM
ThomasRaoux added inline comments.
mlir/lib/Conversion/ArithmeticToSPIRV/ArithmeticToSPIRV.cpp
881–889

ok, I don't have a strong opinion but since this is how convert to llvm does it I thought it would make sense to match it. In my experience it is convenient to see the unrealized cast that didn't get eliminated when looking for ops that have not been lowered but that's subjective.

This revision is now accepted and ready to land.Jun 13 2022, 9:43 AM
antiagainst marked 2 inline comments as done.Jun 13 2022, 10:08 AM
antiagainst added inline comments.
mlir/lib/Conversion/ArithmeticToSPIRV/ArithmeticToSPIRV.cpp
881–889

I see your points. Yeah that's reasonable too. Anyway, not a big issue; we can change it later. :)

This revision was landed with ongoing or failed builds.Jun 13 2022, 10:14 AM
This revision was automatically updated to reflect the committed changes.
antiagainst marked an inline comment as done.