Просмотр исходного кода

Cleanup tag management code: use static functions and do not export internal
functions.

Cédric Augonnet лет назад: 16
Родитель
Сommit
9040800805
2 измененных файлов с 23 добавлено и 29 удалено
  1. 23 24
      src/core/dependencies/tags.c
  2. 0 5
      src/core/dependencies/tags.h

+ 23 - 24
src/core/dependencies/tags.c

@@ -28,7 +28,7 @@ static starpu_mutex tag_mutex = {
 	.taken = 0
 };
 
-cg_t *create_cg(unsigned ntags, struct tag_s *tag)
+static cg_t *create_cg(unsigned ntags, struct tag_s *tag)
 {
 	cg_t *cg;
 
@@ -93,7 +93,7 @@ void starpu_tag_remove(starpu_tag_t id)
 	free(tag);
 }
 
-struct tag_s *gettag_struct(starpu_tag_t id)
+static struct tag_s *gettag_struct(starpu_tag_t id)
 {
 	take_mutex(&tag_mutex);
 
@@ -116,9 +116,28 @@ struct tag_s *gettag_struct(starpu_tag_t id)
 	return tag;
 }
 
-static void notify_cg(cg_t *cg)
+static void tag_set_ready(struct tag_s *tag)
 {
+	/* mark this tag as ready to run */
+	tag->state = READY;
+	/* declare it to the scheduler ! */
+	struct job_s *j = tag->job;
+
+	/* perhaps the corresponding task was not declared yet */
+	if (!j)
+		return;
+
+#ifdef NO_DATA_RW_LOCK
+	/* enforce data dependencies */
+	if (submit_job_enforce_data_deps(j))
+		return;
+#endif
 
+	push_task(j);
+}
+
+static void notify_cg(cg_t *cg)
+{
 	STARPU_ASSERT(cg);
 	unsigned ntags = STARPU_ATOMIC_ADD(&cg->ntags, -1);
 	if (ntags == 0) {
@@ -128,7 +147,7 @@ static void notify_cg(cg_t *cg)
 	}
 }
 
-void tag_add_succ(starpu_tag_t id, cg_t *cg)
+static void tag_add_succ(starpu_tag_t id, cg_t *cg)
 {
 	/* find out the associated structure */
 	struct tag_s *tag = gettag_struct(id);
@@ -285,26 +304,6 @@ void starpu_tag_wait(starpu_tag_t id)
 	pthread_mutex_unlock(&tag->finished_mutex);
 }
 
-void tag_set_ready(struct tag_s *tag)
-{
-	/* mark this tag as ready to run */
-	tag->state = READY;
-	/* declare it to the scheduler ! */
-	struct job_s *j = tag->job;
-
-	/* perhaps the corresponding task was not declared yet */
-	if (!j)
-		return;
-
-#ifdef NO_DATA_RW_LOCK
-	/* enforce data dependencies */
-	if (submit_job_enforce_data_deps(j))
-		return;
-#endif
-
-	push_task(j);
-}
-
 /* This function is called when a new task is submitted to StarPU 
  * it returns 1 if the task deps are not fulfilled, 0 otherwise */
 unsigned submit_job_enforce_task_deps(job_t j)

+ 0 - 5
src/core/dependencies/tags.h

@@ -69,13 +69,8 @@ typedef struct _cg_t {
 
 void starpu_tag_declare_deps(starpu_tag_t id, unsigned ndeps, ...);
 
-cg_t *create_cg(unsigned ntags, struct tag_s *tag);
-struct tag_s *get_tag_struct(starpu_tag_t id);
-void tag_add_succ(starpu_tag_t id, cg_t *cg);
-
 void notify_dependencies(struct job_s *j);
 void tag_declare(starpu_tag_t id, struct job_s *job);
-void tag_set_ready(struct tag_s *tag);
 
 unsigned submit_job_enforce_task_deps(struct job_s *j);