From 955b224ea0423a960f15c8a098bc4ce6ddf76602 Mon Sep 17 00:00:00 2001 From: foreman Date: Mon, 30 Dec 2019 16:46:39 -0500 Subject: [PATCH] P4 to Git Change 2051060 by michliao@hliao-dev-00-hip.rocm-workspace on 2019/12/30 16:42:07 SWDEV-145570 - Clean up after `hipError_t` unification. - Replace deprecated `hipError_t` enums. Affected files ... ... //depot/stg/opencl/drivers/opencl/api/hip/hip_device_runtime.cpp#24 edit ... //depot/stg/opencl/drivers/opencl/api/hip/hip_error.cpp#4 edit ... //depot/stg/opencl/drivers/opencl/api/hip/hip_event.cpp#19 edit ... //depot/stg/opencl/drivers/opencl/api/hip/hip_memory.cpp#94 edit ... //depot/stg/opencl/drivers/opencl/api/hip/hip_module.cpp#52 edit ... //depot/stg/opencl/drivers/opencl/api/hip/hip_stream.cpp#27 edit ... //depot/stg/opencl/drivers/opencl/api/hip/hip_texture.cpp#32 edit ... //depot/stg/opencl/drivers/opencl/api/hip/trace_helper.h#5 edit --- hipamd/api/hip/hip_device_runtime.cpp | 2 +- hipamd/api/hip/hip_error.cpp | 6 ------ hipamd/api/hip/hip_event.cpp | 22 +++++++++++----------- hipamd/api/hip/hip_memory.cpp | 8 ++++---- hipamd/api/hip/hip_module.cpp | 2 +- hipamd/api/hip/hip_stream.cpp | 6 +++--- hipamd/api/hip/hip_texture.cpp | 4 ++-- hipamd/api/hip/trace_helper.h | 3 --- 8 files changed, 22 insertions(+), 31 deletions(-) diff --git a/hipamd/api/hip/hip_device_runtime.cpp b/hipamd/api/hip/hip_device_runtime.cpp index a36cad8c3b..1abefdf609 100644 --- a/hipamd/api/hip/hip_device_runtime.cpp +++ b/hipamd/api/hip/hip_device_runtime.cpp @@ -535,7 +535,7 @@ hipError_t hipExtGetLinkTypeAndHopCount(int device1, int device2, uint32_t* link amd_dev_obj2 = g_devices[device2]->devices()[0]; if (!amd_dev_obj1->findLinkTypeAndHopCount(amd_dev_obj2, linktype, hopcount)) { - HIP_RETURN(hipErrorInvalidResourceHandle); + HIP_RETURN(hipErrorInvalidHandle); } HIP_RETURN(hipSuccess); diff --git a/hipamd/api/hip/hip_error.cpp b/hipamd/api/hip/hip_error.cpp index 77b1b8148a..6c0a01e215 100644 --- a/hipamd/api/hip/hip_error.cpp +++ b/hipamd/api/hip/hip_error.cpp @@ -114,10 +114,6 @@ const char *hipGetErrorName(hipError_t hip_error) return "hipErrorIllegalAddress"; case hipErrorMissingConfiguration: return "hipErrorMissingConfiguration"; - case hipErrorMemoryAllocation: - return "hipErrorMemoryAllocation"; - case hipErrorInitializationError: - return "hipErrorInitializationError"; case hipErrorLaunchFailure: return "hipErrorLaunchFailure"; case hipErrorPriorLaunchFailure: @@ -140,8 +136,6 @@ const char *hipGetErrorName(hipError_t hip_error) return "hipErrorInvalidMemcpyDirection"; case hipErrorUnknown: return "hipErrorUnknown"; - case hipErrorInvalidResourceHandle: - return "hipErrorInvalidResourceHandle"; case hipErrorNotReady: return "hipErrorNotReady"; case hipErrorNoDevice: diff --git a/hipamd/api/hip/hip_event.cpp b/hipamd/api/hip/hip_event.cpp index f283aa6c5d..1de32d8fff 100644 --- a/hipamd/api/hip/hip_event.cpp +++ b/hipamd/api/hip/hip_event.cpp @@ -36,7 +36,7 @@ hipError_t Event::query() { amd::ScopedLock lock(lock_); if (event_ == nullptr) { - return hipErrorInvalidResourceHandle; + return hipErrorInvalidHandle; } return ready() ? hipSuccess : hipErrorNotReady; @@ -46,7 +46,7 @@ hipError_t Event::synchronize() { amd::ScopedLock lock(lock_); if (event_ == nullptr) { - return hipErrorInvalidResourceHandle; + return hipErrorInvalidHandle; } event_->awaitCompletion(); @@ -59,11 +59,11 @@ hipError_t Event::elapsedTime(Event& eStop, float& ms) { if (this == &eStop) { if (event_ == nullptr) { - return hipErrorInvalidResourceHandle; + return hipErrorInvalidHandle; } if (flags & hipEventDisableTiming) { - return hipErrorInvalidResourceHandle; + return hipErrorInvalidHandle; } if (!ready()) { @@ -77,11 +77,11 @@ hipError_t Event::elapsedTime(Event& eStop, float& ms) { if (event_ == nullptr || eStop.event_ == nullptr) { - return hipErrorInvalidResourceHandle; + return hipErrorInvalidHandle; } if ((flags | eStop.flags) & hipEventDisableTiming) { - return hipErrorInvalidResourceHandle; + return hipErrorInvalidHandle; } if (!ready() || !eStop.ready()) { @@ -173,7 +173,7 @@ hipError_t ihipEventCreateWithFlags(hipEvent_t* event, unsigned flags) { hipError_t ihipEventQuery(hipEvent_t event) { if (event == nullptr) { - return hipErrorInvalidResourceHandle; + return hipErrorInvalidHandle; } hip::Event* e = reinterpret_cast(event); @@ -197,7 +197,7 @@ hipError_t hipEventDestroy(hipEvent_t event) { HIP_INIT_API(hipEventDestroy, event); if (event == nullptr) { - HIP_RETURN(hipErrorInvalidResourceHandle); + HIP_RETURN(hipErrorInvalidHandle); } delete reinterpret_cast(event); @@ -209,7 +209,7 @@ hipError_t hipEventElapsedTime(float *ms, hipEvent_t start, hipEvent_t stop) { HIP_INIT_API(hipEventElapsedTime, ms, start, stop); if (start == nullptr || stop == nullptr) { - HIP_RETURN(hipErrorInvalidResourceHandle); + HIP_RETURN(hipErrorInvalidHandle); } if (ms == nullptr) { @@ -226,7 +226,7 @@ hipError_t hipEventRecord(hipEvent_t event, hipStream_t stream) { HIP_INIT_API(hipEventRecord, event, stream); if (event == nullptr) { - HIP_RETURN(hipErrorInvalidResourceHandle); + HIP_RETURN(hipErrorInvalidHandle); } hip::Event* e = reinterpret_cast(event); @@ -249,7 +249,7 @@ hipError_t hipEventSynchronize(hipEvent_t event) { HIP_INIT_API(hipEventSynchronize, event); if (event == nullptr) { - HIP_RETURN(hipErrorInvalidResourceHandle); + HIP_RETURN(hipErrorInvalidHandle); } hip::Event* e = reinterpret_cast(event); diff --git a/hipamd/api/hip/hip_memory.cpp b/hipamd/api/hip/hip_memory.cpp index 7e4b41aa5a..11e08384fc 100644 --- a/hipamd/api/hip/hip_memory.cpp +++ b/hipamd/api/hip/hip_memory.cpp @@ -70,11 +70,11 @@ hipError_t ihipMalloc(void** ptr, size_t sizeBytes, unsigned int flags) hip::host_context : hip::getCurrentContext(); if (amdContext == nullptr) { - return hipErrorMemoryAllocation; + return hipErrorOutOfMemory; } if (amdContext->devices()[0]->info().maxMemAllocSize_ < sizeBytes) { - return hipErrorMemoryAllocation; + return hipErrorOutOfMemory; } *ptr = amd::SvmBuffer::malloc(*amdContext, flags, sizeBytes, amdContext->devices()[0]->info().memBaseAddrAlign_); @@ -347,7 +347,7 @@ hipError_t ihipMallocPitch(void** ptr, size_t* pitch, size_t width, size_t heigh device->info().memBaseAddrAlign_); if (*ptr == nullptr) { - return hipErrorMemoryAllocation; + return hipErrorOutOfMemory; } return hipSuccess; @@ -552,7 +552,7 @@ hipError_t hipHostRegister(void* hostPtr, size_t sizeBytes, unsigned int flags) constexpr bool forceAlloc = true; if (!mem->create(hostPtr, sysMemAlloc, skipAlloc, forceAlloc)) { mem->release(); - HIP_RETURN(hipErrorMemoryAllocation); + HIP_RETURN(hipErrorOutOfMemory); } for (const auto& device: hip::getCurrentContext()->devices()) { diff --git a/hipamd/api/hip/hip_module.cpp b/hipamd/api/hip/hip_module.cpp index 91635fa12f..5d8774aea6 100644 --- a/hipamd/api/hip/hip_module.cpp +++ b/hipamd/api/hip/hip_module.cpp @@ -342,7 +342,7 @@ hipError_t ihipModuleLaunchKernel(hipFunction_t f, // Capture the kernel arguments if (CL_SUCCESS != command->captureAndValidate()) { delete command; - return hipErrorMemoryAllocation; + return hipErrorOutOfMemory; } command->enqueue(); diff --git a/hipamd/api/hip/hip_stream.cpp b/hipamd/api/hip/hip_stream.cpp index c500c663f0..d01a863980 100644 --- a/hipamd/api/hip/hip_stream.cpp +++ b/hipamd/api/hip/hip_stream.cpp @@ -183,7 +183,7 @@ hipError_t hipStreamDestroy(hipStream_t stream) { HIP_INIT_API(hipStreamDestroy, stream); if (stream == nullptr) { - HIP_RETURN(hipErrorInvalidResourceHandle); + HIP_RETURN(hipErrorInvalidHandle); } amd::ScopedLock lock(streamSetLock); @@ -210,7 +210,7 @@ hipError_t hipStreamWaitEvent(hipStream_t stream, hipEvent_t event, unsigned int } if (event == nullptr) { - HIP_RETURN(hipErrorInvalidResourceHandle); + HIP_RETURN(hipErrorInvalidHandle); } hip::Event* e = reinterpret_cast(event); @@ -252,7 +252,7 @@ hipError_t hipStreamAddCallback(hipStream_t stream, hipStreamCallback_t callback if(!event.setCallback(CL_COMPLETE, ihipStreamCallback, reinterpret_cast(cbo))) { command->release(); - return hipErrorInvalidResourceHandle; + return hipErrorInvalidHandle; } event.notifyCmdQueue(); diff --git a/hipamd/api/hip/hip_texture.cpp b/hipamd/api/hip/hip_texture.cpp index 8d7f7945bb..d48f5f2fcf 100644 --- a/hipamd/api/hip/hip_texture.cpp +++ b/hipamd/api/hip/hip_texture.cpp @@ -371,7 +371,7 @@ hipError_t hipCreateTextureObject(hipTextureObject_t* pTexObject, const hipResou if (!image->create()) { delete image; - HIP_RETURN(hipErrorMemoryAllocation); + HIP_RETURN(hipErrorOutOfMemory); } amd::Sampler* sampler = fillSamplerDescriptor(pTexDesc->addressMode[0], pTexDesc->filterMode, pTexDesc->normalizedCoords); @@ -467,7 +467,7 @@ hipError_t ihipBindTexture(cl_mem_object_type type, type, memory->getMemFlags(), imageFormat, width, height, depth, rowPitch, slicePitch); if (!image->create()) { delete image; - return hipErrorMemoryAllocation; + return hipErrorOutOfMemory; } *offset = 0; diff --git a/hipamd/api/hip/trace_helper.h b/hipamd/api/hip/trace_helper.h index 650ee89422..5beb3f34e4 100644 --- a/hipamd/api/hip/trace_helper.h +++ b/hipamd/api/hip/trace_helper.h @@ -77,8 +77,6 @@ inline const char* ihipErrorString(hipError_t hip_error) { CASE_STR(hipErrorNotFound); CASE_STR(hipErrorIllegalAddress); CASE_STR(hipErrorMissingConfiguration); - CASE_STR(hipErrorMemoryAllocation); - CASE_STR(hipErrorInitializationError); CASE_STR(hipErrorLaunchFailure); CASE_STR(hipErrorPriorLaunchFailure); CASE_STR(hipErrorLaunchTimeOut); @@ -90,7 +88,6 @@ inline const char* ihipErrorString(hipError_t hip_error) { CASE_STR(hipErrorInvalidDevicePointer); CASE_STR(hipErrorInvalidMemcpyDirection); CASE_STR(hipErrorUnknown); - CASE_STR(hipErrorInvalidResourceHandle); CASE_STR(hipErrorNotReady); CASE_STR(hipErrorNoDevice); CASE_STR(hipErrorPeerAccessAlreadyEnabled);