P4 to Git Change 1602601 by skudchad@skudchad_test2_win_opencl on 2018/09/06 15:01:00

SWDEV-145570 - [HIP] Implement hipStreamAddCallback and hipStreamQuery

	ReviewBoardURL = http://ocltc.amd.com/reviews/r/15749/diff/

Affected files ...

... //depot/stg/opencl/drivers/opencl/api/hip/hip_stream.cpp#13 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/commandqueue.cpp#27 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/commandqueue.hpp#19 edit
... //depot/stg/opencl/drivers/opencl/runtime/utils/concurrent.hpp#9 edit
이 커밋은 다음에 포함됨:
foreman
2018-09-06 15:21:28 -04:00
부모 0d2b874266
커밋 2a9e26c772
+18 -5
파일 보기
@@ -65,6 +65,15 @@ static hipError_t ihipStreamCreateWithFlags(hipStream_t *stream, unsigned int fl
return hipSuccess;
}
void ihipStreamCallback(hipStream_t stream, hipStreamCallback_t callback, void* userData) {
//Stream synchronize
hipError_t status = hipStreamSynchronize(stream);
// Call the callback function
callback(stream, status, userData);
}
hipError_t hipStreamCreateWithFlags(hipStream_t *stream, unsigned int flags) {
HIP_INIT_API(stream, flags);
@@ -162,18 +171,22 @@ hipError_t hipStreamWaitEvent(hipStream_t stream, hipEvent_t event, unsigned int
hipError_t hipStreamQuery(hipStream_t stream) {
HIP_INIT_API(stream);
assert(0 && "Unimplemented");
HIP_RETURN(hipErrorUnknown);
amd::HostQueue* hostQueue;
if (stream == nullptr) {
hostQueue = hip::getNullStream();
} else {
hostQueue = as_amd(reinterpret_cast<cl_command_queue>(stream))->asHostQueue();
}
HIP_RETURN(hostQueue->isEmpty() ? hipSuccess : hipErrorNotReady);
}
hipError_t hipStreamAddCallback(hipStream_t stream, hipStreamCallback_t callback, void* userData,
unsigned int flags) {
HIP_INIT_API(stream, callback, userData, flags);
assert(0 && "Unimplemented");
std::thread (ihipStreamCallback, stream, callback, userData).detach();
HIP_RETURN(hipErrorUnknown);
HIP_RETURN(hipSuccess);
}