summaryrefslogtreecommitdiff
path: root/libcuda/cuda_runtime_api.cc
diff options
context:
space:
mode:
authorboyealkim <[email protected]>2019-07-25 20:31:21 +0900
committerboyealkim <[email protected]>2019-07-25 20:49:35 +0900
commit8e9f0375a6a8bed217b0634a08f7f1f0cd149744 (patch)
tree0c508bc51039c3401a65f8a4e1303903a03fd8cf /libcuda/cuda_runtime_api.cc
parentf829a12add380c78e50ecc86357d4a1b513f21f0 (diff)
fix stream fix bug and fix cudaStreamWaitEvent impl
Diffstat (limited to 'libcuda/cuda_runtime_api.cc')
-rw-r--r--libcuda/cuda_runtime_api.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/libcuda/cuda_runtime_api.cc b/libcuda/cuda_runtime_api.cc
index 44f0f4e..7005eef 100644
--- a/libcuda/cuda_runtime_api.cc
+++ b/libcuda/cuda_runtime_api.cc
@@ -1696,6 +1696,7 @@ __host__ cudaError_t CUDARTAPI cudaEventRecord(cudaEvent_t event, cudaStream_t s
if( !e ) return g_last_cudaError = cudaErrorUnknown;
struct CUstream_st *s = (struct CUstream_st *)stream;
stream_operation op(e,s);
+ e->issue();
g_stream_manager->push(op);
return g_last_cudaError = cudaSuccess;
}
@@ -1708,9 +1709,13 @@ __host__ cudaError_t CUDARTAPI cudaStreamWaitEvent(cudaStream_t stream, cudaEven
//reference: https://www.cs.cmu.edu/afs/cs/academic/class/15668-s11/www/cuda-doc/html/group__CUDART__STREAM_gfe68d207dc965685d92d3f03d77b0876.html
CUevent_st *e = get_event(event);
if( !e ){
- printf("GPGPU-Sim API: Warning: cudaEventRecord has not been called on event before calling cudaStreamWaitEvent.\nNothing to be done.\n");
- return g_last_cudaError = cudaSuccess;
+ printf("GPGPU-Sim API: Error at cudaStreamWaitEvent. Event is not created .\n");
+ return g_last_cudaError = cudaErrorInvalidResourceHandle;
}
+ else if(e->num_issued() == 0){
+ printf("GPGPU-Sim API: Warning: cudaEventRecord has not been called on event before calling cudaStreamWaitEvent.\nNothing to be done.\n");
+ return g_last_cudaError = cudaSuccess;
+ }
if (!stream){
g_stream_manager->pushCudaStreamWaitEventToAllStreams(e, flags);
} else {