From e8b2fdab9664f8b9e768ef55721c9775fc8c3c32 Mon Sep 17 00:00:00 2001 From: Ioannis Assiouras Date: Mon, 16 Dec 2024 12:02:56 +0000 Subject: [PATCH] SWDEV-483134 - Remove hipExtHostAlloc API Change-Id: I60777ef5c56b60dd8100d0d794ca10fb3b96a555 --- CHANGELOG.md | 1 - hipamd/include/hip/amd_detail/hip_prof_str.h | 26 -------------------- hipamd/src/amdhip.def | 1 - hipamd/src/hip_api_trace.cpp | 3 +-- hipamd/src/hip_hcc.map.in | 9 +------ hipamd/src/hip_memory.cpp | 20 ++++----------- hipamd/src/hip_table_interface.cpp | 3 --- rocclr/utils/flags.hpp | 2 +- 8 files changed, 8 insertions(+), 57 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ed339c64c..ec071a9575 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,7 +25,6 @@ Full documentation for HIP is available at [rocm.docs.amd.com](https://rocm.docs - `hipDrvGraphAddMemFreeNode` creates a memory free node and adds it to a graph. - `hipDrvGraphExecMemcpyNodeSetParams` sets the parameters for a memcpy node in the given graphExec. - `hipDrvGraphExecMemsetNodeSetParams` sets the parameters for a memset node in the given graphExec. - - `hipExtHostAlloc` preserves the functionality of `hipHostMalloc`. ### Resolved issues diff --git a/hipamd/include/hip/amd_detail/hip_prof_str.h b/hipamd/include/hip/amd_detail/hip_prof_str.h index a7658cfc38..f25c782dd9 100644 --- a/hipamd/include/hip/amd_detail/hip_prof_str.h +++ b/hipamd/include/hip/amd_detail/hip_prof_str.h @@ -677,7 +677,6 @@ static inline const char* hip_api_name(const uint32_t id) { case HIP_API_ID_hipHostGetDevicePointer: return "hipHostGetDevicePointer"; case HIP_API_ID_hipHostGetFlags: return "hipHostGetFlags"; case HIP_API_ID_hipHostMalloc: return "hipHostMalloc"; - case HIP_API_ID_hipExtHostAlloc: return "hipExtHostAlloc"; case HIP_API_ID_hipHostRegister: return "hipHostRegister"; case HIP_API_ID_hipHostUnregister: return "hipHostUnregister"; case HIP_API_ID_hipImportExternalMemory: return "hipImportExternalMemory"; @@ -1086,7 +1085,6 @@ static inline uint32_t hipApiIdByName(const char* name) { if (strcmp("hipHostGetDevicePointer", name) == 0) return HIP_API_ID_hipHostGetDevicePointer; if (strcmp("hipHostGetFlags", name) == 0) return HIP_API_ID_hipHostGetFlags; if (strcmp("hipHostMalloc", name) == 0) return HIP_API_ID_hipHostMalloc; - if (strcmp("hipExtHostAlloc", name) == 0) return HIP_API_ID_hipExtHostAlloc; if (strcmp("hipHostRegister", name) == 0) return HIP_API_ID_hipHostRegister; if (strcmp("hipHostUnregister", name) == 0) return HIP_API_ID_hipHostUnregister; if (strcmp("hipImportExternalMemory", name) == 0) return HIP_API_ID_hipImportExternalMemory; @@ -2481,12 +2479,6 @@ typedef struct hip_api_data_s { size_t size; unsigned int flags; } hipHostMalloc; - struct { - void** ptr; - void* ptr__val; - size_t size; - unsigned int flags; - } hipExtHostAlloc; struct { void* hostPtr; size_t sizeBytes; @@ -4878,12 +4870,6 @@ typedef struct hip_api_data_s { cb_data.args.hipHostMalloc.size = (size_t)sizeBytes; \ cb_data.args.hipHostMalloc.flags = (unsigned int)flags; \ }; -// hipExtHostAlloc[('void**', 'ptr'), ('size_t', 'size'), ('unsigned int', 'flags')] -#define INIT_hipExtHostAlloc_CB_ARGS_DATA(cb_data) { \ - cb_data.args.hipExtHostAlloc.ptr = (void**)ptr; \ - cb_data.args.hipExtHostAlloc.size = (size_t)sizeBytes; \ - cb_data.args.hipExtHostAlloc.flags = (unsigned int)flags; \ -}; // hipHostRegister[('void*', 'hostPtr'), ('size_t', 'sizeBytes'), ('unsigned int', 'flags')] #define INIT_hipHostRegister_CB_ARGS_DATA(cb_data) { \ cb_data.args.hipHostRegister.hostPtr = (void*)hostPtr; \ @@ -7013,10 +6999,6 @@ static inline void hipApiArgsInit(hip_api_id_t id, hip_api_data_t* data) { case HIP_API_ID_hipHostMalloc: if (data->args.hipHostMalloc.ptr) data->args.hipHostMalloc.ptr__val = *(data->args.hipHostMalloc.ptr); break; -// hipExtHostAlloc[('void**', 'ptr'), ('size_t', 'size'), ('unsigned int', 'flags')] - case HIP_API_ID_hipExtHostAlloc: - if (data->args.hipExtHostAlloc.ptr) data->args.hipExtHostAlloc.ptr__val = *(data->args.hipExtHostAlloc.ptr); - break; // hipHostRegister[('void*', 'hostPtr'), ('size_t', 'sizeBytes'), ('unsigned int', 'flags')] case HIP_API_ID_hipHostRegister: break; @@ -9390,14 +9372,6 @@ static inline const char* hipApiString(hip_api_id_t id, const hip_api_data_t* da oss << ", flags="; roctracer::hip_support::detail::operator<<(oss, data->args.hipHostMalloc.flags); oss << ")"; break; - case HIP_API_ID_hipExtHostAlloc: - oss << "hipExtHostAlloc("; - if (data->args.hipExtHostAlloc.ptr == NULL) oss << "ptr=NULL"; - else { oss << "ptr="; roctracer::hip_support::detail::operator<<(oss, data->args.hipExtHostAlloc.ptr__val); } - oss << ", size="; roctracer::hip_support::detail::operator<<(oss, data->args.hipExtHostAlloc.size); - oss << ", flags="; roctracer::hip_support::detail::operator<<(oss, data->args.hipExtHostAlloc.flags); - oss << ")"; - break; case HIP_API_ID_hipHostRegister: oss << "hipHostRegister("; oss << "hostPtr="; roctracer::hip_support::detail::operator<<(oss, data->args.hipHostRegister.hostPtr); diff --git a/hipamd/src/amdhip.def b/hipamd/src/amdhip.def index b8dbd49323..5327ac5628 100644 --- a/hipamd/src/amdhip.def +++ b/hipamd/src/amdhip.def @@ -479,7 +479,6 @@ hipGraphNodeSetParams hipGraphExecNodeSetParams hipDrvGraphMemcpyNodeSetParams hipDrvGraphMemcpyNodeGetParams -hipExtHostAlloc hipStreamBatchMemOp hipGraphAddBatchMemOpNode hipGraphBatchMemOpNodeGetParams diff --git a/hipamd/src/hip_api_trace.cpp b/hipamd/src/hip_api_trace.cpp index 6d0e27d7ad..eefe147e46 100644 --- a/hipamd/src/hip_api_trace.cpp +++ b/hipamd/src/hip_api_trace.cpp @@ -350,7 +350,6 @@ hipError_t hipHostFree(void* ptr); hipError_t hipHostGetDevicePointer(void** devPtr, void* hstPtr, unsigned int flags); hipError_t hipHostGetFlags(unsigned int* flagsPtr, void* hostPtr); hipError_t hipHostMalloc(void** ptr, size_t size, unsigned int flags); -hipError_t hipExtHostAlloc(void** ptr, size_t size, unsigned int flags); hipError_t hipHostRegister(void* hostPtr, size_t sizeBytes, unsigned int flags); hipError_t hipHostUnregister(void* hostPtr); hipError_t hipImportExternalMemory(hipExternalMemory_t* extMem_out, @@ -1041,7 +1040,7 @@ void UpdateDispatchTable(HipDispatchTable* ptrDispatchTable) { ptrDispatchTable->hipHostGetDevicePointer_fn = hip::hipHostGetDevicePointer; ptrDispatchTable->hipHostGetFlags_fn = hip::hipHostGetFlags; ptrDispatchTable->hipHostMalloc_fn = hip::hipHostMalloc; - ptrDispatchTable->hipExtHostAlloc_fn = hip::hipExtHostAlloc; + ptrDispatchTable->hipExtHostAlloc_fn = nullptr; ptrDispatchTable->hipHostRegister_fn = hip::hipHostRegister; ptrDispatchTable->hipHostUnregister_fn = hip::hipHostUnregister; ptrDispatchTable->hipImportExternalMemory_fn = hip::hipImportExternalMemory; diff --git a/hipamd/src/hip_hcc.map.in b/hipamd/src/hip_hcc.map.in index 8cf57d6b53..290f5d7f68 100644 --- a/hipamd/src/hip_hcc.map.in +++ b/hipamd/src/hip_hcc.map.in @@ -580,13 +580,6 @@ local: *; } hip_6.1; -hip_6.3 { -global: - hipExtHostAlloc; -local: - *; -} hip_6.2; - hip_6.4 { global: hipGraphAddBatchMemOpNode; @@ -595,4 +588,4 @@ global: hipGraphExecBatchMemOpNodeSetParams; local: *; -} hip_6.3; +} hip_6.2; diff --git a/hipamd/src/hip_memory.cpp b/hipamd/src/hip_memory.cpp index 917e03ec7d..09a435e149 100644 --- a/hipamd/src/hip_memory.cpp +++ b/hipamd/src/hip_memory.cpp @@ -385,7 +385,7 @@ hipError_t ihipHostMalloc(void** ptr, size_t sizeBytes, unsigned int flags) } *ptr = nullptr; - const unsigned int coherentFlags = hipExtHostAllocCoherent | hipExtHostAllocNonCoherent; + const unsigned int coherentFlags = hipHostMallocCoherent | hipHostMallocNonCoherent; // can't have both Coherent and NonCoherent flags set at the same time if ((flags & coherentFlags) == coherentFlags) { @@ -398,16 +398,16 @@ hipError_t ihipHostMalloc(void** ptr, size_t sizeBytes, unsigned int flags) unsigned int ihipFlags = CL_MEM_SVM_FINE_GRAIN_BUFFER; if (flags == 0 || - flags & (hipExtHostAllocCoherent | hipHostAllocMapped | hipExtHostAllocNumaUser) || - (!(flags & hipExtHostAllocNonCoherent) && HIP_HOST_COHERENT)) { + flags & (hipHostMallocCoherent | hipHostMallocMapped | hipHostMallocNumaUser) || + (!(flags & hipHostMallocNonCoherent) && HIP_HOST_COHERENT)) { ihipFlags |= CL_MEM_SVM_ATOMICS; } - if (flags & hipExtHostAllocNumaUser) { + if (flags & hipHostMallocNumaUser) { ihipFlags |= CL_MEM_FOLLOW_USER_NUMA_POLICY; } - if (flags & hipExtHostAllocNonCoherent) { + if (flags & hipHostMallocNonCoherent) { ihipFlags &= ~CL_MEM_SVM_ATOMICS; } @@ -768,16 +768,6 @@ hipError_t hipHostMalloc(void** ptr, size_t sizeBytes, unsigned int flags) { HIP_RETURN_DURATION(status, ReturnPtrValue(ptr)); } -hipError_t hipExtHostAlloc(void** ptr, size_t sizeBytes, unsigned int flags) { - HIP_INIT_API(hipExtHostAlloc, ptr, sizeBytes, flags); - CHECK_STREAM_CAPTURE_SUPPORTED(); - if (ptr == nullptr) { - HIP_RETURN(hipErrorInvalidValue); - } - hipError_t status = ihipHostMalloc(ptr, sizeBytes, flags); - HIP_RETURN_DURATION(status, ReturnPtrValue(ptr)); -} - hipError_t hipFree(void* ptr) { HIP_INIT_API(hipFree, ptr); CHECK_STREAM_CAPTURE_SUPPORTED(); diff --git a/hipamd/src/hip_table_interface.cpp b/hipamd/src/hip_table_interface.cpp index 1ee51926f4..3d142ff5a2 100644 --- a/hipamd/src/hip_table_interface.cpp +++ b/hipamd/src/hip_table_interface.cpp @@ -1820,9 +1820,6 @@ hipError_t hipDrvGraphMemcpyNodeSetParams(hipGraphNode_t hNode, const HIP_MEMCPY hipError_t hipGraphNodeSetParams(hipGraphNode_t node, hipGraphNodeParams *nodeParams) { return hip::GetHipDispatchTable()->hipGraphNodeSetParams_fn(node, nodeParams); } -hipError_t hipExtHostAlloc(void** ptr, size_t size, unsigned int flags) { - return hip::GetHipDispatchTable()->hipExtHostAlloc_fn(ptr, size, flags); -} hipError_t hipGraphAddBatchMemOpNode(hipGraphNode_t* pGraphNode, hipGraph_t graph, const hipGraphNode_t* dependencies, size_t numDependencies, const hipBatchMemOpNodeParams* nodeParams) { diff --git a/rocclr/utils/flags.hpp b/rocclr/utils/flags.hpp index 8d60e3ae28..56130f75ab 100644 --- a/rocclr/utils/flags.hpp +++ b/rocclr/utils/flags.hpp @@ -176,7 +176,7 @@ release(uint, HIP_LAUNCH_BLOCKING, 0, \ release(bool, PAL_ALWAYS_RESIDENT, false, \ "Force memory resources to become resident at allocation time") \ release(uint, HIP_HOST_COHERENT, 0, \ - "Coherent memory in hipExtHostAlloc, 0x1 = memory is coherent with host"\ + "Coherent memory in hipHostMalloc, 0x1 = memory is coherent with host"\ "0x0 = memory is not coherent between host and GPU") \ release(uint, AMD_OPT_FLUSH, 1, \ "Kernel flush option , 0x0 = Use system-scope fence operations." \