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

Move away from Memory management APIs deprecated in ROCM 6.3 #71

Open
wants to merge 2 commits into
base: rocm6.3_internal_testing
Choose a base branch
from
Open
Show file tree
Hide file tree
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
6 changes: 5 additions & 1 deletion onnxruntime/core/providers/migraphx/migraphx_allocator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,17 @@
void* HIPPinnedAllocator::Alloc(size_t size) {
void* p = nullptr;
if (size > 0) {
#ifdef hipExtHostAllocCoherent
HIP_CALL_THROW(hipExtHostAlloc((void**)&p, size));

Check warning on line 75 in onnxruntime/core/providers/migraphx/migraphx_allocator.cc

View workflow job for this annotation

GitHub Actions / cpplint

[cpplint] onnxruntime/core/providers/migraphx/migraphx_allocator.cc#L75

Using C-style cast. Use reinterpret_cast<void**>(...) instead [readability/casting] [4]
Raw output
onnxruntime/core/providers/migraphx/migraphx_allocator.cc:75:  Using C-style cast.  Use reinterpret_cast<void**>(...) instead  [readability/casting] [4]
#else
HIP_CALL_THROW(hipHostMalloc((void**)&p, size));
#endif
}
return p;
}

void HIPPinnedAllocator::Free(void* p) {
HIP_CALL_THROW(hipHostFree(p));
HIP_CALL_THROW(hipFreeHost(p));
}

} // namespace onnxruntime
6 changes: 5 additions & 1 deletion onnxruntime/core/providers/rocm/rocm_allocator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,17 @@
void* ROCMPinnedAllocator::Alloc(size_t size) {
void* p = nullptr;
if (size > 0) {
#ifdef hipExtHostAllocCoherent
HIP_CALL_THROW(hipExtHostAlloc((void**)&p, size));

Check warning on line 93 in onnxruntime/core/providers/rocm/rocm_allocator.cc

View workflow job for this annotation

GitHub Actions / cpplint

[cpplint] onnxruntime/core/providers/rocm/rocm_allocator.cc#L93

Using C-style cast. Use reinterpret_cast<void**>(...) instead [readability/casting] [4]
Raw output
onnxruntime/core/providers/rocm/rocm_allocator.cc:93:  Using C-style cast.  Use reinterpret_cast<void**>(...) instead  [readability/casting] [4]
#else
HIP_CALL_THROW(hipHostMalloc((void**)&p, size));
#endif
}
return p;
}

void ROCMPinnedAllocator::Free(void* p) {
HIP_CALL_THROW(hipHostFree(p));
HIP_CALL_THROW(hipFreeHost(p));
}

} // namespace onnxruntime
14 changes: 7 additions & 7 deletions tools/ci_build/hipify-perl
Original file line number Diff line number Diff line change
Expand Up @@ -3541,14 +3541,14 @@ sub simpleSubstitutions {
subst("cuIpcOpenEventHandle", "hipIpcOpenEventHandle", "memory");
subst("cuIpcOpenMemHandle", "hipIpcOpenMemHandle", "memory");
subst("cuMemAlloc", "hipMalloc", "memory");
subst("cuMemAllocHost", "hipMemAllocHost", "memory");
subst("cuMemAllocHost_v2", "hipMemAllocHost", "memory");
subst("cuMemAllocHost", "hipHostAlloc", "memory");
subst("cuMemAllocHost_v2", "hipHostAlloc", "memory");
subst("cuMemAllocManaged", "hipMallocManaged", "memory");
subst("cuMemAllocPitch", "hipMemAllocPitch", "memory");
subst("cuMemAllocPitch_v2", "hipMemAllocPitch", "memory");
subst("cuMemAlloc_v2", "hipMalloc", "memory");
subst("cuMemFree", "hipFree", "memory");
subst("cuMemFreeHost", "hipHostFree", "memory");
subst("cuMemFreeHost", "hipFreeHost", "memory");
subst("cuMemFree_v2", "hipFree", "memory");
subst("cuMemGetAddressRange", "hipMemGetAddressRange", "memory");
subst("cuMemGetAddressRange_v2", "hipMemGetAddressRange", "memory");
Expand Down Expand Up @@ -3603,7 +3603,7 @@ sub simpleSubstitutions {
subst("cudaFree", "hipFree", "memory");
subst("cudaFreeArray", "hipFreeArray", "memory");
subst("cudaFreeAsync", "hipFreeAsync", "memory");
subst("cudaFreeHost", "hipHostFree", "memory");
subst("cudaFreeHost", "hipFreeHost", "memory");
subst("cudaFreeMipmappedArray", "hipFreeMipmappedArray", "memory");
subst("cudaGetMipmappedArrayLevel", "hipGetMipmappedArrayLevel", "memory");
subst("cudaGetSymbolAddress", "hipGetSymbolAddress", "memory");
Expand All @@ -3619,7 +3619,7 @@ sub simpleSubstitutions {
subst("cudaMallocArray", "hipMallocArray", "memory");
subst("cudaMallocAsync", "hipMallocAsync", "memory");
subst("cudaMallocFromPoolAsync", "hipMallocFromPoolAsync", "memory");
subst("cudaMallocHost", "hipHostMalloc", "memory");
subst("cudaMallocHost", "hipExtHostAlloc", "memory");
subst("cudaMallocManaged", "hipMallocManaged", "memory");
subst("cudaMallocMipmappedArray", "hipMallocMipmappedArray", "memory");
subst("cudaMallocPitch", "hipMallocPitch", "memory");
Expand Down Expand Up @@ -3649,12 +3649,12 @@ sub simpleSubstitutions {
subst("cudaMemcpy3D", "hipMemcpy3D", "memory");
subst("cudaMemcpy3DAsync", "hipMemcpy3DAsync", "memory");
subst("cudaMemcpyAsync", "hipMemcpyAsync", "memory");
subst("cudaMemcpyFromArray", "hipMemcpyFromArray", "memory");
subst("cudaMemcpyFromArray", "hipMemcpy2DFromArray", "memory");
subst("cudaMemcpyFromSymbol", "hipMemcpyFromSymbol", "memory");
subst("cudaMemcpyFromSymbolAsync", "hipMemcpyFromSymbolAsync", "memory");
subst("cudaMemcpyPeer", "hipMemcpyPeer", "memory");
subst("cudaMemcpyPeerAsync", "hipMemcpyPeerAsync", "memory");
subst("cudaMemcpyToArray", "hipMemcpyToArray", "memory");
subst("cudaMemcpyToArray", "hipMemcpy2DToArray", "memory");
subst("cudaMemcpyToSymbol", "hipMemcpyToSymbol", "memory");
subst("cudaMemcpyToSymbolAsync", "hipMemcpyToSymbolAsync", "memory");
subst("cudaMemset", "hipMemset", "memory");
Expand Down
Loading