Skip to content

Commit 452315c

Browse files
drisspgpytorchmergebot
authored andcommitted
Fix RuntimeError: value cannot be converted to type int64_t without overflow (pytorch#147492)
The exact call is coming from here: https://github.com/pytorch/pytorch/blob/78a94c911435bf9b1bb45888033a29081e406ec2/torch/_inductor/memory.py#L161 I have no idea why this error is being thrown and what mode/modes might be failing for this Pull Request resolved: pytorch#147492 Approved by: https://github.com/eellison
1 parent a000c7e commit 452315c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

torch/_inductor/utils.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -969,6 +969,10 @@ def evaluate(expr: Union[bool, torch.SymInt, sympy.Expr]) -> bool:
969969

970970
@functools.lru_cache(8)
971971
def get_dtype_size(dtype: torch.dtype) -> int:
972+
# TODO: Investigate why uint64 tensor creation causes overflow error:
973+
# Workaround for RuntimeError in memory size calculation, but underlying cause unclear
974+
if dtype == torch.uint64:
975+
return 8
972976
return torch.empty((), dtype=dtype).element_size()
973977

974978

0 commit comments

Comments
 (0)