Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
mlir/lib/Conversion/StandardToSPIRV/ConvertStandardToSPIRV.cpp | ||
---|---|---|
773 | I think we need to special treat the case where the src/target bitwidth == SPIRVTypeConverter::getIndexType() by just removing this op? OpSConvert requires the source and target bitwidth to be different. Casting from index to i32 will result in an invalid OpSConvert. |
Comment Actions
Yeah the semantics of std.index_cast requires sign extending : https://mlir.llvm.org/docs/Dialects/Standard/#stdindex_cast-indexcastop
Comment Actions
Add test cases for casting between i32 and index.
mlir/lib/Conversion/StandardToSPIRV/ConvertStandardToSPIRV.cpp | ||
---|---|---|
773 | I think this case is already handled in TypeCastingOpPattern? auto dstType = this->typeConverter.convertType(operation.getResult().getType()); if (dstType == operands.front().getType()) { // Due to type conversion, we are seeing the same source and target type. // Then we can just erase this operation by forwarding its operand. rewriter.replaceOp(operation, operands.front()); } else { rewriter.template replaceOpWithNewOp<SPIRVOp>( operation, dstType, operands, ArrayRef<NamedAttribute>()); } The first condition will replace it with operand. Let me add more tests for this case. |
I think we need to special treat the case where the src/target bitwidth == SPIRVTypeConverter::getIndexType() by just removing this op? OpSConvert requires the source and target bitwidth to be different. Casting from index to i32 will result in an invalid OpSConvert.