|
@@ -803,6 +803,10 @@ static inline void _starpu_worker_process_block_in_parallel_requests(struct _sta
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+#ifdef STARPU_SPINLOCK_CHECK
|
|
|
+#define _starpu_worker_enter_sched_op(worker) __starpu_worker_enter_sched_op((worker), __FILE__, __LINE__, __starpu_func__)
|
|
|
+static inline void __starpu_worker_enter_sched_op(struct _starpu_worker * const worker, const char*file, int line, const char* func)
|
|
|
+#else
|
|
|
/** Mark the beginning of a scheduling operation by the worker. No worker
|
|
|
* blocking operations on parallel tasks and no scheduling context change
|
|
|
* operations must be performed on contexts containing the worker, on
|
|
@@ -819,9 +823,6 @@ static inline void _starpu_worker_process_block_in_parallel_requests(struct _sta
|
|
|
*
|
|
|
* Must be called with worker's sched_mutex held.
|
|
|
*/
|
|
|
-#ifdef STARPU_SPINLOCK_CHECK
|
|
|
-static inline void __starpu_worker_enter_sched_op(struct _starpu_worker * const worker, const char*file, int line, const char* func)
|
|
|
-#else
|
|
|
static inline void _starpu_worker_enter_sched_op(struct _starpu_worker * const worker)
|
|
|
#endif
|
|
|
{
|
|
@@ -864,18 +865,17 @@ static inline void _starpu_worker_enter_sched_op(struct _starpu_worker * const w
|
|
|
worker->relax_on_func = func;
|
|
|
#endif
|
|
|
}
|
|
|
-#ifdef STARPU_SPINLOCK_CHECK
|
|
|
-#define _starpu_worker_enter_sched_op(worker) __starpu_worker_enter_sched_op((worker), __FILE__, __LINE__, __starpu_func__)
|
|
|
-#endif
|
|
|
|
|
|
-/** Mark the end of a scheduling operation by the worker.
|
|
|
- *
|
|
|
- * Must be called with worker's sched_mutex held.
|
|
|
- */
|
|
|
void _starpu_worker_apply_deferred_ctx_changes(void);
|
|
|
+
|
|
|
#ifdef STARPU_SPINLOCK_CHECK
|
|
|
+#define _starpu_worker_leave_sched_op(worker) __starpu_worker_leave_sched_op((worker), __FILE__, __LINE__, __starpu_func__)
|
|
|
static inline void __starpu_worker_leave_sched_op(struct _starpu_worker * const worker, const char*file, int line, const char* func)
|
|
|
#else
|
|
|
+/** Mark the end of a scheduling operation by the worker.
|
|
|
+ *
|
|
|
+ * Must be called with worker's sched_mutex held.
|
|
|
+ */
|
|
|
static inline void _starpu_worker_leave_sched_op(struct _starpu_worker * const worker)
|
|
|
#endif
|
|
|
{
|
|
@@ -890,9 +890,6 @@ static inline void _starpu_worker_leave_sched_op(struct _starpu_worker * const w
|
|
|
STARPU_PTHREAD_COND_BROADCAST(&worker->sched_cond);
|
|
|
_starpu_worker_apply_deferred_ctx_changes();
|
|
|
}
|
|
|
-#ifdef STARPU_SPINLOCK_CHECK
|
|
|
-#define _starpu_worker_leave_sched_op(worker) __starpu_worker_leave_sched_op((worker), __FILE__, __LINE__, __starpu_func__)
|
|
|
-#endif
|
|
|
|
|
|
static inline int _starpu_worker_sched_op_pending(void)
|
|
|
{
|
|
@@ -962,11 +959,12 @@ static inline void _starpu_worker_leave_changing_ctx_op(struct _starpu_worker *
|
|
|
STARPU_PTHREAD_COND_BROADCAST(&worker->sched_cond);
|
|
|
}
|
|
|
|
|
|
-/** Temporarily allow other worker to access current worker state, when still scheduling,
|
|
|
- * but the scheduling has not yet been made or is already done */
|
|
|
#ifdef STARPU_SPINLOCK_CHECK
|
|
|
+#define _starpu_worker_relax_on() __starpu_worker_relax_on(__FILE__, __LINE__, __starpu_func__)
|
|
|
static inline void __starpu_worker_relax_on(const char*file, int line, const char* func)
|
|
|
#else
|
|
|
+/** Temporarily allow other worker to access current worker state, when still scheduling,
|
|
|
+ * but the scheduling has not yet been made or is already done */
|
|
|
static inline void _starpu_worker_relax_on(void)
|
|
|
#endif
|
|
|
{
|
|
@@ -990,15 +988,13 @@ static inline void _starpu_worker_relax_on(void)
|
|
|
STARPU_PTHREAD_COND_BROADCAST(&worker->sched_cond);
|
|
|
STARPU_PTHREAD_MUTEX_UNLOCK_SCHED(&worker->sched_mutex);
|
|
|
}
|
|
|
-#ifdef STARPU_SPINLOCK_CHECK
|
|
|
-#define _starpu_worker_relax_on() __starpu_worker_relax_on(__FILE__, __LINE__, __starpu_func__)
|
|
|
-#endif
|
|
|
#define starpu_worker_relax_on _starpu_worker_relax_on
|
|
|
|
|
|
-/** Same, but with current worker mutex already held */
|
|
|
#ifdef STARPU_SPINLOCK_CHECK
|
|
|
+#define _starpu_worker_relax_on_locked(worker) __starpu_worker_relax_on_locked(worker,__FILE__, __LINE__, __starpu_func__)
|
|
|
static inline void __starpu_worker_relax_on_locked(struct _starpu_worker *worker, const char*file, int line, const char* func)
|
|
|
#else
|
|
|
+/** Same, but with current worker mutex already held */
|
|
|
static inline void _starpu_worker_relax_on_locked(struct _starpu_worker *worker)
|
|
|
#endif
|
|
|
{
|
|
@@ -1017,11 +1013,9 @@ static inline void _starpu_worker_relax_on_locked(struct _starpu_worker *worker)
|
|
|
#endif
|
|
|
STARPU_PTHREAD_COND_BROADCAST(&worker->sched_cond);
|
|
|
}
|
|
|
-#ifdef STARPU_SPINLOCK_CHECK
|
|
|
-#define _starpu_worker_relax_on_locked(worker) __starpu_worker_relax_on_locked(worker,__FILE__, __LINE__, __starpu_func__)
|
|
|
-#endif
|
|
|
|
|
|
#ifdef STARPU_SPINLOCK_CHECK
|
|
|
+#define _starpu_worker_relax_off() __starpu_worker_relax_off(__FILE__, __LINE__, __starpu_func__)
|
|
|
static inline void __starpu_worker_relax_off(const char*file, int line, const char* func)
|
|
|
#else
|
|
|
static inline void _starpu_worker_relax_off(void)
|
|
@@ -1048,12 +1042,10 @@ static inline void _starpu_worker_relax_off(void)
|
|
|
#endif
|
|
|
STARPU_PTHREAD_MUTEX_UNLOCK_SCHED(&worker->sched_mutex);
|
|
|
}
|
|
|
-#ifdef STARPU_SPINLOCK_CHECK
|
|
|
-#define _starpu_worker_relax_off() __starpu_worker_relax_off(__FILE__, __LINE__, __starpu_func__)
|
|
|
-#endif
|
|
|
#define starpu_worker_relax_off _starpu_worker_relax_off
|
|
|
|
|
|
#ifdef STARPU_SPINLOCK_CHECK
|
|
|
+#define _starpu_worker_relax_off_locked() __starpu_worker_relax_off_locked(__FILE__, __LINE__, __starpu_func__)
|
|
|
static inline void __starpu_worker_relax_off_locked(const char*file, int line, const char* func)
|
|
|
#else
|
|
|
static inline void _starpu_worker_relax_off_locked(void)
|
|
@@ -1078,9 +1070,6 @@ static inline void _starpu_worker_relax_off_locked(void)
|
|
|
worker->relax_off_func = func;
|
|
|
#endif
|
|
|
}
|
|
|
-#ifdef STARPU_SPINLOCK_CHECK
|
|
|
-#define _starpu_worker_relax_off_locked() __starpu_worker_relax_off_locked(__FILE__, __LINE__, __starpu_func__)
|
|
|
-#endif
|
|
|
|
|
|
static inline int _starpu_worker_get_relax_state(void)
|
|
|
{
|