add logging
This commit is contained in:
parent
971d3ca8cd
commit
e8fceb8198
@ -62,43 +62,49 @@ void ArrayInterfaceHandler::SyncCudaStream(std::int64_t stream) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool ArrayInterfaceHandler::IsCudaPtr(void const* ptr) {
|
bool ArrayInterfaceHandler::IsCudaPtr(void const* ptr) {
|
||||||
|
LOG(INFO) << "Entering IsCudaPtr with ptr: " << ptr;
|
||||||
if (!ptr) {
|
if (!ptr) {
|
||||||
|
LOG(INFO) << "Pointer is null, returning false";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
// Check if the pointer is within the process's address space
|
||||||
|
uintptr_t ptr_value = reinterpret_cast<uintptr_t>(ptr);
|
||||||
|
uintptr_t process_max_addr = (uintptr_t)-1;
|
||||||
|
LOG(INFO) << "Pointer value: " << ptr_value << ", Max address: " << process_max_addr;
|
||||||
|
|
||||||
#if defined(XGBOOST_USE_HIP)
|
#if defined(XGBOOST_USE_HIP)
|
||||||
hipPointerAttribute_t attr;
|
hipPointerAttribute_t attr;
|
||||||
std::cerr << "Calling hipPointerGetAttributes" << std::endl;
|
LOG(INFO) << "Calling hipPointerGetAttributes";
|
||||||
auto err = hipPointerGetAttributes(&attr, ptr);
|
auto err = hipPointerGetAttributes(&attr, ptr);
|
||||||
|
|
||||||
std::cerr << "hipPointerGetAttributes returned: " << hipGetErrorString(err) << std::endl;
|
LOG(INFO) << "hipPointerGetAttributes returned: " << hipGetErrorString(err);
|
||||||
|
|
||||||
if (err == hipErrorInvalidValue) {
|
if (err == hipErrorInvalidValue) {
|
||||||
std::cerr << "Invalid pointer, returning false" << std::endl;
|
LOG(INFO) << "Invalid pointer (hipErrorInvalidValue), returning false";
|
||||||
return false;
|
return false;
|
||||||
} else if (err == hipSuccess) {
|
} else if (err == hipSuccess) {
|
||||||
std::cerr << "Pointer attributes obtained successfully" << std::endl;
|
LOG(INFO) << "Pointer attributes obtained successfully";
|
||||||
std::cerr << "Memory type: " << attr.type << std::endl;
|
LOG(INFO) << "Memory type: " << attr.type;
|
||||||
switch (attr.type) {
|
switch (attr.type) {
|
||||||
case hipMemoryTypeUnregistered:
|
case hipMemoryTypeUnregistered:
|
||||||
std::cerr << "Memory type is Unregistered, returning false" << std::endl;
|
LOG(INFO) << "Memory type is Unregistered, returning false";
|
||||||
return false;
|
return false;
|
||||||
case hipMemoryTypeHost:
|
case hipMemoryTypeHost:
|
||||||
std::cerr << "Memory type is Host, returning false" << std::endl;
|
LOG(INFO) << "Memory type is Host, returning false";
|
||||||
return false;
|
return false;
|
||||||
case hipMemoryTypeDevice:
|
case hipMemoryTypeDevice:
|
||||||
std::cerr << "Memory type is Device, returning true" << std::endl;
|
LOG(INFO) << "Memory type is Device, returning true";
|
||||||
return true;
|
return true;
|
||||||
case hipMemoryTypeManaged:
|
case hipMemoryTypeManaged:
|
||||||
std::cerr << "Memory type is Managed, returning true" << std::endl;
|
LOG(INFO) << "Memory type is Managed, returning true";
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
std::cerr << "Unknown memory type: " << attr.type << std::endl;
|
LOG(WARNING) << "Unknown memory type: " << attr.type;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
std::cerr << "hipPointerGetAttributes failed with error: "
|
LOG(WARNING) << "hipPointerGetAttributes failed with error: "
|
||||||
<< hipGetErrorString(err) << std::endl;
|
<< hipGetErrorString(err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#elif defined(XGBOOST_USE_CUDA)
|
#elif defined(XGBOOST_USE_CUDA)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user