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

[Torch Dialect] Emit torch.aten.mul.float_int, add folder and conversion to Arith. #3750

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

giacs-epic
Copy link
Contributor

Folder is required to simplify the shape calculation of torch.aten.__interpolate.size_list_scale_list:

" %13 = torch.operator \"aten.mul.float_int\"(%11, %12) : (!torch.float, !torch.int) -> !torch.float \n"
" %14 = torch.aten.Int.float %13 : !torch.float -> !torch.int\n"
" %15 = torch.aten.append.t %3, %14 : !torch.list<int>, !torch.int -> !torch.list<int>\n"
" %16 = torch.aten.__getitem__.t %9, %int1 : !torch.list<float>, !torch.int -> !torch.float\n"
" %17 = torch.aten.__getitem__.t %arg0, %int3 : !torch.list<int>, !torch.int -> !torch.int\n"
" %18 = torch.operator \"aten.mul.float_int\"(%16, %17) : (!torch.float, !torch.int) -> !torch.float \n"
" %19 = torch.aten.Int.float %18 : !torch.float -> !torch.int\n"
" %20 = torch.aten.append.t %3, %19 : !torch.list<int>, !torch.int -> !torch.list<int>\n"

(I've re-run build_tools/update_abstract_interp_lib.sh)

Copy link
Collaborator

@zjgarvey zjgarvey left a comment

Choose a reason for hiding this comment

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

Thanks! Similar comments as on the other PR.

// CHECK-SAME: %[[RHS:.*]]: !torch.int) -> !torch.float {
// CHECK-DAG: %[[LHS_F64:.*]] = torch_c.to_f64 %[[LHS]]
// CHECK-DAG: %[[RHS_I64:.*]] = torch_c.to_i64 %[[RHS]]
// CHECK: %[[MUL:.*]] = arith.mulf %[[LHS_F64:.*]], [[RHS_I64:.*]] : f64
Copy link
Collaborator

Choose a reason for hiding this comment

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

Similar to the other PR, I'm certain there is an additional arith.sitofp op, and the arguments for arith.mulf shouldn't be assignments of variables.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correcting here as well.

lib/Dialect/Torch/IR/TorchOps.cpp Show resolved Hide resolved
Copy link
Collaborator

@zjgarvey zjgarvey left a comment

Choose a reason for hiding this comment

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

I made some suggestions. Ping me when you make those and I'll approve the PR.

test/Conversion/TorchToArith/basic.mlir Outdated Show resolved Hide resolved
qingyunqu pushed a commit that referenced this pull request Nov 20, 2024
…shape calculation of `upsample_nearest2d`) (#3764)

As per title. See also
[PR](#3750) for
`torch.aten.mul.float_int`.

---------

Co-authored-by: zjgarvey <[email protected]>
qingyunqu pushed a commit that referenced this pull request Nov 21, 2024
…shape calculation of `upsample_nearest2d`) (#3764)

As per title. See also
[PR](#3750) for
`torch.aten.mul.float_int`.

---------

Co-authored-by: zjgarvey <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants