[HIP] Clean-up deprecated HIP error codes

hipErrorMemoryAllocation -> hipErrorOutOfMemory
hipErrorInitializationError -> hipErrorNotInitialized
hipErrorMapBufferObjectFailed -> hipErrorMapFailed
hipErrorInvalidResourceHandle -> hipErrorInvalidHandle


[ROCm/clr commit: 4aaa2336a8]
This commit is contained in:
Evgeny Mankov
2019-12-23 17:01:35 +03:00
rodzic 07db042750
commit d191980c6a
13 zmienionych plików z 112 dodań i 118 usunięć
@@ -444,7 +444,7 @@ hipError_t hipGetDeviceProperties(hipDeviceProp_t* prop, int deviceId);
*
* @param [in] cacheConfig
*
* @returns #hipSuccess, #hipErrorInitializationError
* @returns #hipSuccess, #hipErrorNotInitialized
* Note: AMD devices and some Nvidia GPUS do not support reconfigurable cache. This hint is ignored
* on those architectures.
*
@@ -457,7 +457,7 @@ hipError_t hipDeviceSetCacheConfig(hipFuncCache_t cacheConfig);
*
* @param [in] cacheConfig
*
* @returns #hipSuccess, #hipErrorInitializationError
* @returns #hipSuccess, #hipErrorNotInitialized
* Note: AMD devices and some Nvidia GPUS do not support reconfigurable cache. This hint is ignored
* on those architectures.
*
@@ -482,7 +482,7 @@ hipError_t hipDeviceGetLimit(size_t* pValue, enum hipLimit_t limit);
*
* @param [in] config;
*
* @returns #hipSuccess, #hipErrorInitializationError
* @returns #hipSuccess, #hipErrorNotInitialized
* Note: AMD devices and some Nvidia GPUS do not support reconfigurable cache. This hint is ignored
* on those architectures.
*
@@ -494,7 +494,7 @@ hipError_t hipFuncSetCacheConfig(const void* func, hipFuncCache_t config);
*
* @param [out] pConfig
*
* @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorInitializationError
* @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorNotInitialized
*
* Note: AMD devices and some Nvidia GPUS do not support shared cache banking, and the hint is
* ignored on those architectures.
@@ -508,7 +508,7 @@ hipError_t hipDeviceGetSharedMemConfig(hipSharedMemConfig* pConfig);
*
* @param [in] config
*
* @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorInitializationError
* @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorNotInitialized
*
* Note: AMD devices and some Nvidia GPUS do not support shared cache banking, and the hint is
* ignored on those architectures.
@@ -727,7 +727,7 @@ hipError_t hipDeviceGetStreamPriorityRange(int* leastPriority, int* greatestPrio
*
* @param[in, out] stream Valid pointer to hipStream_t. This function writes the memory with the
* newly created stream.
* @return #hipSuccess #hipErrorInvalidResourceHandle
* @return #hipSuccess #hipErrorInvalidHandle
*
* Destroys the specified stream.
*
@@ -749,7 +749,7 @@ hipError_t hipStreamDestroy(hipStream_t stream);
*
* @param[in] stream stream to query
*
* @return #hipSuccess, #hipErrorNotReady, #hipErrorInvalidResourceHandle
* @return #hipSuccess, #hipErrorNotReady, #hipErrorInvalidHandle
*
* This is thread-safe and returns a snapshot of the current state of the queue. However, if other
* host threads are sending work to the stream, the status may change immediately after the function
@@ -766,7 +766,7 @@ hipError_t hipStreamQuery(hipStream_t stream);
*
* @param[in] stream stream identifier.
*
* @return #hipSuccess, #hipErrorInvalidResourceHandle
* @return #hipSuccess, #hipErrorInvalidHandle
*
* This command is host-synchronous : the host will block until the specified stream is empty.
*
@@ -790,7 +790,7 @@ hipError_t hipStreamSynchronize(hipStream_t stream);
* @param[in] event event to wait on
* @param[in] flags control operation [must be 0]
*
* @return #hipSuccess, #hipErrorInvalidResourceHandle
* @return #hipSuccess, #hipErrorInvalidHandle
*
* This function inserts a wait operation into the specified stream.
* All future work submitted to @p stream will wait until @p event reports completion before
@@ -810,9 +810,9 @@ hipError_t hipStreamWaitEvent(hipStream_t stream, hipEvent_t event, unsigned int
*
* @param[in] stream stream to be queried
* @param[in,out] flags Pointer to an unsigned integer in which the stream's flags are returned
* @return #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidResourceHandle
* @return #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidHandle
*
* @returns #hipSuccess #hipErrorInvalidValue #hipErrorInvalidResourceHandle
* @returns #hipSuccess #hipErrorInvalidValue #hipErrorInvalidHandle
*
* Return flags associated with this stream in *@p flags.
*
@@ -826,9 +826,9 @@ hipError_t hipStreamGetFlags(hipStream_t stream, unsigned int* flags);
*
* @param[in] stream stream to be queried
* @param[in,out] priority Pointer to an unsigned integer in which the stream's priority is returned
* @return #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidResourceHandle
* @return #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidHandle
*
* @returns #hipSuccess #hipErrorInvalidValue #hipErrorInvalidResourceHandle
* @returns #hipSuccess #hipErrorInvalidValue #hipErrorInvalidHandle
*
* Query the priority of a stream. The priority is returned in in priority.
*
@@ -851,7 +851,7 @@ typedef void (*hipStreamCallback_t)(hipStream_t stream, hipError_t status, void*
* @param[in] callback - The function to call once preceding stream operations are complete
* @param[in] userData - User specified data to be passed to the callback function
* @param[in] flags - Reserved for future use, must be 0
* @return #hipSuccess, #hipErrorInvalidResourceHandle, #hipErrorNotSupported
* @return #hipSuccess, #hipErrorInvalidHandle, #hipErrorNotSupported
*
* @see hipStreamCreate, hipStreamCreateWithFlags, hipStreamQuery, hipStreamSynchronize,
* hipStreamWaitEvent, hipStreamDestroy, hipStreamCreateWithPriority
@@ -893,8 +893,8 @@ hipError_t hipStreamAddCallback(hipStream_t stream, hipStreamCallback_t callback
* @warning On HCC platform, hipEventInterprocess support is under development. Use of this flag
will return an error.
*
* @returns #hipSuccess, #hipErrorInitializationError, #hipErrorInvalidValue,
#hipErrorLaunchFailure, #hipErrorMemoryAllocation
* @returns #hipSuccess, #hipErrorNotInitialized, #hipErrorInvalidValue,
#hipErrorLaunchFailure, #hipErrorOutOfMemory
*
* @see hipEventCreate, hipEventSynchronize, hipEventDestroy, hipEventElapsedTime
*/
@@ -906,8 +906,8 @@ hipError_t hipEventCreateWithFlags(hipEvent_t* event, unsigned flags);
*
* @param[in,out] event Returns the newly created event.
*
* @returns #hipSuccess, #hipErrorInitializationError, #hipErrorInvalidValue,
* #hipErrorLaunchFailure, #hipErrorMemoryAllocation
* @returns #hipSuccess, #hipErrorNotInitialized, #hipErrorInvalidValue,
* #hipErrorLaunchFailure, #hipErrorOutOfMemory
*
* @see hipEventCreateWithFlags, hipEventRecord, hipEventQuery, hipEventSynchronize,
* hipEventDestroy, hipEventElapsedTime
@@ -920,8 +920,8 @@ hipError_t hipEventCreate(hipEvent_t* event);
*
* @param[in] event event to record.
* @param[in] stream stream in which to record event.
* @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorInitializationError,
* #hipErrorInvalidResourceHandle, #hipErrorLaunchFailure
* @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorNotInitialized,
* #hipErrorInvalidHandle, #hipErrorLaunchFailure
*
* hipEventQuery() or hipEventSynchronize() must be used to determine when the event
* transitions from "recording" (after hipEventRecord() is called) to "recorded"
@@ -952,7 +952,7 @@ hipError_t hipEventRecord(hipEvent_t event, hipStream_t stream);
* @brief Destroy the specified event.
*
* @param[in] event Event to destroy.
* @returns #hipSuccess, #hipErrorInitializationError, #hipErrorInvalidValue,
* @returns #hipSuccess, #hipErrorNotInitialized, #hipErrorInvalidValue,
* #hipErrorLaunchFailure
*
* Releases memory associated with the event. If the event is recording but has not completed
@@ -978,8 +978,8 @@ hipError_t hipEventDestroy(hipEvent_t event);
* TODO-hcc - This function needs to support hipEventBlockingSync parameter.
*
* @param[in] event Event on which to wait.
* @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorInitializationError,
* #hipErrorInvalidResourceHandle, #hipErrorLaunchFailure
* @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorNotInitialized,
* #hipErrorInvalidHandle, #hipErrorLaunchFailure
*
* @see hipEventCreate, hipEventCreateWithFlags, hipEventQuery, hipEventDestroy, hipEventRecord,
* hipEventElapsedTime
@@ -993,8 +993,8 @@ hipError_t hipEventSynchronize(hipEvent_t event);
* @param[out] ms : Return time between start and stop in ms.
* @param[in] start : Start event.
* @param[in] stop : Stop event.
* @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorNotReady, #hipErrorInvalidResourceHandle,
* #hipErrorInitializationError, #hipErrorLaunchFailure
* @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorNotReady, #hipErrorInvalidHandle,
* #hipErrorNotInitialized, #hipErrorLaunchFailure
*
* Computes the elapsed time between two events. Time is computed in ms, with
* a resolution of approximately 1 us.
@@ -1007,7 +1007,7 @@ hipError_t hipEventSynchronize(hipEvent_t event);
* commands in that stream have completed executing. Thus the time that
* the event recorded may be significantly after the host calls hipEventRecord().
*
* If hipEventRecord() has not been called on either event, then #hipErrorInvalidResourceHandle is
* If hipEventRecord() has not been called on either event, then #hipErrorInvalidHandle is
* returned. If hipEventRecord() has been called on both events, but the timestamp has not yet been
* recorded on one or both events (that is, hipEventQuery() would return #hipErrorNotReady on at
* least one of the events), then #hipErrorNotReady is returned.
@@ -1022,8 +1022,8 @@ hipError_t hipEventElapsedTime(float* ms, hipEvent_t start, hipEvent_t stop);
* @brief Query event status
*
* @param[in] event Event to query.
* @returns #hipSuccess, #hipErrorNotReady, #hipErrorInvalidResourceHandle, #hipErrorInvalidValue,
* #hipErrorInitializationError, #hipErrorLaunchFailure
* @returns #hipSuccess, #hipErrorNotReady, #hipErrorInvalidHandle, #hipErrorInvalidValue,
* #hipErrorNotInitialized, #hipErrorLaunchFailure
*
* Query the status of the specified event. This function will return #hipErrorNotReady if all
* commands in the appropriate stream (specified to hipEventRecord()) have completed. If that work
@@ -1077,7 +1077,7 @@ hipError_t hipPointerGetAttributes(hipPointerAttribute_t* attributes, const void
*
* If size is 0, no memory is allocated, *ptr returns nullptr, and hipSuccess is returned.
*
* @return #hipSuccess, #hipErrorMemoryAllocation, #hipErrorInvalidValue (bad context, null *ptr)
* @return #hipSuccess, #hipErrorOutOfMemory, #hipErrorInvalidValue (bad context, null *ptr)
*
* @see hipMallocPitch, hipFree, hipMallocArray, hipFreeArray, hipMalloc3D, hipMalloc3DArray,
* hipHostFree, hipHostMalloc
@@ -1093,7 +1093,7 @@ hipError_t hipMalloc(void** ptr, size_t size);
*
* If size is 0, no memory is allocated, *ptr returns nullptr, and hipSuccess is returned.
*
* @return #hipSuccess, #hipErrorMemoryAllocation, #hipErrorInvalidValue (bad context, null *ptr)
* @return #hipSuccess, #hipErrorOutOfMemory, #hipErrorInvalidValue (bad context, null *ptr)
*
* @see hipMallocPitch, hipFree, hipMallocArray, hipFreeArray, hipMalloc3D, hipMalloc3DArray,
* hipHostFree, hipHostMalloc
@@ -1108,7 +1108,7 @@ hipError_t hipExtMallocWithFlags(void** ptr, size_t sizeBytes, unsigned int flag
*
* If size is 0, no memory is allocated, *ptr returns nullptr, and hipSuccess is returned.
*
* @return #hipSuccess, #hipErrorMemoryAllocation
* @return #hipSuccess, #hipErrorOutOfMemory
*
* @deprecated use hipHostMalloc() instead
*/
@@ -1123,7 +1123,7 @@ hipError_t hipMallocHost(void** ptr, size_t size);
*
* If size is 0, no memory is allocated, *ptr returns nullptr, and hipSuccess is returned.
*
* @return #hipSuccess, #hipErrorMemoryAllocation
* @return #hipSuccess, #hipErrorOutOfMemory
*
* @deprecated use hipHostMalloc() instead
*/
@@ -1139,7 +1139,7 @@ hipError_t hipMemAllocHost(void** ptr, size_t size);
*
* If size is 0, no memory is allocated, *ptr returns nullptr, and hipSuccess is returned.
*
* @return #hipSuccess, #hipErrorMemoryAllocation
* @return #hipSuccess, #hipErrorOutOfMemory
*
* @see hipSetDeviceFlags, hipHostFree
*/
@@ -1152,7 +1152,7 @@ hipError_t hipHostMalloc(void** ptr, size_t size, unsigned int flags);
* @param[in] size Requested memory size
* @param[in] flags must be either hipMemAttachGlobal/hipMemAttachHost
*
* @return #hipSuccess, #hipErrorMemoryAllocation
* @return #hipSuccess, #hipErrorOutOfMemory
*/
hipError_t hipMallocManaged(void** devPtr, size_t size, unsigned int flags __dparm(0));
@@ -1165,7 +1165,7 @@ hipError_t hipMallocManaged(void** devPtr, size_t size, unsigned int flags __dpa
*
* If size is 0, no memory is allocated, *ptr returns nullptr, and hipSuccess is returned.
*
* @return #hipSuccess, #hipErrorMemoryAllocation
* @return #hipSuccess, #hipErrorOutOfMemory
*
* @deprecated use hipHostMalloc() instead
*/
@@ -1179,7 +1179,7 @@ hipError_t hipHostAlloc(void** ptr, size_t size, unsigned int flags);
* @param[in] hstPtr Host Pointer allocated through hipHostMalloc
* @param[in] flags Flags to be passed for extension
*
* @return #hipSuccess, #hipErrorInvalidValue, #hipErrorMemoryAllocation
* @return #hipSuccess, #hipErrorInvalidValue, #hipErrorOutOfMemory
*
* @see hipSetDeviceFlags, hipHostMalloc
*/
@@ -1228,7 +1228,7 @@ hipError_t hipHostGetFlags(unsigned int* flagsPtr, void* hostPtr);
* typically one of the writes will "win" and overwrite data from the other registered memory
* region.
*
* @return #hipSuccess, #hipErrorMemoryAllocation
* @return #hipSuccess, #hipErrorOutOfMemory
*
* @see hipHostUnregister, hipHostGetFlags, hipHostGetDevicePointer
*/
@@ -1909,7 +1909,7 @@ hipError_t hipMemPtrGetInfo(void* ptr, size_t* size);
* @param[in] width Requested array allocation width
* @param[in] height Requested array allocation height
* @param[in] flags Requested properties of allocated array
* @return #hipSuccess, #hipErrorMemoryAllocation
* @return #hipSuccess, #hipErrorOutOfMemory
*
* @see hipMalloc, hipMallocPitch, hipFree, hipFreeArray, hipHostMalloc, hipHostFree
*/
@@ -1925,7 +1925,7 @@ hipError_t hipMalloc3D(hipPitchedPtr* pitchedDevPtr, hipExtent extent);
* @brief Frees an array on the device.
*
* @param[in] array Pointer to array to free
* @return #hipSuccess, #hipErrorInvalidValue, #hipErrorInitializationError
* @return #hipSuccess, #hipErrorInvalidValue, #hipErrorNotInitialized
*
* @see hipMalloc, hipMallocPitch, hipFree, hipMallocArray, hipHostMalloc, hipHostFree
*/
@@ -1938,7 +1938,7 @@ hipError_t hipFreeArray(hipArray* array);
* @param[in] desc Requested channel format
* @param[in] extent Requested array allocation width, height and depth
* @param[in] flags Requested properties of allocated array
* @return #hipSuccess, #hipErrorMemoryAllocation
* @return #hipSuccess, #hipErrorOutOfMemory
*
* @see hipMalloc, hipMallocPitch, hipFree, hipFreeArray, hipHostMalloc, hipHostFree
*/
@@ -3036,9 +3036,9 @@ hipError_t hipProfilerStop();
*
* @returns
* hipSuccess,
* hipErrorInvalidResourceHandle,
* hipErrorMemoryAllocation,
* hipErrorMapBufferObjectFailed,
* hipErrorInvalidHandle,
* hipErrorOutOfMemory,
* hipErrorMapFailed,
*
*/
hipError_t hipIpcGetMemHandle(hipIpcMemHandle_t* handle, void* devPtr);
@@ -3071,8 +3071,8 @@ hipError_t hipIpcGetMemHandle(hipIpcMemHandle_t* handle, void* devPtr);
*
* @returns
* hipSuccess,
* hipErrorMapBufferObjectFailed,
* hipErrorInvalidResourceHandle,
* hipErrorMapFailed,
* hipErrorInvalidHandle,
* hipErrorTooManyPeers
*
* @note No guarantees are made about the address returned in @p *devPtr.
@@ -3095,8 +3095,8 @@ hipError_t hipIpcOpenMemHandle(void** devPtr, hipIpcMemHandle_t handle, unsigned
*
* @returns
* hipSuccess,
* hipErrorMapBufferObjectFailed,
* hipErrorInvalidResourceHandle,
* hipErrorMapFailed,
* hipErrorInvalidHandle,
*
*/
hipError_t hipIpcCloseMemHandle(void* devPtr);
@@ -262,9 +262,9 @@ inline static hipError_t hipCUDAErrorTohipError(cudaError_t cuError) {
case cudaErrorMissingConfiguration:
return hipErrorMissingConfiguration;
case cudaErrorMemoryAllocation:
return hipErrorMemoryAllocation;
return hipErrorOutOfMemory;
case cudaErrorInitializationError:
return hipErrorInitializationError;
return hipErrorNotInitialized;
case cudaErrorLaunchFailure:
return hipErrorLaunchFailure;
case cudaErrorPriorLaunchFailure:
@@ -286,7 +286,7 @@ inline static hipError_t hipCUDAErrorTohipError(cudaError_t cuError) {
case cudaErrorUnknown:
return hipErrorUnknown;
case cudaErrorInvalidResourceHandle:
return hipErrorInvalidResourceHandle;
return hipErrorInvalidHandle;
case cudaErrorNotReady:
return hipErrorNotReady;
case cudaErrorNoDevice:
@@ -300,7 +300,7 @@ inline static hipError_t hipCUDAErrorTohipError(cudaError_t cuError) {
case cudaErrorHostMemoryNotRegistered:
return hipErrorHostMemoryNotRegistered;
case cudaErrorMapBufferObjectFailed:
return hipErrorMapBufferObjectFailed;
return hipErrorMapFailed;
case cudaErrorAssert:
return hipErrorAssert;
case cudaErrorNotSupported:
@@ -315,7 +315,7 @@ inline static hipError_t hipCUResultTohipError(CUresult cuError) { // TODO Popu
case CUDA_SUCCESS:
return hipSuccess;
case CUDA_ERROR_OUT_OF_MEMORY:
return hipErrorMemoryAllocation;
return hipErrorOutOfMemory;
case CUDA_ERROR_INVALID_VALUE:
return hipErrorInvalidValue;
case CUDA_ERROR_INVALID_DEVICE:
@@ -328,6 +328,10 @@ inline static hipError_t hipCUResultTohipError(CUresult cuError) { // TODO Popu
return hipErrorInvalidContext;
case CUDA_ERROR_NOT_INITIALIZED:
return hipErrorNotInitialized;
case CUDA_ERROR_INVALID_HANDLE:
return hipErrorInvalidHandle;
case CUDA_ERROR_MAP_FAILED:
return hipErrorMapFailed;
default:
return hipErrorUnknown; // Note - translated error.
}
@@ -338,13 +342,13 @@ inline static cudaError_t hipErrorToCudaError(hipError_t hError) {
switch (hError) {
case hipSuccess:
return cudaSuccess;
case hipErrorMemoryAllocation:
case hipErrorOutOfMemory:
return cudaErrorMemoryAllocation;
case hipErrorLaunchOutOfResources:
return cudaErrorLaunchOutOfResources;
case hipErrorInvalidValue:
return cudaErrorInvalidValue;
case hipErrorInvalidResourceHandle:
case hipErrorInvalidHandle:
return cudaErrorInvalidResourceHandle;
case hipErrorInvalidDevice:
return cudaErrorInvalidDevice;
@@ -352,7 +356,7 @@ inline static cudaError_t hipErrorToCudaError(hipError_t hError) {
return cudaErrorInvalidMemcpyDirection;
case hipErrorInvalidDevicePointer:
return cudaErrorInvalidDevicePointer;
case hipErrorInitializationError:
case hipErrorNotInitialized:
return cudaErrorInitializationError;
case hipErrorNoDevice:
return cudaErrorNoDevice;
@@ -63,9 +63,9 @@ int main(int argc, char* argv[]) {
printf("info: allocate host mem (%6.2f MB)\n", 2 * Nbytes / 1024.0 / 1024.0);
A_h = (uint32_t*)malloc(Nbytes);
CHECK(A_h == 0 ? hipErrorMemoryAllocation : hipSuccess);
CHECK(A_h == 0 ? hipErrorOutOfMemory : hipSuccess);
C_h = (uint32_t*)malloc(Nbytes);
CHECK(C_h == 0 ? hipErrorMemoryAllocation : hipSuccess);
CHECK(C_h == 0 ? hipErrorOutOfMemory : hipSuccess);
for (size_t i = 0; i < N; i++) {
A_h[i] = i;
@@ -62,9 +62,9 @@ int main(int argc, char* argv[]) {
#endif
printf("info: allocate host mem (%6.2f MB)\n", 2 * Nbytes / 1024.0 / 1024.0);
A_h = (float*)malloc(Nbytes);
CHECK(A_h == 0 ? hipErrorMemoryAllocation : hipSuccess);
CHECK(A_h == 0 ? hipErrorOutOfMemory : hipSuccess);
C_h = (float*)malloc(Nbytes);
CHECK(C_h == 0 ? hipErrorMemoryAllocation : hipSuccess);
CHECK(C_h == 0 ? hipErrorOutOfMemory : hipSuccess);
// Fill with Phi + i
for (size_t i = 0; i < N; i++) {
A_h[i] = 1.618f + i;
+9 -9
Wyświetl plik
@@ -103,10 +103,10 @@ hipError_t hipEventCreate(hipEvent_t* event) {
hipError_t hipEventRecord(hipEvent_t event, hipStream_t stream) {
HIP_INIT_SPECIAL_API(hipEventRecord, TRACE_SYNC, event, stream);
if (!event) return ihipLogStatus(hipErrorInvalidResourceHandle);
if (!event) return ihipLogStatus(hipErrorInvalidHandle);
stream = ihipSyncAndResolveStream(stream);
LockedAccessor_EventCrit_t eCrit(event->criticalData());
if (eCrit->_eventData._state == hipEventStatusUnitialized) return ihipLogStatus(hipErrorInvalidResourceHandle);
if (eCrit->_eventData._state == hipEventStatusUnitialized) return ihipLogStatus(hipErrorInvalidHandle);
if (HIP_SYNC_NULL_STREAM && stream->isDefaultStream()) {
// TODO-HIP_SYNC_NULL_STREAM : can remove this code when HIP_SYNC_NULL_STREAM = 0
// If default stream , then wait on all queues.
@@ -136,7 +136,7 @@ hipError_t hipEventDestroy(hipEvent_t event) {
return ihipLogStatus(hipSuccess);
} else {
return ihipLogStatus(hipErrorInvalidResourceHandle);
return ihipLogStatus(hipErrorInvalidHandle);
}
}
@@ -152,7 +152,7 @@ hipError_t hipEventSynchronize(hipEvent_t event) {
auto ecd = event->locked_copyCrit();
if (ecd._state == hipEventStatusUnitialized) {
return ihipLogStatus(hipErrorInvalidResourceHandle);
return ihipLogStatus(hipErrorInvalidHandle);
} else if (ecd._state == hipEventStatusCreated) {
// Created but not actually recorded on any device:
return ihipLogStatus(hipSuccess);
@@ -167,7 +167,7 @@ hipError_t hipEventSynchronize(hipEvent_t event) {
return ihipLogStatus(hipSuccess);
}
} else {
return ihipLogStatus(hipErrorInvalidResourceHandle);
return ihipLogStatus(hipErrorInvalidHandle);
}
}
@@ -175,7 +175,7 @@ hipError_t hipEventElapsedTime(float* ms, hipEvent_t start, hipEvent_t stop) {
HIP_INIT_API(hipEventElapsedTime, ms, start, stop);
if (ms == nullptr) return ihipLogStatus(hipErrorInvalidValue);
if ((start == nullptr) || (stop == nullptr)) return ihipLogStatus(hipErrorInvalidResourceHandle);
if ((start == nullptr) || (stop == nullptr)) return ihipLogStatus(hipErrorInvalidHandle);
*ms = 0.0f;
auto startEcd = start->locked_copyCrit();
@@ -187,8 +187,8 @@ hipError_t hipEventElapsedTime(float* ms, hipEvent_t start, hipEvent_t stop) {
(stop->_flags & hipEventDisableTiming) ||
(stopEcd._state == hipEventStatusUnitialized) ||
(stopEcd._state == hipEventStatusCreated)) {
// Both events must be at least recorded else return hipErrorInvalidResourceHandle
return ihipLogStatus(hipErrorInvalidResourceHandle);
// Both events must be at least recorded else return hipErrorInvalidHandle
return ihipLogStatus(hipErrorInvalidHandle);
}
// Refresh status, if still recording...
@@ -222,7 +222,7 @@ hipError_t hipEventElapsedTime(float* ms, hipEvent_t start, hipEvent_t stop) {
hipError_t hipEventQuery(hipEvent_t event) {
HIP_INIT_SPECIAL_API(hipEventQuery, TRACE_QUERY, event);
if (!event) return ihipLogStatus(hipErrorInvalidResourceHandle);
if (!event) return ihipLogStatus(hipErrorInvalidHandle);
if (!(event->_flags & hipEventReleaseToSystem)) {
tprintf(DB_WARN,
-10
Wyświetl plik
@@ -1756,13 +1756,8 @@ const char* ihipErrorString(hipError_t hip_error) {
return "hipErrorIllegalAddress";
case hipErrorInvalidSymbol:
return "hipErrorInvalidSymbol";
case hipErrorMissingConfiguration:
return "hipErrorMissingConfiguration";
case hipErrorMemoryAllocation:
return "hipErrorMemoryAllocation";
case hipErrorInitializationError:
return "hipErrorInitializationError";
case hipErrorLaunchFailure:
return "hipErrorLaunchFailure";
case hipErrorPriorLaunchFailure:
@@ -1785,15 +1780,12 @@ const char* ihipErrorString(hipError_t hip_error) {
return "hipErrorInvalidMemcpyDirection";
case hipErrorUnknown:
return "hipErrorUnknown";
case hipErrorInvalidResourceHandle:
return "hipErrorInvalidResourceHandle";
case hipErrorNotReady:
return "hipErrorNotReady";
case hipErrorNoDevice:
return "hipErrorNoDevice";
case hipErrorPeerAccessAlreadyEnabled:
return "hipErrorPeerAccessAlreadyEnabled";
case hipErrorPeerAccessNotEnabled:
return "hipErrorPeerAccessNotEnabled";
case hipErrorRuntimeMemory:
@@ -1804,8 +1796,6 @@ const char* ihipErrorString(hipError_t hip_error) {
return "hipErrorHostMemoryAlreadyRegistered";
case hipErrorHostMemoryNotRegistered:
return "hipErrorHostMemoryNotRegistered";
case hipErrorMapBufferObjectFailed:
return "hipErrorMapBufferObjectFailed";
case hipErrorAssert:
return "hipErrorAssert";
case hipErrorNotSupported:
+17 -17
Wyświetl plik
@@ -199,7 +199,7 @@ hipError_t ihipHostMalloc(TlsData *tls, void** ptr, size_t sizeBytes, unsigned i
true /*shareWithAll*/, amFlags, flags, 0);
if (sizeBytes && (*ptr == NULL)) {
hip_status = hipErrorMemoryAllocation;
hip_status = hipErrorOutOfMemory;
}
}
}
@@ -328,7 +328,7 @@ hipError_t hipHostGetDevicePointer(void** devicePointer, void* hostPointer, unsi
tprintf(DB_MEM, " host_ptr=%p returned device_pointer=%p\n", hostPointer,
*devicePointer);
} else {
e = hipErrorMemoryAllocation;
e = hipErrorOutOfMemory;
}
}
return ihipLogStatus(e);
@@ -354,7 +354,7 @@ hipError_t hipMalloc(void** ptr, size_t sizeBytes) {
0 /*amFlags*/, 0 /*hipFlags*/, 0);
if (sizeBytes && (*ptr == NULL)) {
hip_status = hipErrorMemoryAllocation;
hip_status = hipErrorOutOfMemory;
}
}
@@ -389,11 +389,11 @@ hipError_t hipExtMallocWithFlags(void** ptr, size_t sizeBytes, unsigned int flag
amFlags /*amFlags*/, 0 /*hipFlags*/, 0);
if (sizeBytes && (*ptr == NULL)) {
hip_status = hipErrorMemoryAllocation;
hip_status = hipErrorOutOfMemory;
}
}
#else
hipError_t hip_status = hipErrorMemoryAllocation;
hipError_t hip_status = hipErrorOutOfMemory;
#endif
return ihipLogStatus(hip_status);
@@ -436,7 +436,7 @@ hipError_t allocImage(TlsData* tls,hsa_ext_image_geometry_t geometry, int width,
hc::accelerator acc = ctx->getDevice()->_acc;
hsa_agent_t* agent = static_cast<hsa_agent_t*>(acc.get_hsa_agent());
if (!agent)
return hipErrorInvalidResourceHandle;
return hipErrorInvalidHandle;
size_t allocGranularity = 0;
hsa_amd_memory_pool_t* allocRegion = static_cast<hsa_amd_memory_pool_t*>(acc.get_hsa_am_region());
hsa_amd_memory_pool_get_info(*allocRegion, HSA_AMD_MEMORY_POOL_INFO_RUNTIME_ALLOC_GRANULE, &allocGranularity);
@@ -461,12 +461,12 @@ hipError_t allocImage(TlsData* tls,hsa_ext_image_geometry_t geometry, int width,
*ptr = hip_internal::allocAndSharePtr("device_array", imageInfo.size, ctx,
false /*shareWithAll*/, am_flags, 0, alignment);
if (*ptr == NULL) {
return hipErrorMemoryAllocation;
return hipErrorOutOfMemory;
}
return hipSuccess;
}
else {
return hipErrorMemoryAllocation;
return hipErrorOutOfMemory;
}
}
@@ -565,7 +565,7 @@ hipError_t GetImageInfo(hsa_ext_image_geometry_t geometry,int width, int height,
hc::accelerator acc;
hsa_agent_t* agent = static_cast<hsa_agent_t*>(acc.get_hsa_agent());
if (!agent)
return hipErrorInvalidResourceHandle;
return hipErrorInvalidHandle;
hsa_status_t status =
hsa_ext_image_data_get_info_with_layout(*agent, &imageDescriptor, permission, HSA_EXT_IMAGE_DATA_LAYOUT_LINEAR, 0, 0, &imageInfo);
if(HSA_STATUS_SUCCESS != status){
@@ -860,7 +860,7 @@ hipError_t hipHostRegister(void* hostPtr, size_t sizeBytes, unsigned int flags)
if (am_status == AM_SUCCESS) {
hip_status = hipSuccess;
} else {
hip_status = hipErrorMemoryAllocation;
hip_status = hipErrorOutOfMemory;
}
} else {
hip_status = hipErrorInvalidValue;
@@ -2083,7 +2083,7 @@ hipError_t hipIpcGetMemHandle(hipIpcMemHandle_t* handle, void* devPtr) {
size_t psize = 0u;
hc::accelerator acc;
if ((handle == NULL) || (devPtr == NULL)) {
hipStatus = hipErrorInvalidResourceHandle;
hipStatus = hipErrorInvalidHandle;
} else {
#if (__hcc_workweek__ >= 17332)
hc::AmPointerInfo amPointerInfo(NULL, NULL, NULL, 0, acc, 0, 0);
@@ -2094,7 +2094,7 @@ hipError_t hipIpcGetMemHandle(hipIpcMemHandle_t* handle, void* devPtr) {
if (status == AM_SUCCESS) {
psize = (size_t)amPointerInfo._sizeBytes;
} else {
hipStatus = hipErrorInvalidResourceHandle;
hipStatus = hipErrorInvalidHandle;
}
ihipIpcMemHandle_t* iHandle = (ihipIpcMemHandle_t*)handle;
// Save the size of the pointer to hipIpcMemHandle
@@ -2104,7 +2104,7 @@ hipError_t hipIpcGetMemHandle(hipIpcMemHandle_t* handle, void* devPtr) {
// Create HSA ipc memory
hsa_status_t hsa_status =
hsa_amd_ipc_memory_create(devPtr, psize, (hsa_amd_ipc_memory_t*)&(iHandle->ipc_handle));
if (hsa_status != HSA_STATUS_SUCCESS) hipStatus = hipErrorMemoryAllocation;
if (hsa_status != HSA_STATUS_SUCCESS) hipStatus = hipErrorOutOfMemory;
#else
hipStatus = hipErrorRuntimeOther;
#endif
@@ -2123,7 +2123,7 @@ hipError_t hipIpcOpenMemHandle(void** devPtr, hipIpcMemHandle_t handle, unsigned
hc::accelerator acc;
hsa_agent_t* agent = static_cast<hsa_agent_t*>(acc.get_hsa_agent());
if (!agent)
return ihipLogStatus(hipErrorInvalidResourceHandle);
return ihipLogStatus(hipErrorInvalidHandle);
ihipIpcMemHandle_t* iHandle = (ihipIpcMemHandle_t*)&handle;
// Attach ipc memory
@@ -2140,7 +2140,7 @@ hipError_t hipIpcOpenMemHandle(void** devPtr, hipIpcMemHandle_t handle, unsigned
hc::AmPointerInfo ampi(NULL, *devPtr, *devPtr, sizeof(*devPtr), acc, true, true);
am_status_t am_status = hc::am_memtracker_add(*devPtr,ampi);
if (am_status != AM_SUCCESS)
return ihipLogStatus(hipErrorMapBufferObjectFailed);
return ihipLogStatus(hipErrorMapFailed);
#if USE_APP_PTR_FOR_CTX
am_status = hc::am_memtracker_update(*devPtr, device->_deviceId, 0, ctx);
@@ -2148,7 +2148,7 @@ hipError_t hipIpcOpenMemHandle(void** devPtr, hipIpcMemHandle_t handle, unsigned
am_status = hc::am_memtracker_update(*devPtr, device->_deviceId, 0);
#endif
if(am_status != AM_SUCCESS)
return ihipLogStatus(hipErrorMapBufferObjectFailed);
return ihipLogStatus(hipErrorMapFailed);
}
#else
hipStatus = hipErrorRuntimeOther;
@@ -2168,7 +2168,7 @@ hipError_t hipIpcCloseMemHandle(void* devPtr) {
return ihipLogStatus(hipErrorInvalidValue);
if (hsa_amd_ipc_memory_detach(devPtr) != HSA_STATUS_SUCCESS)
return ihipLogStatus(hipErrorInvalidResourceHandle);
return ihipLogStatus(hipErrorInvalidHandle);
#else
hipStatus = hipErrorRuntimeOther;
#endif
+6 -6
Wyświetl plik
@@ -133,7 +133,7 @@ hipError_t hipStreamWaitEvent(hipStream_t stream, hipEvent_t event, unsigned int
hipError_t e = hipSuccess;
if (event == nullptr) {
e = hipErrorInvalidResourceHandle;
e = hipErrorInvalidHandle;
} else {
auto ecd = event->locked_copyCrit();
@@ -189,7 +189,7 @@ hipError_t hipStreamSynchronize(hipStream_t stream) {
//---
/**
* @return #hipSuccess, #hipErrorInvalidResourceHandle
* @return #hipSuccess, #hipErrorInvalidHandle
*/
hipError_t hipStreamDestroy(hipStream_t stream) {
HIP_INIT_API(hipStreamDestroy, stream);
@@ -199,7 +199,7 @@ hipError_t hipStreamDestroy(hipStream_t stream) {
//--- Drain the stream:
if (stream == NULL) {
if (!HIP_FORCE_NULL_STREAM) {
e = hipErrorInvalidResourceHandle;
e = hipErrorInvalidHandle;
}
} else {
stream->locked_wait();
@@ -210,7 +210,7 @@ hipError_t hipStreamDestroy(hipStream_t stream) {
ctx->locked_removeStream(stream);
delete stream;
} else {
e = hipErrorInvalidResourceHandle;
e = hipErrorInvalidHandle;
}
}
@@ -225,7 +225,7 @@ hipError_t hipStreamGetFlags(hipStream_t stream, unsigned int* flags) {
if (flags == NULL) {
return ihipLogStatus(hipErrorInvalidValue);
} else if (stream == hipStreamNull) {
return ihipLogStatus(hipErrorInvalidResourceHandle);
return ihipLogStatus(hipErrorInvalidHandle);
} else {
*flags = stream->_flags;
return ihipLogStatus(hipSuccess);
@@ -240,7 +240,7 @@ hipError_t hipStreamGetPriority(hipStream_t stream, int* priority) {
if (priority == NULL) {
return ihipLogStatus(hipErrorInvalidValue);
} else if (stream == hipStreamNull) {
return ihipLogStatus(hipErrorInvalidResourceHandle);
return ihipLogStatus(hipErrorInvalidHandle);
} else {
#if defined(__HCC__) && (__hcc_major__ < 3) && (__hcc_minor__ < 3)
*priority = 0;
@@ -62,11 +62,11 @@ int launch_local_kernel() {
hipDeviceProp_t props;
CHECK(hipGetDeviceProperties(&props, device /*deviceID*/));
A_h = (float*)malloc(Nbytes);
CHECK(A_h == 0 ? hipErrorMemoryAllocation : hipSuccess);
CHECK(A_h == 0 ? hipErrorOutOfMemory : hipSuccess);
B_h = (float*)malloc(Nbytes);
CHECK(B_h == 0 ? hipErrorMemoryAllocation : hipSuccess);
CHECK(B_h == 0 ? hipErrorOutOfMemory : hipSuccess);
C_h = (float*)malloc(Nbytes);
CHECK(C_h == 0 ? hipErrorMemoryAllocation : hipSuccess);
CHECK(C_h == 0 ? hipErrorOutOfMemory : hipSuccess);
// Fill with Phi + i
for (size_t i = 0; i < N; i++) {
A_h[i] = 1.618f + i;
@@ -174,11 +174,11 @@ extern "C" int foo() {
hipDeviceProp_t props;
CHECK(hipGetDeviceProperties(&props, device /*deviceID*/));
A_h = (float*)malloc(Nbytes);
CHECK(A_h == 0 ? hipErrorMemoryAllocation : hipSuccess);
CHECK(A_h == 0 ? hipErrorOutOfMemory : hipSuccess);
B_h = (float*)malloc(Nbytes);
CHECK(B_h == 0 ? hipErrorMemoryAllocation : hipSuccess);
CHECK(B_h == 0 ? hipErrorOutOfMemory : hipSuccess);
C_h = (float*)malloc(Nbytes);
CHECK(C_h == 0 ? hipErrorMemoryAllocation : hipSuccess);
CHECK(C_h == 0 ? hipErrorOutOfMemory : hipSuccess);
// Fill with Phi + i
for (size_t i = 0; i < N; i++) {
A_h[i] = 1.618f + i;
@@ -133,14 +133,14 @@ void test(unsigned testMask, int* C_d, int* C_h, int64_t numElements, hipStream_
{
// Check some error conditions for incomplete events:
HIPCHECK_API(hipEventElapsedTime(&t, timingDisabled, stop), hipErrorInvalidResourceHandle);
HIPCHECK_API(hipEventElapsedTime(&t, start, timingDisabled), hipErrorInvalidResourceHandle);
HIPCHECK_API(hipEventElapsedTime(&t, timingDisabled, stop), hipErrorInvalidHandle);
HIPCHECK_API(hipEventElapsedTime(&t, start, timingDisabled), hipErrorInvalidHandle);
HIPCHECK_API(hipEventElapsedTime(&t, neverCreated, stop), hipErrorInvalidResourceHandle);
HIPCHECK_API(hipEventElapsedTime(&t, start, neverCreated), hipErrorInvalidResourceHandle);
HIPCHECK_API(hipEventElapsedTime(&t, neverCreated, stop), hipErrorInvalidHandle);
HIPCHECK_API(hipEventElapsedTime(&t, start, neverCreated), hipErrorInvalidHandle);
HIPCHECK_API(hipEventElapsedTime(&t, neverRecorded, stop), hipErrorInvalidResourceHandle);
HIPCHECK_API(hipEventElapsedTime(&t, start, neverRecorded), hipErrorInvalidResourceHandle);
HIPCHECK_API(hipEventElapsedTime(&t, neverRecorded, stop), hipErrorInvalidHandle);
HIPCHECK_API(hipEventElapsedTime(&t, start, neverRecorded), hipErrorInvalidHandle);
}
HIPCHECK(hipEventDestroy(start));
@@ -67,9 +67,9 @@ int main(int argc, char *argv[])
printf ("info: allocate host mem (%6.2f MB)\n", 2*Nbytes/1024.0/1024.0);
A_h = (float*)malloc(Nbytes);
HIPCHECK(A_h == 0 ? hipErrorMemoryAllocation : hipSuccess );
HIPCHECK(A_h == 0 ? hipErrorOutOfMemory : hipSuccess );
C_h = (float*)malloc(Nbytes);
HIPCHECK(C_h == 0 ? hipErrorMemoryAllocation : hipSuccess );
HIPCHECK(C_h == 0 ? hipErrorOutOfMemory : hipSuccess );
// Fill with Phi + i
for (size_t i = 0; i < N; i++)
{
@@ -60,9 +60,9 @@ int main(int argc, char* argv[]) {
size_t Nbytes = N * sizeof(float);
A_h = (float*)malloc(Nbytes);
HIPCHECK(A_h == 0 ? hipErrorMemoryAllocation : hipSuccess);
HIPCHECK(A_h == 0 ? hipErrorOutOfMemory : hipSuccess);
C_h = (float*)malloc(Nbytes);
HIPCHECK(C_h == 0 ? hipErrorMemoryAllocation : hipSuccess);
HIPCHECK(C_h == 0 ? hipErrorOutOfMemory : hipSuccess);
// Fill with Phi + i
for (size_t i = 0; i < N; i++) {
@@ -201,7 +201,7 @@ void runTests(int64_t numElements) {
int main(int argc, char* argv[]) {
// Can' destroy the default stream:// TODO - move to another test
HIPCHECK_API(hipStreamDestroy(0), hipErrorInvalidResourceHandle);
HIPCHECK_API(hipStreamDestroy(0), hipErrorInvalidHandle);
HipTest::parseStandardArguments(argc, argv, true /*failOnUndefinedArg*/);