Skip to content

Commit

Permalink
Fix ambiguous call to min function (#344)
Browse files Browse the repository at this point in the history
The CsrMV function currently makes a call to min(int, uint32_t).
Previously, clang headers only defined min(int, int), so this would
cause the second argument to be implicitly cast to int.

However, in the future Clang will add overloaded versions of min like
min(uint32_t, uint32_t). This will make the call ambiguous, since the
compiler does not know whether to cast the first argument to uint32_t,
or to cast the second argument to int.

This change adds an explicit cast here to prevent future problems.
  • Loading branch information
umfranzw authored Mar 11, 2024
1 parent 9a6a5af commit d96d883
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ template <typename ValueT>
}
else
{
size_t block_size = min(num_cols, DeviceSpmv::CsrMVKernel_MaxThreads);
size_t block_size = min(static_cast<int>(num_cols), DeviceSpmv::CsrMVKernel_MaxThreads);
size_t grid_size = num_rows;
CsrMVKernel<<<grid_size, block_size, 0, stream>>>(spmv_params);
status = hipGetLastError();
Expand Down

0 comments on commit d96d883

Please sign in to comment.