Skip to content

Commit

Permalink
[MLIR] Fix 64-bit product during aten.view lowering (llvm#3378)
Browse files Browse the repository at this point in the history
std::accumulate needs 64-bit init value to perform 64-bit arithmetic on
a list of integers.

Signed-off-by: Gaurav Shukla <[email protected]>
  • Loading branch information
Shukla-Gaurav authored May 23, 2024
1 parent d924d00 commit 43f961e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/Conversion/TorchToLinalg/DataMovement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ using namespace mlir::torch;
using namespace mlir::torch::Torch;

static int64_t productReduce(ArrayRef<int64_t> a) {
return accumulate(a.begin(), a.end(), /*init=*/1, std::multiplies<int64_t>());
return accumulate(a.begin(), a.end(), /*init=*/static_cast<int64_t>(1),
std::multiplies<int64_t>());
}

template <typename OpTy, typename OpAdaptor>
Expand Down

0 comments on commit 43f961e

Please sign in to comment.