changeset 1882:33c03287ff81 draft

not yet worked.
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Fri, 03 Jan 2014 10:36:37 +0900
parents 392c1a2d699d
children c5ae9bbd5eff
files TaskManager/Cell/CellTaskManagerImpl.cc TaskManager/Cell/CellTaskManagerImpl.h TaskManager/Fifo/FifoTaskManagerImpl.cc TaskManager/kernel/schedule/SchedTask.cc
diffstat 4 files changed, 18 insertions(+), 85 deletions(-) [+]
line wrap: on
line diff
--- a/TaskManager/Cell/CellTaskManagerImpl.cc	Thu Jan 02 22:13:00 2014 +0900
+++ b/TaskManager/Cell/CellTaskManagerImpl.cc	Fri Jan 03 10:36:37 2014 +0900
@@ -27,7 +27,7 @@
 void CellTaskManagerImpl::init(int spuIdle_,int useRefDma,int export_task_log) {
     spe_running = 0;
     spuIdle = spuIdle_;
-    int m = machineNum == 0?1:machineNum; // at least 1 tasklistinfo in -cpu 0
+    int m = (machineNum == 0?1:machineNum) + ioNum ; // at least 1 tasklistinfo in -cpu 0
     receive_wait = 0; // new Sem(0);
 
     // 実行される Task 用の パイプライン用のダブルバッファ
@@ -41,7 +41,7 @@
     }
 
     // PPE 側の管理をする Manager
-    ppeManager = new FifoTaskManagerImpl(machineNum);
+    ppeManager = new FifoTaskManagerImpl(1);
     // 大半のTaskQueueInfoは、共有される
     MainScheduler *mscheduler = new MainScheduler;
     set_scheduler(mscheduler);
@@ -125,10 +125,10 @@
                 // 配列的 (SPE0 = arr[0], SPE1 = arr[1]) にするため
                 speid = htask->cpu_type - CPU_SPE - 1 + gpuNum;
                 if (speid >= gpuNum && machineNum == gpuNum) {
-                    // SPE specified but no CPU
+                    // SPE specified but no CPU, run it in GPU
                     speid = (cur_anySpeid++ % gpuNum) ; 
                 } else if (speid < gpuNum && gpuNum == 0) {
-                    // GPU specified but no GPU
+                    // GPU specified but no GPU, run it in SPU
                     speid = cur_anySpeid++ % machineNum + id_offset ;
                 }
             }
@@ -191,7 +191,7 @@
 void CellTaskManagerImpl::run() {
     int spu_limit = spuIdle;
     if (machineNum == 0) {
-        ppeManager->run();
+        ppeManager->run(); // fifo run
         return;
     }
 
@@ -277,55 +277,28 @@
         } else if (data == (memaddr) MY_SPE_NOP) {
             continue;
         } else {
-#ifdef TASK_LIST_MAIL
             // multi dimensionだったらcount downする 
             TaskListPtr list = (TaskListPtr)data;
             if (--list->self->flag.dim_count == 0) 
                 check_task_list_finish(schedTaskManager, list, waitTaskQueue);
             if (speTaskList[id]->getFirst() == list) {
-                speTaskList[id]->next = list->next;
-                if (! list->next)   // make it normal empty cyclic list
+                if (list->next) 
+                    speTaskList[id]->next = list->next;
+                else { // make it normal empty cyclic list
                     speTaskList[id]->next = speTaskList[id];
+                    speTaskList[id]->prev = speTaskList[id];
+                }
                 speTaskList[id]->free_(list);
             }
             if (taskListInfo[id]->getFirst() == list) {
-                taskListInfo[id]->next = list->next;
-                if (! list->next)   // make it normal empty cyclic list
+                if (list->next) 
+                    taskListInfo[id]->next = list->next;
+                else { // make it normal empty cyclic list
                     taskListInfo[id]->next = taskListInfo[id];
+                    taskListInfo[id]->prev = taskListInfo[id];
+                }
                 taskListInfo[id]->free_(list);
             }
-#else
-            // 終了したタスク(PPEにあるのでアドレス)
-            HTaskPtr task = (HTaskPtr) data;
-#if 0
-            if (task->cpu_type != CPU_SPE) {
-                const char *name = get_task_name(task);
-                if (name != NULL) {
-                    printf("[SPE] ");
-                    printf("Task id : %d, ", task->command);
-                    printf("Task name : %s\n", name);
-                }
-            }
-#endif
-#ifndef NOT_CHECK
-
-            if (task != NULL) {
-                //SPE で処理された Task が返ってくるはず。それがもし、type PPE なら・・・
-                if (task->cpu_type == CPU_PPE) {
-                    printf("attention : PPE task run on SPE\n");
-                    printf("Task id : %d\n", task->command);
-                    const char *name = get_task_name(task);
-                    if (name != NULL) {
-                        printf("Task name : %s\n", name);
-                    }
-                }
-            }
-
-#endif
-
-            task->post_func(schedTaskManager, task->post_arg1, task->post_arg2);
-            check_task_finish(task, waitTaskQueue);
-#endif
         }
         // MY_SPE_NOP: 特に意味のないコマンド
     }
