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

Don't presume pointers are mutually exclusive for device/host. #6128

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions cpp/src/decisiontree/decisiontree.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,19 @@ inline bool is_dev_ptr(const void* p)
cudaPointerAttributes pointer_attr;
cudaError_t err = cudaPointerGetAttributes(&pointer_attr, p);
if (err == cudaSuccess) {
return pointer_attr.devicePointer;
return (pointer_attr.devicePointer || pointer_attr.type == cudaMemoryTypeDevice);
} else {
err = cudaGetLastError();
return false;
}
}

inline bool is_host_ptr(const void* p)
{
cudaPointerAttributes pointer_attr;
cudaError_t err = cudaPointerGetAttributes(&pointer_attr, p);
if (err == cudaSuccess) {
return (pointer_attr.hostPointer || pointer_attr.type == cudaMemoryTypeUnregistered);
} else {
err = cudaGetLastError();
return false;
Expand Down Expand Up @@ -355,7 +367,7 @@ class DecisionTree {
int verbosity)
{
if (verbosity >= 0) { ML::Logger::get().setLevel(verbosity); }
ASSERT(!is_dev_ptr(rows) && !is_dev_ptr(predictions),
ASSERT(is_host_ptr(rows) && is_host_ptr(predictions),
"DT Error: Current impl. expects both input and predictions to be CPU "
"pointers.\n");

Expand Down
Loading