-
Notifications
You must be signed in to change notification settings - Fork 326
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
Add HIP test host-min-max #100
base: main
Are you sure you want to change the base?
Conversation
b3d35ec
to
6f3c2fa
Compare
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those long lines could use some wrapping. It may be a good idea to just clang-format the sources.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will do
External/HIP/host-min-max.hip
Outdated
#include <cstdlib> // For std::abort | ||
#include <typeinfo> // For typeid | ||
|
||
std::string demangle(const char* name) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will do
External/HIP/host-min-max.hip
Outdated
int main() { | ||
checkHipCall(hipSetDevice(0), "hipSetDevice failed"); | ||
|
||
runTest(10uLL, -5LL); // Testing with unsigned int and long long |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
No description provided.