Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tmtensor] Add support for i64 index type for tm_tensor.scatter #3687

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions lib/Conversion/TorchToTMTensor/TorchToTMTensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,6 @@ class ConvertAtenIndexPutHackedTwinOp
if (failed(verifyLinalgCompatibleTypes(op, rewriter)))
return failure();
Location loc = op.getLoc();
MLIRContext *context = op->getContext();
Value input = op.getSelf();
Value values = op.getValues();
auto inputType = cast<ValueTensorType>(input.getType());
Expand Down Expand Up @@ -915,9 +914,6 @@ class ConvertAtenIndexPutHackedTwinOp
rewriter.create<AtenViewOp>(loc, valuesType, values, valuesDimsList);

// `TMTensor::ScatterOp` expects indices of element type i32.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// `TMTensor::ScatterOp` expects indices of element type i32.

Seems this comment should be dropped as well.

indices = convertTensorToDtype(
rewriter, loc, indices,
mlir::IntegerType::get(context, 32, mlir::IntegerType::Signed));

input = typeConverter->materializeTargetConversion(
rewriter, loc, typeConverter->convertType(input.getType()), input);
Expand Down
5 changes: 3 additions & 2 deletions lib/Dialect/TMTensor/IR/TMTensorOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -543,8 +543,9 @@ LogicalResult ScatterOp::verify() {

auto indicesType = getIndicesType();
if (indicesType.getRank() != 2 ||
!indicesType.getElementType().isInteger(32)) {
return emitOpError("expected indices to be of rank 2 of i32 element type");
!isa<IntegerType>(indicesType.getElementType())) {
return emitOpError(
"expected indices to be of rank 2 of integer element type");
}
auto indexDepth = getIndexDepth();
if (ShapedType::isDynamic(indexDepth)) {
Expand Down
Loading