Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ambiguous call to min function #344

Merged
merged 1 commit into from
Mar 11, 2024

Conversation

umfranzw
Copy link
Collaborator

@umfranzw umfranzw commented Mar 4, 2024

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) - see this issue. 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.

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.
@yxsamliu
Copy link

do we have an estimation when this can get to master branch? thanks.

@stanleytsang-amd
Copy link
Collaborator

CI build errors look due to jenkins being unable to pull the last successful artifact from rocPRIM; i dont see how this PR could break anything, so i'll approve it. @umfranzw is this ready to be a non-draft PR?

@umfranzw umfranzw marked this pull request as ready for review March 11, 2024 19:28
@umfranzw
Copy link
Collaborator Author

Thanks @stanleytsang-amd, yes, I believe this is ready to go now.

@umfranzw umfranzw merged commit d96d883 into ROCm:develop Mar 11, 2024
12 of 17 checks passed
@@ -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);
Copy link

@yxsamliu yxsamliu May 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the fix does not work.

should be

size_t block_size = min(num_cols, static_cast<int>(DeviceSpmv::CsrMVKernel_MaxThreads));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants