summaryrefslogtreecommitdiff
path: root/src/intel/intel_driver.c
diff options
context:
space:
mode:
authorYang Rong <rong.r.yang@intel.com>2014-10-27 16:16:51 +0800
committerZhigang Gong <zhigang.gong@intel.com>2014-10-28 10:15:02 +0800
commitc454dbdbf6d45cc214dc23c2eeaa38d2530d9f8e (patch)
treef8290822e1744847bee1fb4730ab5912a0f0cb86 /src/intel/intel_driver.c
parent6e451c195917b807988ef8f521b23594eef3e898 (diff)
Refine the intel gpgpu delete.
The intel gpgpu struct is destroyed when a new gpgpu struct needed. But in that time, the command batch relative with the destroyed gpgpu may have not finish, and the resource in gpgpu still used by gpgpu, can't be destroyed. So, when delete a gpgpu, check the batch status, if have not complete, insert to list in intel driver, and delete all finished gpgpu in that list. V2: V1 assume all the gpgpu list would complete in order, but it is not true. The insert order in is the gpgpu delete order, not the flush command batch order. So visit and delete all complete gpgpu in the list. Signed-off-by: Yang Rong <rong.r.yang@intel.com> Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Diffstat (limited to 'src/intel/intel_driver.c')
-rw-r--r--src/intel/intel_driver.c27
1 files changed, 2 insertions, 25 deletions
diff --git a/src/intel/intel_driver.c b/src/intel/intel_driver.c
index 390e965e..bb97220c 100644
--- a/src/intel/intel_driver.c
+++ b/src/intel/intel_driver.c
@@ -79,31 +79,6 @@
#include "cl_device_id.h"
#include "cl_platform_id.h"
-#define SET_BLOCKED_SIGSET(DRIVER) do { \
- sigset_t bl_mask; \
- sigfillset(&bl_mask); \
- sigdelset(&bl_mask, SIGFPE); \
- sigdelset(&bl_mask, SIGILL); \
- sigdelset(&bl_mask, SIGSEGV); \
- sigdelset(&bl_mask, SIGBUS); \
- sigdelset(&bl_mask, SIGKILL); \
- pthread_sigmask(SIG_SETMASK, &bl_mask, &(DRIVER)->sa_mask); \
-} while (0)
-
-#define RESTORE_BLOCKED_SIGSET(DRIVER) do { \
- pthread_sigmask(SIG_SETMASK, &(DRIVER)->sa_mask, NULL); \
-} while (0)
-
-#define PPTHREAD_MUTEX_LOCK(DRIVER) do { \
- SET_BLOCKED_SIGSET(DRIVER); \
- pthread_mutex_lock(&(DRIVER)->ctxmutex); \
-} while (0)
-
-#define PPTHREAD_MUTEX_UNLOCK(DRIVER) do { \
- pthread_mutex_unlock(&(DRIVER)->ctxmutex); \
- RESTORE_BLOCKED_SIGSET(DRIVER); \
-} while (0)
-
static void
intel_driver_delete(intel_driver_t *driver)
{
@@ -423,11 +398,13 @@ intel_get_device_id(void)
return intel_device_id;
}
+extern void intel_gpgpu_delete_all(intel_driver_t *driver);
static void
cl_intel_driver_delete(intel_driver_t *driver)
{
if (driver == NULL)
return;
+ intel_gpgpu_delete_all(driver);
intel_driver_context_destroy(driver);
intel_driver_close(driver);
intel_driver_terminate(driver);