-
Notifications
You must be signed in to change notification settings - Fork 499
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.constant.int with large negative values causes error #3621
Comments
30 tasks
if you --print-ir-after-all do you get |
Yeah: // -----// IR Dump Before Canonicalizer (canonicalize) //----- //
module {
func.func @intfail() -> !torch.int {
%0 = torch.vtensor.literal(dense<-9223372036854775807> : tensor<1xsi64>) : !torch.vtensor<[1],si64>
%1 = torch.aten.item %0 : !torch.vtensor<[1],si64> -> !torch.int
return %1 : !torch.int
}
}
// -----// IR Dump Before ConvertTorchToArith (convert-torch-to-arith) //----- //
func.func @intfail() -> !torch.int {
%int-9223372036854775807 = torch.constant.int -9223372036854775807
return %int-9223372036854775807 : !torch.int
}
module {
func.func @intfail() -> !torch.int {
%c-9223372036854775807_i64 = arith.constant -9223372036854775807 : i64
%0 = torch_c.from_i64 %c-9223372036854775807_i64
return %0 : !torch.int
}
}
|
zjgarvey
added a commit
to nod-ai/SHARK-TestSuite
that referenced
this issue
Oct 11, 2024
I would normally add all of the torch related stuff to the "onnx-to-torch-backend-pipeline" but there is a common issue with slice ops having an int that's too big only when saving/loading an mlir file at the torch level. See <llvm/torch-mlir#3621>. Also adds a few models to the basic opt list, since they would need a whole 'nother cycle of shape inference and scalarization to clean themselves up. Good to know that it is possible to clean these up at the torch level though!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Reproduction instructions:
Save this reproducer to
repro.mlir
:run
repro2.mlir
should containIf you try
It returns
repro2.mlir:3:51: error: custom op 'torch.constant.int' integer value too large %int-9223372036854775807 = torch.constant.int -9223372036854775807
However, running from the original
repro.mlir
:generates valid IR:
It seems like an error with parsing the constant int op? I'm not sure what is going on here.
The text was updated successfully, but these errors were encountered: