Mercurial > hg > Game > Cerium
changeset 501:7ddbe22d4cdb draft
Cell inData/outData DMA removal
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 11 Oct 2009 18:20:33 +0900 |
parents | 464b34df2154 |
children | fdc3e30de9d3 |
files | TaskManager/Cell/CellHTaskInfo.cc TaskManager/Cell/CellHTaskInfo.h TaskManager/Cell/CellTaskManagerImpl.cc TaskManager/Cell/CellTaskManagerImpl.h TaskManager/kernel/ppe/HTaskInfo.h TaskManager/kernel/ppe/Task.h TaskManager/kernel/schedule/SchedTask.cc TaskManager/kernel/schedule/SchedTask.h TaskManager/kernel/schedule/SchedTaskList.cc TaskManager/kernel/schedule/Scheduler.cc TaskManager/kernel/schedule/Scheduler.h |
diffstat | 11 files changed, 72 insertions(+), 101 deletions(-) [+] |
line wrap: on
line diff
--- a/TaskManager/Cell/CellHTaskInfo.cc Sun Oct 11 16:24:33 2009 +0900 +++ b/TaskManager/Cell/CellHTaskInfo.cc Sun Oct 11 18:20:33 2009 +0900 @@ -2,34 +2,3 @@ #include <stdlib.h> #include "CellHTaskInfo.h" -int -CellHTaskInfo::extend_pool(int num) -{ - HTaskPtr q = NULL; - - q = (HTaskPtr)malloc(sizeof(HTask)*(num+1)); - - if (q == NULL) { - return -1; - } - q->next = htaskPool; - htaskPool = q; - - /* Connect all free queue in the pool */ - for (q = htaskPool + 1; --num > 0; q++) { - q->next = q + 1; - posix_memalign((void**)&q->inData, DEFAULT_ALIGNMENT, sizeof(ListData)); - posix_memalign((void**)&q->outData, DEFAULT_ALIGNMENT, sizeof(ListData)); - q->wait_me = new TaskQueueInfo(); - q->wait_i = new TaskQueueInfo(); - } - q->next = freeHTask; - posix_memalign((void**)&q->inData, DEFAULT_ALIGNMENT, sizeof(ListData)); - posix_memalign((void**)&q->outData, DEFAULT_ALIGNMENT, sizeof(ListData)); - q->wait_me = new TaskQueueInfo(); - q->wait_i = new TaskQueueInfo(); - - freeHTask = htaskPool + 1; - - return 0; -}
--- a/TaskManager/Cell/CellHTaskInfo.h Sun Oct 11 16:24:33 2009 +0900 +++ b/TaskManager/Cell/CellHTaskInfo.h Sun Oct 11 18:20:33 2009 +0900 @@ -6,7 +6,6 @@ class CellHTaskInfo : public HTaskInfo { public: /* functions */ - int extend_pool(int num); }; #endif
--- a/TaskManager/Cell/CellTaskManagerImpl.cc Sun Oct 11 16:24:33 2009 +0900 +++ b/TaskManager/Cell/CellTaskManagerImpl.cc Sun Oct 11 18:20:33 2009 +0900 @@ -5,11 +5,11 @@ #include <string.h> #include "CellTaskManagerImpl.h" #include "CellTaskListInfo.h" -#include "CellHTaskInfo.h" +#include "HTaskInfo.h" #include "PpeScheduler.h" #include "types.h" -CellTaskManagerImpl::~CellTaskManagerImpl(void) +CellTaskManagerImpl::~CellTaskManagerImpl() { delete speThreads; delete [] speTaskList; @@ -25,17 +25,14 @@ } void -CellTaskManagerImpl::init(void) +CellTaskManagerImpl::init() { - taskQueueImpl = new TaskQueueInfo(); - taskListImpl = new CellTaskListInfo; taskListImpl->init(machineNum*2); - activeTaskQueue = new TaskQueueInfo(); + activeTaskQueue = new HTaskInfo(); - htaskImpl = new CellHTaskInfo; - htaskImpl->init(TASK_MAX_SIZE*2); + htaskImpl = activeTaskQueue ; // any HTaskInfo speThreads = new SpeThreads(machineNum); speThreads->init(); @@ -59,13 +56,12 @@ } void -CellTaskManagerImpl::append_activeTask(TaskQueuePtr q) +CellTaskManagerImpl::append_activeTask(HTaskPtr task) { - HTask *task = (HTask *) q->task; if (task->cpu_type == CPU_PPE) { - ppeManager->append_activeTask(q); + ppeManager->append_activeTask(task); } else { - activeTaskQueue->addLast(q); + activeTaskQueue->addLast(task); } } @@ -82,21 +78,15 @@ * spe に渡される Task だけ入っている */ void -CellTaskManagerImpl::set_runTaskList(void) +CellTaskManagerImpl::set_runTaskList() { // ここ...直すかな TaskListPtr list; - HTaskPtr htask; TaskPtr task; int speid; - if (activeTaskQueue->empty()) { - return ; - } - - while (TaskQueuePtr queue = activeTaskQueue->poll()) { - htask = (HTaskPtr)queue->task; + while (HTaskPtr htask = activeTaskQueue->poll()) { if (htask->cpu_type == SPE_ANY) { speid = cur_anySpeid++; @@ -137,13 +127,13 @@ memcpy(task, (Task*)htask, sizeof(Task)); #endif - activeTaskQueue->free_(queue); + // activeTaskQueue->free_(queue); } } void -CellTaskManagerImpl::run(void) +CellTaskManagerImpl::run() { TaskListPtr ppeTaskList = NULL; MailQueuePtr ppeMail = NULL;
--- a/TaskManager/Cell/CellTaskManagerImpl.h Sun Oct 11 16:24:33 2009 +0900 +++ b/TaskManager/Cell/CellTaskManagerImpl.h Sun Oct 11 18:20:33 2009 +0900 @@ -9,7 +9,7 @@ public: /* constructor */ CellTaskManagerImpl(int num = 1) : TaskManagerImpl(num) {} - ~CellTaskManagerImpl(void); + ~CellTaskManagerImpl(); /* variables */ TaskListPtr *speTaskList; @@ -21,11 +21,11 @@ /* functions */ // system - void init(void); - void run(void); + void init(); + void run(); TaskListPtr mail_check(MailQueuePtr mail_list); - void set_runTaskList(void); - void append_activeTask(TaskQueuePtr); + void set_runTaskList(); + void append_activeTask(HTaskPtr); // user int add_data(ListDataPtr, uint32, int);
--- a/TaskManager/kernel/ppe/HTaskInfo.h Sun Oct 11 16:24:33 2009 +0900 +++ b/TaskManager/kernel/ppe/HTaskInfo.h Sun Oct 11 18:20:33 2009 +0900 @@ -13,7 +13,7 @@ BASE_NEW_DELETE(HTaskInfo); /* functions */ - HTaskPtr HTaskInfo::create(int cmd); + HTaskPtr create(int cmd); void free_(HTaskPtr queue);
--- a/TaskManager/kernel/ppe/Task.h Sun Oct 11 16:24:33 2009 +0900 +++ b/TaskManager/kernel/ppe/Task.h Sun Oct 11 18:20:33 2009 +0900 @@ -15,12 +15,12 @@ BASE_NEW_DELETE(Task); int command; // 4 byte - ListData inData; // 4 byte 64bit であるべき - ListData outData; // 4 byte 64bit であるべき int self; // 4 byte int param_size; // 4 byte int param[MAX_PARAMS]; // 4*MAX_PARAMS byte + ListData inData __attribute__ ((aligned (DEFAULT_ALIGNMENT))); // 4 byte 64bit であるべき + ListData outData __attribute__ ((aligned (DEFAULT_ALIGNMENT))); // 4 byte 64bit であるべき public: // functions int add_inData_t(unsigned int addr, int size); // unsigned int ではなく 64bit
--- a/TaskManager/kernel/schedule/SchedTask.cc Sun Oct 11 16:24:33 2009 +0900 +++ b/TaskManager/kernel/schedule/SchedTask.cc Sun Oct 11 18:20:33 2009 +0900 @@ -99,12 +99,13 @@ void SchedTask::init(TaskListPtr _list, TaskPtr _task, int index, - ListDataPtr rbuf, ListDataPtr wbuf, Scheduler* sc) + // ListDataPtr rbuf, ListDataPtr wbuf, + Scheduler* sc) { list = _list; task = _task; - inListData = rbuf; - outListData = wbuf; + inListData = &_task->inData; + outListData = &_task->outData; scheduler = sc; cur_index = index; @@ -119,6 +120,9 @@ void SchedTask::ex_init_normal() { +#if 0 + // task list に入れたので既に読んでいる? + // scheduler->dma_load(inListData, (uint32)&task->inData, sizeof(ListData), DMA_READ_IN_LIST); scheduler->dma_load(outListData, (uint32)&task->outData, @@ -127,6 +131,7 @@ scheduler->dma_wait(DMA_READ_IN_LIST); scheduler->dma_wait(DMA_READ_OUT_LIST); #endif +#endif taskGroup = new TaskGroup; taskGroup->command = (int)task->self; @@ -159,10 +164,12 @@ { __debug("[SchedTask:%s]\n", __FUNCTION__); +#if 0 #if !defined(NO_PIPELINE) scheduler->dma_wait(DMA_READ_IN_LIST); scheduler->dma_wait(DMA_READ_OUT_LIST); #endif +#endif writebuf = scheduler->allocate(outListData->size); @@ -340,8 +347,8 @@ } nextSched = createSchedTask(scheduler, nextTask); ((SchedTask*)nextSched)->init(list, nextTask, cur_index, - scheduler->get_curReadBuf(), - scheduler->get_curWriteBuf(), + // scheduler->get_curReadBuf(), + // scheduler->get_curWriteBuf(), scheduler); return nextSched; } @@ -377,8 +384,8 @@ // RenewTaskList を実行中なので nextSched->setRenew(); nextSched->init(list, nextTask, cur_index, - scheduler->get_curReadBuf(), - scheduler->get_curWriteBuf(), + // scheduler->get_curReadBuf(), + // scheduler->get_curWriteBuf(), scheduler); /** @@ -408,8 +415,8 @@ nextSched = createSchedTask(scheduler, nextTask); nextSched->init(nextList, nextTask, cur_index, - scheduler->get_curReadBuf(), - scheduler->get_curWriteBuf(), + // scheduler->get_curReadBuf(), + // scheduler->get_curWriteBuf(), scheduler); return nextSched; } else {
--- a/TaskManager/kernel/schedule/SchedTask.h Sun Oct 11 16:24:33 2009 +0900 +++ b/TaskManager/kernel/schedule/SchedTask.h Sun Oct 11 18:20:33 2009 +0900 @@ -101,7 +101,8 @@ void setRenew(); void init(TaskListPtr _list, TaskPtr _task, int index, - ListDataPtr rbuf, ListDataPtr wbuf, Scheduler* sc); + // ListDataPtr rbuf, ListDataPtr wbuf, + Scheduler* sc); //--- User API --- int get_cpuid();
--- a/TaskManager/kernel/schedule/SchedTaskList.cc Sun Oct 11 16:24:33 2009 +0900 +++ b/TaskManager/kernel/schedule/SchedTaskList.cc Sun Oct 11 18:20:33 2009 +0900 @@ -81,8 +81,8 @@ } ((SchedTask*)nextSched)->init(list, nextTask, 1, - scheduler->get_curReadBuf(), - scheduler->get_curWriteBuf(), + // scheduler->get_curReadBuf(), + // scheduler->get_curWriteBuf(), scheduler); }
--- a/TaskManager/kernel/schedule/Scheduler.cc Sun Oct 11 16:24:33 2009 +0900 +++ b/TaskManager/kernel/schedule/Scheduler.cc Sun Oct 11 18:20:33 2009 +0900 @@ -12,7 +12,7 @@ Scheduler::TaskObject task_list[MAX_TASK_OBJECT]; -Scheduler::~Scheduler(void) +Scheduler::~Scheduler() { delete connector; } @@ -21,20 +21,20 @@ */ void -Scheduler::init(void) +Scheduler::init() { hash = 0; init_impl(); for (int i = 0; i < 2; i++) { buff_taskList[i] = (TaskListPtr)allocate(sizeof(TaskList)); - buff_inListData[i] = (ListDataPtr)allocate(sizeof(ListData)); - buff_outListData[i] = (ListDataPtr)allocate(sizeof(ListData)); + // buff_inListData[i] = (ListDataPtr)allocate(sizeof(ListData)); + // buff_outListData[i] = (ListDataPtr)allocate(sizeof(ListData)); } buffFlag_taskList = 0; - buffFlag_inListData = 0; - buffFlag_outListData = 0; + // buffFlag_inListData = 0; + // buffFlag_outListData = 0; flag_renewTaskList = 0; // bzero でもいいけど @@ -54,7 +54,7 @@ } void -Scheduler::run(void) +Scheduler::run() { task1 = new SchedNop(); task2 = new SchedNop(); @@ -79,14 +79,14 @@ void -Scheduler::finish(void) +Scheduler::finish() { free(buff_taskList[0]); free(buff_taskList[1]); - free(buff_inListData[0]); - free(buff_inListData[1]); - free(buff_outListData[0]); - free(buff_outListData[1]); + // free(buff_inListData[0]); + // free(buff_inListData[1]); + // free(buff_outListData[0]); + // free(buff_outListData[1]); } /** @@ -94,7 +94,7 @@ * パイプラインの各処理が交代して使う。 */ TaskListPtr -Scheduler::get_curListBuf(void) +Scheduler::get_curListBuf() { buffFlag_taskList ^= 1; @@ -103,11 +103,15 @@ /** + * Task に inListData, outListData を入れたので、 + * これは必要ないらしい。 + * * あらかじめ memory allocte してある ListData の領域を * パイプラインの各処理が交代して使う。 */ +#if 0 ListDataPtr -Scheduler::get_curWriteBuf(void) +Scheduler::get_curWriteBuf() { buffFlag_outListData ^= 1; return buff_outListData[buffFlag_outListData]; @@ -115,11 +119,12 @@ ListDataPtr -Scheduler::get_curReadBuf(void) +Scheduler::get_curReadBuf() { buffFlag_inListData ^= 1; return buff_inListData[buffFlag_inListData]; } +#endif /** * タスク内で生成されたタスクを格納する TaskList を取得する @@ -131,7 +136,7 @@ * 以上の場合です */ TaskListPtr -Scheduler::get_renewListBuf(void) +Scheduler::get_renewListBuf() { if (renewCur_taskList && renewCur_taskList->length < TASK_MAX_SIZE) { return renewCur_taskList; @@ -154,7 +159,7 @@ * @return next RenewTaskList */ SchedTaskList* -Scheduler::get_nextRenewTaskList(void) +Scheduler::get_nextRenewTaskList() { if (renewTop_taskList) { TaskListPtr list = renewTop_taskList; @@ -189,7 +194,7 @@ * @return TaskList */ TaskListPtr -Scheduler::get_backupTaskList(void) +Scheduler::get_backupTaskList() { TaskListPtr ret = bak_curTaskList; @@ -198,7 +203,7 @@ } int -Scheduler::get_backupTaskListIndex(void) +Scheduler::get_backupTaskListIndex() { int ret = bakIndex_taskList; @@ -244,7 +249,7 @@ } uint32 -Scheduler::mail_read(void) +Scheduler::mail_read() { return connector->mail_read(); } @@ -273,7 +278,7 @@ } void -Scheduler::reload_groupTask(void) +Scheduler::reload_groupTask() { taskGroup = new TaskGroup; }
--- a/TaskManager/kernel/schedule/Scheduler.h Sun Oct 11 16:24:33 2009 +0900 +++ b/TaskManager/kernel/schedule/Scheduler.h Sun Oct 11 18:20:33 2009 +0900 @@ -35,12 +35,12 @@ // double buffering TaskListPtr buff_taskList[2]; - ListDataPtr buff_inListData[2]; - ListDataPtr buff_outListData[2]; + // ListDataPtr buff_inListData[2]; + // ListDataPtr buff_outListData[2]; int buffFlag_taskList; - int buffFlag_inListData; - int buffFlag_outListData; + // int buffFlag_inListData; + // int buffFlag_outListData; /* TaskList 関連 */ @@ -121,8 +121,8 @@ void finish(); TaskListPtr get_curListBuf(); - ListDataPtr get_curReadBuf(); - ListDataPtr get_curWriteBuf(); + // ListDataPtr get_curReadBuf(); + // ListDataPtr get_curWriteBuf(); TaskListPtr get_renewListBuf(); void set_backupTaskList(TaskListPtr cur_taskList);