--- a/TaskManager/Cell/CellTaskManagerImpl.h	Thu Jan 02 22:13:00 2014 +0900
+++ b/TaskManager/Cell/CellTaskManagerImpl.h	Fri Jan 03 10:36:37 2014 +0900
@@ -14,6 +14,7 @@
 public:
     /* constructor */
     CellTaskManagerImpl(int num, int gpu, Threads *cpus) : TaskManagerImpl(num) {
+         ioNum = 2;
          gpuNum = gpu; speThreads = cpus; cpu_num = num-gpu; id_offset = gpu ;
     }
     ~CellTaskManagerImpl();
@@ -31,6 +32,7 @@
     int spe_running;
     int spuIdle;
     int gpuNum;
+    int ioNum;
     /* functions */
     // system
     void init(int spuIdle,int useRefDma, int export_task_log);
--- a/TaskManager/Fifo/FifoTaskManagerImpl.cc	Thu Jan 02 22:13:00 2014 +0900
+++ b/TaskManager/Fifo/FifoTaskManagerImpl.cc	Fri Jan 03 10:36:37 2014 +0900
@@ -227,40 +227,8 @@
             __debug_ppe("mail_check(): recv from 0x%x\n", data);
             // post_func を先に実行しないと、systask_finish が active_queue
             // 移されてから、wait_for されるという事態が起きることがある。
-#ifdef TASK_LIST_MAIL
             TaskListPtr list = (TaskListPtr)data;
             check_task_list_finish(schedTaskManager, list, waitTaskQueue);
-#else
-            HTaskPtr task = (HTaskPtr)data;
-#if 0
-            if (task->cpu_type != CPU_PPE) {
-                const char *name = get_task_name(task);
-                if (name != NULL) {
-                    printf("[PPE] ");
-                    printf("Task id : %d, ", task->command);
-                    printf("Task name : %s\n", name);
-                }
-            }
-#endif
-#ifndef NOT_CHECK
-	    
-            if (task != NULL) {
-                //PPE で処理された Task が返ってくるはず。
-                if (task->cpu_type != CPU_PPE) {
-                    printf("attention : SPE task run on PPE\n");
-                    printf("Task id : %d\n", task->command);
-                    const char *name = get_task_name(task);
-                    if (name != NULL) {	       
-                        printf("Task name : %s\n", name);
-                    }
-                }
-            }
-	    
-#endif
-
-            task->post_func(schedTaskManager, task->post_arg1, task->post_arg2);
-            check_task_finish(task, waitTaskQueue);
-#endif
         }
     }
 }
--- a/TaskManager/kernel/schedule/SchedTask.cc	Thu Jan 02 22:13:00 2014 +0900
+++ b/TaskManager/kernel/schedule/SchedTask.cc	Fri Jan 03 10:36:37 2014 +0900
@@ -56,14 +56,8 @@
     cur_index = _task;
     this->tag = tag;
 
-#ifdef TASK_LIST_MAIL
     if (list)
         waiter = (memaddr) list->waiter;
-#else
-    if (task)
-        waiter = (memaddr) task->self;
-#endif
-
 }
 
 void
@@ -124,7 +118,7 @@
     }
     (*connector->end_dmawait_profile)(&connector->global_busy_time,&connector->start_time,&connector->stop_time);
     list->task_end_time = gettime();
-    this->printf("cpuid %ld %s\t%lld\n",scheduler->id,(char *)(task_list[atask->command].name),list->task_end_time-list->task_start_time);
+    this->printf("cpuid %ld %s\t0x%p time %lld\n",scheduler->id,(char *)(task_list[atask->command].name),(void*)list, list->task_end_time-list->task_start_time);
     connector->free_(readbuf);
     // User 側で作る方法が必要...
     // 書き込む領域がなければ無視
@@ -172,12 +166,8 @@
     connector->free_(writebuf);
     if (inListData.bound != din) free(inListData.bound);
     if (outListData.bound != dout) free(outListData.bound);
-#ifdef TASK_LIST_MAIL
     if ((cur_index->next() >= list->last()) )
         connector->mail_write(waiter);
-#else
-    connector->mail_write(waiter);
-#endif
 }
 
 SchedTaskBase*