summaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
authorJunyan He <junyan.he@intel.com>2016-04-06 23:21:16 +0800
committerJunyan He <junyan.he@intel.com>2016-04-06 23:21:16 +0800
commitec81a026ed62ebd427daeae4ac723517e0a59916 (patch)
tree4c8020a3db93a3cf0e43846a3e8d37186515b6f1 /backend
parent1bb09b04058a97441eea9f79489ec361e14704f8 (diff)
event
Diffstat (limited to 'backend')
-rw-r--r--backend/src/driver/cl_gen_command_queue.cpp12
-rw-r--r--backend/src/driver/cl_gen_driver.hpp2
2 files changed, 11 insertions, 3 deletions
diff --git a/backend/src/driver/cl_gen_command_queue.cpp b/backend/src/driver/cl_gen_command_queue.cpp
index b514df88..bfd7ce89 100644
--- a/backend/src/driver/cl_gen_command_queue.cpp
+++ b/backend/src/driver/cl_gen_command_queue.cpp
@@ -20,6 +20,7 @@
extern "C" { // for the C header files
#endif /* __cplusplus */
#include <string.h>
+#include "cl_event.h"
#include "cl_command_queue.h"
#include "cl_gen_driver.h"
#ifdef __cplusplus
@@ -29,9 +30,16 @@ extern "C" { // for the C header files
#include "sys/alloc.hpp"
#include "cl_gen_driver.hpp"
-bool GenGPUWorkItem::isReady(void)
+cl_int GenGPUWorkItem::isReady(void)
{
- return true;
+ for (auto e : dependEvents) {
+ if (e->status > CL_COMPLETE)
+ return 1;
+ if (e->status < 0)
+ return -1;
+ }
+
+ return 0;
}
GenGPUWorkItem::GenGPUWorkItem(cl_event event, const cl_event* dependEvents, cl_uint num_events)
diff --git a/backend/src/driver/cl_gen_driver.hpp b/backend/src/driver/cl_gen_driver.hpp
index e08ee297..b377b82d 100644
--- a/backend/src/driver/cl_gen_driver.hpp
+++ b/backend/src/driver/cl_gen_driver.hpp
@@ -229,7 +229,7 @@ struct GenGPUWorkItem { // Represent Some real work for GPU to do.
GenGPUWorkItem(cl_event event, const cl_event* dependEvents, cl_uint num_events);
virtual bool submit(void) = 0;
virtual bool complete(void) = 0;
- virtual bool isReady(void);
+ virtual cl_int isReady(void); // >0 means ready, =0 means not ready, <0 means error and cancel
virtual ~GenGPUWorkItem() { };
};