Skip to content

Commit b5f3490

Browse files
authored
nvfuserex: return cumsum result in int64 when input is int/bool and result dtypes is not specified (#2418)
1 parent 77b6091 commit b5f3490

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

thunder/executors/nvfuserex_impl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3139,7 +3139,7 @@ def cumsum_transform(
31393139
compute_dtype = lcdtype_to_nvdtype(a.dtype)
31403140

31413141
if dtype is None:
3142-
out_dtype = lcdtype_to_nvdtype(a.dtype)
3142+
out_dtype = lcdtype_to_nvdtype(a.dtype if a.dtype not in dtypes.integer_dtypes else dtypes.int64)
31433143
else:
31443144
out_dtype = lcdtype_to_nvdtype(dtypes.to_dtype(dtype))
31453145

thunder/tests/opinfos.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6265,8 +6265,8 @@ def cumsum_sample_generator(op, device, dtype, requires_grad, **kwargs):
62656265

62666266
for shape, dim in cases:
62676267
# torch.cumsum not implemented for dtype='Bool'
6268-
output_dtype = torch.float if dtype is torch.bool else dtype
6269-
yield (SampleInput(make(shape), dim, dtype=output_dtype))
6268+
for output_dtype in (None, torch.float if dtype is torch.bool else dtype):
6269+
yield (SampleInput(make(shape), dim, dtype=output_dtype))
62706270

62716271

62726272
cumsum_opinfo = OpInfo(

0 commit comments

Comments
 (0)