/** * @return #hipSuccess, #hipErrorInvalidResourceHandle */ hipError_t hipStreamDestroy(hipStream_t stream) { HIP_INIT_API(stream); hipError_t e = hipSuccess; //--- Drain the stream: if (stream == NULL) { ihipDevice_t *device = ihipGetTlsDefaultDevice(); device->locked_syncDefaultStream(true/*waitOnSelf*/); } else { stream->locked_wait(); e = hipSuccess; } ihipDevice_t *device = stream->getDevice(); if (device) { device->locked_removeStream(stream); delete stream; } else { e = hipErrorInvalidResourceHandle; } return ihipLogStatus(e); }
/** * @return #hipSuccess, #hipErrorInvalidResourceHandle */ hipError_t hipStreamDestroy(hipStream_t stream) { HIP_INIT_API(hipStreamDestroy, stream); hipError_t e = hipSuccess; //--- Drain the stream: if (stream == NULL) { if (!HIP_FORCE_NULL_STREAM) { e = hipErrorInvalidResourceHandle; } } else { stream->locked_wait(); ihipCtx_t* ctx = stream->getCtx(); if (ctx) { ctx->locked_removeStream(stream); delete stream; } else { e = hipErrorInvalidResourceHandle; } } return ihipLogStatus(e); }
/** * @bug This function conservatively waits for all work in the specified stream to complete. */ hipError_t hipStreamWaitEvent(hipStream_t stream, hipEvent_t event, unsigned int flags) { HIP_INIT_API(stream, event, flags); hipError_t e = hipSuccess; { // TODO-hcc Convert to use create_blocking_marker(...) functionality. // Currently we have a super-conservative version of this - block on host, and drain the queue. // This should create a barrier packet in the target queue. stream->locked_wait(); e = hipSuccess; } return ihipLogStatus(e); };
//--- hipError_t hipStreamSynchronize(hipStream_t stream) { HIP_INIT_API(stream); hipError_t e = hipSuccess; if (stream == NULL) { ihipDevice_t *device = ihipGetTlsDefaultDevice(); device->locked_syncDefaultStream(true/*waitOnSelf*/); } else { stream->locked_wait(); e = hipSuccess; } return ihipLogStatus(e); };