Skip to content

Commit

Permalink
[luci] Casting to larger dtype before performing arithmetic (Samsung#…
Browse files Browse the repository at this point in the history
…12568)

This commit casts to larger dtype before performing arithmetic.

ONE-DCO-1.0-Signed-off-by: seongwoo <[email protected]>
  • Loading branch information
mhs4670go authored Jan 30, 2024
1 parent 6c07a76 commit c80233c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion compiler/luci/pass/src/helpers/SparsityFormatConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ uint64_t GetFlattenedIndex(const std::vector<int> &indices, const std::vector<in
int sub_elements = 1;
for (int i = shape.size() - 1; i >= 0; i--)
{
index += indices[i] * sub_elements;
assert(indices[i] >= 0);
assert(sub_elements >= 0);
index += static_cast<uint64_t>(indices[i]) * static_cast<uint64_t>(sub_elements);
sub_elements *= shape[i];
}
return index;
Expand Down

0 comments on commit c80233c

Please sign in to comment.