Open
Conversation
b3d35ec to
6f3c2fa
Compare
Artem-B
reviewed
Feb 26, 2024
External/HIP/host-min-max.hip
Outdated
| void compareResults(T1 hipResult, T2 stdResult, const std::string& testName) { | ||
| using CommonType = typename std::common_type<T1, T2>::type; | ||
| if (static_cast<CommonType>(hipResult) != static_cast<CommonType>(stdResult)) { | ||
| std::cerr << testName << " mismatch: HIP result " << hipResult << " (" << demangle(typeid(hipResult).name()) << "), std result " << stdResult << " (" << demangle(typeid(stdResult).name()) << ")" << std::endl; |
Member
There was a problem hiding this comment.
Those long lines could use some wrapping. It may be a good idea to just clang-format the sources.
External/HIP/host-min-max.hip
Outdated
| #include <cstdlib> // For std::abort | ||
| #include <typeinfo> // For typeid | ||
|
|
||
| std::string demangle(const char* name) { |
Member
There was a problem hiding this comment.
Nit: I'd just use some kind of map here. Else/ifs with explicit conversion to string just clutter things up. Not that it matters much here, but...
std::string demangle(const char *name) {
static std::pair<std::string, std::string> map[] = {{"f", "float"}, {"i", "int"}};
for (auto p : map) {
if (p.first == name)
return p.second;
}
return name;
}
External/HIP/host-min-max.hip
Outdated
| int main() { | ||
| checkHipCall(hipSetDevice(0), "hipSetDevice failed"); | ||
|
|
||
| runTest(10uLL, -5LL); // Testing with unsigned int and long long |
Member
There was a problem hiding this comment.
I do not know what would be the correct answer here, unless the user explicitly tells me that they do want to compare a negative signed value as an unsigned one.
Contributor
Author
There was a problem hiding this comment.
this assumes CUDA compatibility, which assumes the result of x<y?x:y with the implicit signed-to-unsigned conversion is correct. I can put a comment for clarification.
6f3c2fa to
6cb6a25
Compare
6cb6a25 to
6c0b6af
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.