Handle the trivial case of size-1 vector.shape_cast. The shape_cast is created when we drop the unit dims of 1 element vector.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
LGTM but I'm not very familiar with how the unrealized conversion casts are handled in the pipeline, so you may want to wait for a second review before submitting.
mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRV.cpp | ||
---|---|---|
63–64 | Shouldn't this case have been handled by a canonicalization/folding patterns before the lowering to SPIRV? e.g., by vector::populateVectorShapeCastLoweringPatterns? |
mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRV.cpp | ||
---|---|---|
63–64 | Currently IREE SPIRV pipeline doesn't have vector::populateVectorShapeCastLoweringPatterns to handle shape_cast. We can add that and it will also solve the problem. I don't know which one is preferable. I'll let @antiagainst decide. |
mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRV.cpp | ||
---|---|---|
63–64 | populateVectorShapeCastLoweringPatterns is more involved and can potentially generate quite a lot of data movement vector ops. It need more patterns to clean up everything for SPIR-V. It's hard to properly sequence it with all other vector patterns. So I'm fine to handle this special case directly when lowering to SPIR-V--it's pretty straightforward here. (Some day we might need to take another look of how all those vector patterns are used in spirv https://github.com/openxla/iree/issues/11110; but that's a large effort to take on..) | |
66 | We don't need this check anymore with dstType == srcType? | |
66 | Actually ignore this. Misread it.. |
Oh, I didn't notice the windows build failed... But it seems to be due to an unrelated reason. I'll monitor the build status and revert if required.
Shouldn't this case have been handled by a canonicalization/folding patterns before the lowering to SPIRV? e.g., by vector::populateVectorShapeCastLoweringPatterns?