Mercurial > hg > Game > Cerium
changeset 713:97adb3fe85c6 draft
remove SIMPLE_TASK conditional
line wrap: on
line diff
--- a/Renderer/Engine/Makefile.def Wed Dec 16 09:39:24 2009 +0900 +++ b/Renderer/Engine/Makefile.def Wed Dec 16 15:27:46 2009 +0900 @@ -6,7 +6,7 @@ ABI = -m$(ABIBIT) CC = g++ OPT = -g -CFLAGS = -g -Wall $(ABI) $(OPT) -DSIMPLE_TASK # -DDEBUG +CFLAGS = -g -Wall $(ABI) $(OPT) # -DDEBUG INCLUDE = -I$(CERIUM)/include/TaskManager -I. # LIBS = -L$(CERIUM)/TaskManager -m$(ABIBIT)
--- a/Renderer/Test/Makefile.def Wed Dec 16 09:39:24 2009 +0900 +++ b/Renderer/Test/Makefile.def Wed Dec 16 15:27:46 2009 +0900 @@ -4,7 +4,7 @@ ABIBIT = 32 ABI = -m$(ABIBIT) CC = g++ -CFLAGS = -g -Wall $(ABI) -DSIPMLE_TASK # -O -DDEBUG +CFLAGS = -g -Wall $(ABI) # -O -DDEBUG INCLUDE = -I$(CERIUM)/include/TaskManager -I$(CERIUM)/Renderer/Engine -I. -I$(CERIUM)/include/Cerium LIBS = -L$(CERIUM)/TaskManager -L$(CERIUM)/Renderer/Engine $(ABI)
--- a/TaskManager/Cell/CellTaskManagerImpl.cc Wed Dec 16 09:39:24 2009 +0900 +++ b/TaskManager/Cell/CellTaskManagerImpl.cc Wed Dec 16 15:27:46 2009 +0900 @@ -91,11 +91,7 @@ CellTaskManagerImpl::set_runTaskList() { TaskListPtr list; -#ifdef SIMPLE_TASK SimpleTaskPtr task; -#else - TaskPtr task; -#endif int speid; while (HTaskPtr htask = activeTaskQueue->poll()) { @@ -130,7 +126,7 @@ } task = &list->tasks[list->length++]; -#ifdef SIMPLE_TASK + if (htask->command==TaskArray1) { // compatibility // Task with ListData is stored in the ListData @@ -152,10 +148,6 @@ } else { *task = *(SimpleTask*)htask; } -#else - TaskPtr stask = (TaskPtr) task; - *stask = *(TaskPtr) htask; -#endif } }
--- a/TaskManager/Cell/spe/TaskArray.cc Wed Dec 16 09:39:24 2009 +0900 +++ b/TaskManager/Cell/spe/TaskArray.cc Wed Dec 16 15:27:46 2009 +0900 @@ -6,7 +6,6 @@ SchedDefineTask(TaskArray); -#ifdef SIMPLE_TASK static Task * next(Task *t) { @@ -14,12 +13,10 @@ p += t->size(); return (Task*)p; } -#endif static int run(SchedTask *s,void *rbuf, void *wbuf) { -#ifdef SIMPLE_TASK Task *task = (Task *)rbuf; Task *last = ((char*)rbuf)+ s->read_size(); @@ -27,7 +24,6 @@ task->print(s); task = next(task); } -#endif return 0; }
--- a/TaskManager/Fifo/FifoTaskManagerImpl.cc Wed Dec 16 09:39:24 2009 +0900 +++ b/TaskManager/Fifo/FifoTaskManagerImpl.cc Wed Dec 16 15:27:46 2009 +0900 @@ -86,11 +86,7 @@ FifoTaskManagerImpl::get_runTaskList() { TaskListPtr list, list_top; -#ifdef SIMPLE_TASK SimpleTaskPtr task; // Task (SPE に送る Task) -#else - TaskPtr task; // Task (SPE に送る Task) -#endif if (activeTaskQueue->empty()) { return NULL; @@ -106,7 +102,7 @@ // printf("active task queue length = %d\n",activeTaskQueue->length()); while (HTaskPtr htask = activeTaskQueue->poll()) { task = &list->tasks[list->length++]; -#ifdef SIMPLE_TASK + if (htask->command==TaskArray1) { // compatibility int next = (htask->r_size+sizeof(SimpleTask))/sizeof(SimpleTask); @@ -126,9 +122,6 @@ } else { *task = *(SimpleTask*)htask; } -#else - memcpy(task, (Task*)htask, sizeof(Task)); -#endif if (list->length >= TASK_MAX_SIZE) { TaskListPtr newList = taskListImpl->create(); list_top = TaskListInfo::append(list_top, newList);
--- a/TaskManager/Makefile.def Wed Dec 16 09:39:24 2009 +0900 +++ b/TaskManager/Makefile.def Wed Dec 16 15:27:46 2009 +0900 @@ -29,14 +29,12 @@ ABIBIT = 32 -SIMPLE_TASK=-DSIMPLE_TASK -# SIMPLE_TASK= # OPT = -O9 OPT = -g CC = g++ -CFLAGS = $(SIMPLE_TASK) -Wall `sdl-config --cflags` -m$(ABIBIT) $(OPT) +CFLAGS = -Wall `sdl-config --cflags` -m$(ABIBIT) $(OPT) LIBS = -m$(ABIBIT) INCLUDE = -I../include/TaskManager
--- a/TaskManager/kernel/ppe/HTask.cc Wed Dec 16 09:39:24 2009 +0900 +++ b/TaskManager/kernel/ppe/HTask.cc Wed Dec 16 15:27:46 2009 +0900 @@ -50,7 +50,6 @@ this->post_arg2 = arg2; } -#ifdef SIMPLE_TASK Task * HTask::create_task_array(int id, int num_task, int num_param, int num_inData, int num_outData) @@ -91,6 +90,5 @@ } -#endif /* end */
--- a/TaskManager/kernel/ppe/HTask.h Wed Dec 16 09:39:24 2009 +0900 +++ b/TaskManager/kernel/ppe/HTask.h Wed Dec 16 15:27:46 2009 +0900 @@ -21,14 +21,10 @@ 特定の Task を待ち合わせる事が可能。 Task の入出力は dma などで copy される。 */ -#ifdef SIMPLE_TASK #include "SimpleTask.h" class HTask : public SimpleTask { -#else -class HTask : public Task { -#endif public: BASE_NEW_DELETE(HTask); @@ -48,18 +44,16 @@ void wait_for(HTask *); void set_cpu(CPU_TYPE type); void set_post(PostFunction func, void *read, void *write); -#ifdef SIMPLE_TASK Task *create_task_array(int task_id, int num_task, int num_param, int num_inData, int num_outData); Task *next_task_array(int task_id, Task *t); void spawn_task_array(Task *t); + private: int param_index; int in_index; int out_index; - private: - // compatibility public: // functions void add_inData_t(memaddr addr, int size) { @@ -95,7 +89,6 @@ #define add_outData(addr, size) \ add_outData_t((memaddr)(addr), (size)); -#endif };
--- a/TaskManager/kernel/ppe/HTaskInfo.cc Wed Dec 16 09:39:24 2009 +0900 +++ b/TaskManager/kernel/ppe/HTaskInfo.cc Wed Dec 16 15:27:46 2009 +0900 @@ -64,15 +64,9 @@ q->waiter = NULL; q->command = cmd; -#ifndef SIMPLE_TASK - q->inData.clear(); - q->outData.clear(); - q->param_count = 0; -#else q->param_index = 0; q->in_index = 0; q->out_index = 0; -#endif q->self = (memaddr) q; q->post_func = NULL; @@ -88,15 +82,10 @@ HTaskPtr HTaskInfo::create(int cmd, memaddr rbuf, int rs, memaddr wbuf, int ws) { -#ifdef SIMPLE_TASK HTaskPtr task = create(cmd); task->set_input(rbuf, rs); task->set_output(wbuf, ws); return task; -#else - fprintf(stderr, "TaskManager is not SIMPLE_TASK mode\n"); - return 0; -#endif }
--- a/TaskManager/kernel/ppe/SimpleTask.h Wed Dec 16 09:39:24 2009 +0900 +++ b/TaskManager/kernel/ppe/SimpleTask.h Wed Dec 16 15:27:46 2009 +0900 @@ -13,18 +13,15 @@ int command; // 4 byte memaddr self; // 4 byte (or 8byte on 64bit mode) -#ifdef SIMPLE_TASK memaddr rbuf; memaddr wbuf; int r_size; int w_size; -#endif public: // functions SimpleTask() {}; -#ifdef SIMPLE_TASK SimpleTask(int r, memaddr read, int w, memaddr write) { r_size = r; rbuf = read; w_size = w; wbuf = write; @@ -32,7 +29,6 @@ void set_input(memaddr i,int size) { r_size = size; rbuf= i; } void set_output(memaddr o,int size) { w_size = size; wbuf= o; } -#endif };
--- a/TaskManager/kernel/ppe/Task.cc Wed Dec 16 09:39:24 2009 +0900 +++ b/TaskManager/kernel/ppe/Task.cc Wed Dec 16 15:27:46 2009 +0900 @@ -1,90 +1,5 @@ #include "Task.h" -// #include "SchedTask.h" it includes #define Task - -#ifndef SIMPLE_TASK -/** - * タスクの入力データを追加する - * - * @param [addr] add input data - * @param [size] size of data at [addr] - * - * @return if ([ret] == 0) ? success : failuer; - */ -int -Task::add_inData_t(memaddr addr, int size) -{ - return add_data(inData, addr, size); -} - -/** - * タスクの出力先を追加する - * - * @param[in] addr Address at out data - * @param[in] size Size of data transfer - * - * @return if ([ret] == 0) ? success : failuer; - */ -int -Task::add_outData_t(memaddr addr, int size) -{ - return add_data(outData, addr, size); -} - -/** - * エラーの時に -1 を返す、ってことするよりは - * perror みたいにしたほうがわかりやすいかな。 - * - * 現在は MAX_PARAMS 個まで。 - * 本当は、MAX_PARAMS個以上にすると task->param[] には アドレスが入り - * そのアドレスは メインメモリでアロケートされた int の集合。 - */ - -// こちらのAPIは、受け側と出力側での対応を良く見れない。廃止の方向。 -int -Task::add_param_t(memaddr _param) -{ - if (param_count >= MAX_PARAMS) return -1; - - this->param[param_count++] = _param; - return 0; -} - -int -Task::set_param_t(int index, memaddr _param) -{ - if (index >= MAX_PARAMS) return -1; - - this->param[index] = _param; - return 0; -} - -/* - * エラーの時に -1 を返す、ってことするよりは - * perror みたいにしたほうがわかりやすいかな。 - */ -int -Task::add_data(ListData& list, memaddr addr, int size) -{ - if (list.length >= MAX_LIST_DMA_SIZE) return -1; - - list.bound[list.length] = list.size; - - // size でも制限かけるべき? - list.size += size; - - ListElementPtr elm = &list.element[list.length++]; -#ifdef __CERIUM_CELL__ - elm->addr = (uint32)(unsigned long)addr; -#else - elm->addr = addr; -#endif - elm->size = size; - return 0; -} - -#else /* ifdef SIMPLE_TASK */ - void Task::print() { @@ -93,11 +8,11 @@ "outData size %d\n", command, size(), param_count, inData_count, outData_count ); for(int i=0; i< param_count && i<5; i++) { + // large param_count shall be a bug printf("param %d = 0x%ld\n", i, (long)param(i)); } } -#endif /* end */
--- a/TaskManager/kernel/ppe/Task.h Wed Dec 16 09:39:24 2009 +0900 +++ b/TaskManager/kernel/ppe/Task.h Wed Dec 16 15:27:46 2009 +0900 @@ -6,35 +6,6 @@ #include "ListData.h" #include "SimpleTask.h" -#define MAX_PARAMS 8 - -#ifndef SIMPLE_TASK -class Task : public SimpleTask { -public: // variables - - BASE_NEW_DELETE(Task); - int param_count; // 4 byte - memaddr param[MAX_PARAMS]; // 4*MAX_PARAMS byte - ListData inData __attribute__ ((aligned (DEFAULT_ALIGNMENT))); - ListData outData __attribute__ ((aligned (DEFAULT_ALIGNMENT))); - -public: // functions - int add_inData_t(memaddr addr, int size); // unsigned int ではなく 64bit - int add_outData_t(memaddr addr, int size); // unsigned int ではなく 64bit - int add_data(ListData &list, memaddr addr, int size); - int add_param_t(memaddr param); // obsolete. do not use. - int set_param_t(int index, memaddr param); - -#define add_param(param) add_param_t((memaddr)(param)) -#define set_param(index,param) set_param_t(index, (memaddr) (param)) - -#define add_inData(addr, size) \ - add_inData_t((memaddr)(addr), (size)); -#define add_outData(addr, size) \ - add_outData_t((memaddr)(addr), (size)); -}; - -#else class SchedTask; @@ -75,9 +46,6 @@ + round_up16(sizeof(memaddr)*params) + round_up16(sizeof(ListElement)*ins) + round_up16(sizeof(ListElement)*outs); -#if 0 -printf(" calc_size 0x%x\n",size); -#endif return size; } @@ -89,13 +57,6 @@ inData_offset = round_up16(sizeof(memaddr)*params); outData_offset = round_up16(inData_offset+sizeof(ListElement)*ins); task_size = round_up16(sizeof(Task)+outData_offset+sizeof(ListElement)*outs); -#if 0 -printf("task_id %d params %d ins %d outs %d\n",task_id, params, ins, outs); -printf(" inData_offset %d\n",inData_offset); -printf(" outData_offset %d\n",outData_offset); -printf(" task_size 0x%x\n",task_size); - this->print(); -#endif } int size() { @@ -159,7 +120,6 @@ #define set_outData(index, addr, size) \ set_outData_t(index, (memaddr)(addr), (size)); }; -#endif typedef Task* TaskPtr;
--- a/TaskManager/kernel/ppe/TaskList.h Wed Dec 16 09:39:24 2009 +0900 +++ b/TaskManager/kernel/ppe/TaskList.h Wed Dec 16 15:27:46 2009 +0900 @@ -5,19 +5,15 @@ #include "Task.h" -#define TASK_MAX_SIZE 16 +#define TASK_MAX_SIZE 32 -class TaskList { // 528byte +class TaskList { // 784 byte public: BASE_NEW_DELETE(TaskList); int length; // 4 byte TaskList *next; // 4 byte -#ifdef SIMPLE_TASK - SimpleTask tasks[TASK_MAX_SIZE]; // 512 -#else - Task tasks[TASK_MAX_SIZE]; // 512 -#endif + SimpleTask tasks[TASK_MAX_SIZE]; // 24*TASK_MAX_SIZE TaskList *output; // 4 byte int a[1]; // padding
--- a/TaskManager/kernel/ppe/TaskManager.cc Wed Dec 16 09:39:24 2009 +0900 +++ b/TaskManager/kernel/ppe/TaskManager.cc Wed Dec 16 15:27:46 2009 +0900 @@ -1,10 +1,8 @@ #include "TaskManager.h" #include "Scheduler.h" -#ifdef SIMPLE_TASK #include "HTask.h" #include "Task.h" #include "SysFunc.h" -#endif TaskManager::TaskManager(int num) : machineNum(num) { @@ -64,14 +62,12 @@ return m_impl->create_task(cmd,r,rs,w,ws); } -#ifdef SIMPLE_TASK HTaskPtr TaskManager::create_task_array(int id, int num_task, int num_param, int num_inData, int num_outData) { HTaskPtr ta = create_task(TaskArray,0,0,0,0); ta->create_task_array(id, num_task, num_param, num_inData, num_outData) ; return ta; } -#endif /** * TaskManaer 終了時に実行される関数の設定
--- a/TaskManager/kernel/ppe/TaskManager.h Wed Dec 16 09:39:24 2009 +0900 +++ b/TaskManager/kernel/ppe/TaskManager.h Wed Dec 16 15:27:46 2009 +0900 @@ -36,9 +36,7 @@ void init(); void finish(); -#ifdef SIMPLE_TASK HTask *create_task_array(int id, int num_task, int num_param, int num_inData, int num_outData); -#endif private: @@ -47,5 +45,3 @@ #endif -//extern TaskManager *manager; -
--- a/TaskManager/kernel/ppe/TaskManagerImpl.cc Wed Dec 16 09:39:24 2009 +0900 +++ b/TaskManager/kernel/ppe/TaskManagerImpl.cc Wed Dec 16 15:27:46 2009 +0900 @@ -30,13 +30,8 @@ TaskManagerImpl::systask_init() { systask_register(); -#ifdef SIMPLE_TASK systask_start = create_task(StartTask,0,0,0,0); systask_finish = create_task(FinishTask,0,0,0,0); -#else - systask_start = create_task(StartTask); - systask_finish = create_task(FinishTask); -#endif systask_start->spawn(); @@ -64,20 +59,13 @@ { HTaskPtr new_task; -#ifdef SIMPLE_TASK // for compatibility new_task = htaskImpl->create(TaskArray1); new_task->post_func = noaction; new_task->mimpl = this; Task *task = new_task->create_task_array(cmd,1,8,8,8); + // rbuf, r_size were set new_task->command = TaskArray1; - // new_task->r_size = task->size(); - // new_task->rbuf = (memaddr)task; -#else - new_task = htaskImpl->create(cmd); - new_task->post_func = noaction; - new_task->mimpl = this; -#endif return new_task; }
--- a/TaskManager/kernel/schedule/ListData.h Wed Dec 16 09:39:24 2009 +0900 +++ b/TaskManager/kernel/schedule/ListData.h Wed Dec 16 15:27:46 2009 +0900 @@ -27,14 +27,8 @@ int length; // The number of data (4) int size; // Total size of data (4) -#ifdef SIMPLE_TASK int *bound; ListElement *element; -#else - int a[2]; // for alignment - int bound[MAX_LIST_DMA_SIZE]; // (4 * MAX_LIST_DMA_SIZE) - ListElement element[MAX_LIST_DMA_SIZE]; // (8 * MAX_LIST_DMA_SIZE) -#endif void clear(void) { length = 0;
--- a/TaskManager/kernel/schedule/SchedTask.cc Wed Dec 16 09:39:24 2009 +0900 +++ b/TaskManager/kernel/schedule/SchedTask.cc Wed Dec 16 15:27:46 2009 +0900 @@ -10,36 +10,18 @@ #include "TaskManager.h" #include <stdarg.h> -#ifdef SIMPLE_TASK #include "SchedTaskArray.h" #define Task SimpleTask #define TaskPtr SimpleTaskPtr -#endif extern TaskObject task_list[MAX_TASK_OBJECT]; -#if 0 -/** - code load を始める。既に get_segment hash に入っていれば何もしない。 - */ -extern void -loadSchedTask(Scheduler *scheduler,TaskPtr task) -{ -// fprintf(stderr,"loadSchedTask %d\n",task->command); - task_list[task->command].load(scheduler,task->command); -} -#endif - SchedTask::SchedTask() { list = NULL; task = NULL; -#ifndef SIMPLE_TASK - inListData = NULL; - outListData = NULL; -#endif readbuf = NULL; writebuf = NULL; scheduler = NULL; @@ -64,10 +46,6 @@ { list = _list; task = _task; -#ifndef SIMPLE_TASK - inListData = &_task->inData; - outListData = &_task->outData; -#endif scheduler = sc; cur_index = index; @@ -84,21 +62,12 @@ // object creation をSchedTask生成時にやらないので、 // exec の直前のread で十分に間に合う loadSchedTask(scheduler, task->command); -#ifdef SIMPLE_TASK + // 読むデータが一つもなければ無視 if (task->r_size == 0) return; // load Input Data readbuf = scheduler->allocate(task->r_size); scheduler->dma_load(readbuf, task->rbuf,task->r_size, DMA_READ); -#else - - // 読むデータが一つもなければ無視 - if (inListData->length == 0) return; - - // load Input Data - readbuf = scheduler->allocate(inListData->size); - scheduler->dma_loadList(inListData, readbuf, DMA_READ); -#endif } @@ -109,32 +78,20 @@ { __debug("[SchedTask:%s]\n", __FUNCTION__); -#ifdef SIMPLE_TASK if (task->w_size > 0) { writebuf = scheduler->allocate(task->w_size); } -#else - if (outListData->length > 0) { - writebuf = scheduler->allocate(outListData->size); - } -#endif scheduler->dma_wait(DMA_READ); task_list[task->command].wait(scheduler,task->command); task_list[task->command].run(this, readbuf, writebuf); free(readbuf); // 書き込む領域がなければ無視 -#ifdef SIMPLE_TASK + if (task->w_size > 0) { writebuf = scheduler->allocate(task->w_size); scheduler->dma_store(writebuf, task->wbuf,task->w_size, DMA_WRITE); } -#else - if (outListData->length > 0) { - writebuf = scheduler->allocate(outListData->size); - scheduler->dma_storeList(outListData, writebuf, DMA_WRITE); - } -#endif } void @@ -159,7 +116,7 @@ TaskPtr nextTask = &list->tasks[cur_index++]; SchedTask *nextSched = new SchedTask(); nextSched->init(list, nextTask, cur_index, scheduler); -#ifdef SIMPLE_TASK + if (nextTask->command==TaskArray1) { // compatibility return new SchedTaskArray(scheduler, nextSched); @@ -168,7 +125,6 @@ // Start Task Array return new SchedTaskArrayLoad(scheduler, nextSched); } -#endif return nextSched; } else { memaddr nextList = (memaddr)list->next; @@ -193,85 +149,6 @@ scheduler->free_(p); } -#ifndef SIMPLE_TASK -/** - * task->add_inData で与えられた順番に対応する index (0〜n-1) で、 - * buffer から対応するデータを返す。 - */ -void* -SchedTask::get_input(void *buff, int index) -{ - if (buff != NULL) { - return (void*)((char*)buff + inListData->bound[index]); - } else { - return NULL; - } -} - -/** - * get_input(index) のアドレスを返す - */ -memaddr -SchedTask::get_inputAddr(int index) -{ -#ifdef __CERIUM_CELL__ - return (memaddr)inListData->element[index].addr; -#else - return inListData->element[index].addr; -#endif -} - -/** - * get_input(index) のサイズを返す - */ -int -SchedTask::get_inputSize(int index) -{ - return inListData->element[index].size; -} - -/** - * write buffer の領域を返す。 - */ -void* -SchedTask::get_output(void *buff, int index) -{ - if (buff != NULL) { - return (void*)((char *)buff + outListData->bound[index]); - } else { - return NULL; - } -} - -/** - * get_output(index) のアドレスを返す - */ -memaddr -SchedTask::get_outputAddr(int index) -{ -#ifdef __CERIUM_CELL__ - return (memaddr)outListData->element[index].addr; -#else - return outListData->element[index].addr; -#endif -} - -/** - * get_output(index) のサイズを返す - */ -int -SchedTask::get_outputSize(int index) -{ - return outListData->element[index].size; -} - -memaddr -SchedTask::get_param(int index) -{ - return task->param[index]; -} - -#else void* SchedTask::get_input(void *buff, int index) { printf("Cannot use inData in SimpleTask use TaskArray\n"); @@ -283,7 +160,6 @@ int SchedTask::get_outputSize(int index) { return 0; } memaddr SchedTask::get_param(int index) { return 0; } -#endif void* SchedTask::global_alloc(int id, int size) {
--- a/TaskManager/kernel/schedule/SchedTask.h Wed Dec 16 09:39:24 2009 +0900 +++ b/TaskManager/kernel/schedule/SchedTask.h Wed Dec 16 15:27:46 2009 +0900 @@ -19,35 +19,11 @@ BASE_NEW_DELETE(SchedTask); - // Task を実行するスケジューラ自身 -#if 0 - Scheduler *scheduler; -#endif - -#ifndef SIMPLE_TASK -#if 0 - TaskPtr task; -#endif - memaddr *param; - // read/write 用の ListData - ListDataPtr inListData; - ListDataPtr outListData; -#else -#if 0 - SimpleTaskPtr task; -#endif + // Task Array しか使わないが、たいした大きさではないのでいいか... ListData inListData; ListData outListData; -#endif /* variables */ - -#if 0 - // 現在スケジューラが実行している TaskList と、このタスクに対応する Task - TaskListPtr list; - // Task の、Tasklist での位置。(task = &list[cur_index-1]) - int cur_index; -#endif private: @@ -78,20 +54,14 @@ public: /* functions */ -#ifdef SIMPLE_TASK void init(TaskListPtr _list, SimpleTaskPtr _task, int index, Scheduler* sc); -#else - void init(TaskListPtr _list, TaskPtr _task, int index, - Scheduler* sc); -#endif //--- User API --- -#ifdef SIMPLE_TASK int read_size() { return task->r_size; } int write_size() { return task->w_size; } void set_write_size(int w) { task->w_size = w; } -#endif + virtual void* get_input(void *buff, int index); virtual void* get_output(void *buff, int index); virtual memaddr get_param(int index);
--- a/TaskManager/kernel/schedule/SchedTaskArray.cc Wed Dec 16 09:39:24 2009 +0900 +++ b/TaskManager/kernel/schedule/SchedTaskArray.cc Wed Dec 16 15:27:46 2009 +0900 @@ -1,7 +1,6 @@ #include "SchedTaskArray.h" #include "Scheduler.h" -#ifdef SIMPLE_TASK SchedTaskArray::SchedTaskArray(Scheduler *s, SchedTaskBase *savedTask_, Task *curTask_, Task *_array) { @@ -240,6 +239,5 @@ return *atask->param(index); } -#endif /* end */
--- a/TaskManager/kernel/schedule/SchedTaskArrayLoad.cc Wed Dec 16 09:39:24 2009 +0900 +++ b/TaskManager/kernel/schedule/SchedTaskArrayLoad.cc Wed Dec 16 15:27:46 2009 +0900 @@ -2,7 +2,6 @@ #include "SchedTaskArray.h" #include "Task.h" -#ifdef SIMPLE_TASK SchedTaskArrayLoad::SchedTaskArrayLoad(Scheduler *s, SchedTaskBase *savedTask_) { @@ -37,6 +36,5 @@ Task *nextTask = (Task *)readbuf; return new SchedTaskArray(scheduler, savedTask, nextTask, nextTask); } -#endif /* end */
--- a/TaskManager/kernel/schedule/SchedTaskBase.h Wed Dec 16 09:39:24 2009 +0900 +++ b/TaskManager/kernel/schedule/SchedTaskBase.h Wed Dec 16 15:27:46 2009 +0900 @@ -28,11 +28,7 @@ // Task を実行するスケジューラ自身 Scheduler *scheduler; -#ifndef SIMPLE_TASK - TaskPtr task; -#else SimpleTaskPtr task; -#endif // 現在スケジューラが実行している TaskList と、このタスクに対応する Task TaskListPtr list;
--- a/TaskManager/kernel/schedule/Scheduler.h Wed Dec 16 09:39:24 2009 +0900 +++ b/TaskManager/kernel/schedule/Scheduler.h Wed Dec 16 15:27:46 2009 +0900 @@ -154,21 +154,12 @@ extern TaskObject task_list[MAX_TASK_OBJECT]; -#ifdef SIMPLE_TASK inline void loadSchedTask(Scheduler *scheduler,int command) { // fprintf(stderr,"loadSchedTask %d\n",task->command); task_list[command].load(scheduler,command); } -#else -inline void -loadSchedTask(Scheduler *scheduler,int command) -{ -// fprintf(stderr,"loadSchedTask %d\n",task->command); - task_list[command].load(scheduler,command); -} -#endif #endif
--- a/example/Bulk/Makefile.def Wed Dec 16 09:39:24 2009 +0900 +++ b/example/Bulk/Makefile.def Wed Dec 16 15:27:46 2009 +0900 @@ -9,7 +9,7 @@ CC = g++ OPT = -g -CFLAGS = -Wall $(OPT) -DSIMPLE_TASK +CFLAGS = -Wall $(OPT) ABIBIT = 32
--- a/example/Simple/Makefile.def Wed Dec 16 09:39:24 2009 +0900 +++ b/example/Simple/Makefile.def Wed Dec 16 15:27:46 2009 +0900 @@ -5,13 +5,11 @@ # ex linux/ps3 CERIUM = ../../../Cerium -SIMPLE_TASK=-DSIMPLE_TASK -# SIMPLE_TASK= OPT= -g CC = g++ -CFLAGS = -Wall $(OPT) $(SIMPLE_TASK) +CFLAGS = -Wall $(OPT) INCLUDE = -I${CERIUM}/include/TaskManager -I. -I.. LIBS = -L${CERIUM}/TaskManager
--- a/example/Simple/spe/Makefile Wed Dec 16 09:39:24 2009 +0900 +++ b/example/Simple/spe/Makefile Wed Dec 16 15:27:46 2009 +0900 @@ -6,7 +6,7 @@ SRCS = $(filter-out $(SRCS_EXCLUDE),$(SRCS_TMP)) OBJS = $(SRCS:.cc=.o) -CC = spu-g++ -DABIBIT=$(ABIBIT) $(SIMPLE_TASK) $(OPT) +CC = spu-g++ -DABIBIT=$(ABIBIT) $(OPT) CFLAGS = -g -Wall -fno-exceptions -fno-rtti #-DDEBUG INCLUDE = -I../${CERIUM}/include/TaskManager -I. -I.. LIBS = -L../${CERIUM}/TaskManager -lspemanager
--- a/example/basic/Makefile.def Wed Dec 16 09:39:24 2009 +0900 +++ b/example/basic/Makefile.def Wed Dec 16 15:27:46 2009 +0900 @@ -9,7 +9,7 @@ CC = g++ OPT = -g -CFLAGS = $(OPT) -Wall # -DSIMPLE_TASK +CFLAGS = $(OPT) -Wall ABIBIT = 32
--- a/example/word_count_test/Makefile.def Wed Dec 16 09:39:24 2009 +0900 +++ b/example/word_count_test/Makefile.def Wed Dec 16 15:27:46 2009 +0900 @@ -7,14 +7,12 @@ # ex linux/ps3 CERIUM = ../../../Cerium -# SIMPLE_TASK= -DSIMPLE_TASK -SIMPLE_TASK= OPT = -O9 # OPT = -g CC = g++ -CFLAGS = -Wall $(OPT) $(SIMPLE_TASK) +CFLAGS = -Wall $(OPT) INCLUDE = -I${CERIUM}/include/TaskManager -I. -I.. LIBS = -L${CERIUM}/TaskManager
--- a/example/word_count_test/main.cc Wed Dec 16 09:39:24 2009 +0900 +++ b/example/word_count_test/main.cc Wed Dec 16 15:27:46 2009 +0900 @@ -73,19 +73,10 @@ { for (int j = 0; j < task_count && w->size>0; j++) { int i = w->task_spwaned++; -#ifdef SIMPLE_TASK // printf("div %0x\n", (w->file_mmap + i*w->division_size)); HTaskPtr t_exec = manager->create_task(TASK_EXEC, (memaddr)(w->file_mmap + i*w->division_size), size, (memaddr)(w->o_data + i*w->out_size), w->division_out_size); -#else - HTaskPtr t_exec = manager->create_task(TASK_EXEC); - if (size>w->size) size = w->size; - t_exec->add_inData(w->file_mmap + i*w->division_size, size); - t_exec->add_outData(w->o_data + i*w->status_num, w->division_out_size); - t_exec->add_outData(w->head_tail_flag + i*w->pad, w->division_out_size); - t_exec->add_param(size); -#endif t_exec->set_cpu(SPE_ANY); t_next->wait_for(t_exec); t_exec->spawn(); @@ -99,11 +90,7 @@ static int run16(SchedTask *manager, void *in, void *out) { -#ifdef SIMPLE_TASK WordCount *w = *(WordCount **)in; -#else - WordCount *w = (WordCount *)manager->get_param(0); -#endif if (w->task_num < w->task_blocks) { if (w->size >= w->division_size) @@ -112,13 +99,8 @@ run_tasks(manager,w,1, w->t_print, w->size); // printf("run16 last %d\n",w->task_num); } else { -#ifdef SIMPLE_TASK HTaskPtr t_next = manager->create_task(RUN_TASK_BLOCKS, (memaddr)&w->self,sizeof(memaddr),0,0); -#else - HTaskPtr t_next = manager->create_task(RUN_TASK_BLOCKS); - t_next->set_param(0,(void*)w); -#endif w->t_print->wait_for(t_next); run_tasks(manager,w, w->task_blocks, t_next, w->division_size); @@ -172,52 +154,24 @@ /* out用のdivision_size. statusが2つなので、あわせて16byteになるように、long long(8byte)を使用 */ -#ifdef SIMPLE_TASK w-> division_out_size = sizeof(unsigned long long)*4; int out_size = w->division_out_size*out_task_num; w->o_data = (unsigned long long *)manager->allocate(out_size); w-> out_size = 4; -#else - w-> division_out_size = 16; - int out_size = w->division_out_size*out_task_num; - /* out用のデータのサイズ。*/ - caddr_t p = (caddr_t) manager->allocate(out_size*2); - w->o_data = (unsigned long long*)p; - //bzero(w->o_data,out_size); - - w-> pad = 2; - w->head_tail_flag = (unsigned long long*)(p+out_size); - // bzero(w->head_tail_flag,out_size); -#endif printf("out size %d\n",out_size); /*各SPEの結果を合計して出力するタスク*/ -#ifdef SIMPLE_TASK t_print = manager->create_task(TASK_PRINT, (memaddr)&w->self,sizeof(memaddr),0,0); -#else - t_print = manager->create_task(TASK_PRINT); - t_print->add_inData(w->o_data, out_size); - t_print->add_inData(w->head_tail_flag, out_size); - t_print->add_param(out_task_num); - t_print->add_param(w->status_num); - t_print->add_param(out_task_num); - t_print->add_param(w->pad); -#endif w->t_print = t_print; for(int i = 0;i<1;i++) { /* Task を task_blocks ずつ起動する Task */ /* serialize されていると仮定する... */ - #ifdef SIMPLE_TASK HTaskPtr t_exec = manager->create_task(RUN_TASK_BLOCKS, (memaddr)&w->self,sizeof(memaddr),0,0); - #else - HTaskPtr t_exec = manager->create_task(RUN_TASK_BLOCKS); - t_exec->set_param(0,(void*)w); - #endif t_exec->spawn(); t_print->wait_for(t_exec); }
--- a/example/word_count_test/ppe/Exec.cc Wed Dec 16 09:39:24 2009 +0900 +++ b/example/word_count_test/ppe/Exec.cc Wed Dec 16 15:27:46 2009 +0900 @@ -9,18 +9,11 @@ static int run(SchedTask *s, void *rbuf, void *wbuf) { -#ifdef SIMPLE_TASK char *i_data = (char *)rbuf; unsigned long long *o_data = (unsigned long long*)wbuf; unsigned long long *head_tail_flag = o_data +2; int length = s->read_size(); -#else - char *i_data = (char*)s->get_input(rbuf, 0); - unsigned long long *o_data = (unsigned long long*)s->get_output(wbuf, 0); - /*担当範囲の先頭、末尾が「改行、スペース」か、「それ以外の文字」かのフラグ*/ - unsigned long long *head_tail_flag = (unsigned long long*)s->get_output(wbuf,1); - int length = (long)s->get_param(0); -#endif + int word_flag = 0; int word_num = 0; int line_num = 0;
--- a/example/word_count_test/ppe/Print.cc Wed Dec 16 09:39:24 2009 +0900 +++ b/example/word_count_test/ppe/Print.cc Wed Dec 16 15:27:46 2009 +0900 @@ -10,7 +10,6 @@ static int run_print(SchedTask *s, void *rbuf, void *wbuf) { -#ifdef SIMPLE_TASK WordCount *w = *(WordCount**)rbuf; unsigned long long *idata = w->o_data; // long task_num = w->task_num; @@ -23,14 +22,6 @@ * o_data[1] * */ -#else - unsigned long long *idata = (unsigned long long*)s->get_input(rbuf, 0); - unsigned long long *head_tail_flag = (unsigned long long*)s->get_input(rbuf, 1); - // long task_num = (long)s->get_param(0); - long status_num = (long)s->get_param(1); - int out_task_num = (int)s->get_param(2); - int pad = (int)s->get_param(3); -#endif unsigned long long word_data[2]; int flag_cal_sum = 0; @@ -75,7 +66,6 @@ word_data[i] = 0; } -#ifdef SIMPLE_TASK for (int i = 0; i < out_task_num ; i++) { word_data[0] += idata[i*w->out_size+0]; word_data[1] += idata[i*w->out_size+1]; @@ -86,21 +76,6 @@ flag_cal_sum++; } } -#else - for (int i = 1; i < out_task_num * pad - pad; i += pad) { - //printf("%llu ",head_tail_flag[i]); - //printf("%llu\n",head_tail_flag[i+1]); - if((head_tail_flag[i] == 1) && (head_tail_flag[i+1] == 0)) { - flag_cal_sum++; - } - } - - for (int i = 0; i < out_task_num*status_num; i += status_num) { - for (int j = 0; j < status_num; j++) { - word_data[j] += idata[i+j]; - } - } -#endif word_data[0] += flag_cal_sum;
--- a/example/word_count_test/spe/Exec.cc Wed Dec 16 09:39:24 2009 +0900 +++ b/example/word_count_test/spe/Exec.cc Wed Dec 16 15:27:46 2009 +0900 @@ -9,18 +9,10 @@ static int run(SchedTask *s, void *rbuf, void *wbuf) { -#ifdef SIMPLE_TASK char *i_data = (char *)rbuf; unsigned long long *o_data = (unsigned long long*)wbuf; unsigned long long *head_tail_flag = o_data +2; int length = s->read_size(); -#else - char *i_data = (char*)s->get_input(rbuf, 0); - unsigned long long *o_data = (unsigned long long*)s->get_output(wbuf, 0); - /*担当範囲の先頭、末尾が「改行、スペース」か、「それ以外の文字」かのフラグ*/ - unsigned long long *head_tail_flag = (unsigned long long*)s->get_output(wbuf,1); - int length = (long)s->get_param(0); -#endif int word_flag = 0; int word_num = 0; int line_num = 0;
--- a/example/word_count_test/spe/Makefile Wed Dec 16 09:39:24 2009 +0900 +++ b/example/word_count_test/spe/Makefile Wed Dec 16 15:27:46 2009 +0900 @@ -7,7 +7,7 @@ OBJS = $(SRCS:.cc=.o) CC = spu-g++ -CFLAGS = -Wall -fno-exceptions -fno-rtti $(OPT) $(SIMPLE_TASK) #-DDEBUG +CFLAGS = -Wall -fno-exceptions -fno-rtti $(OPT) INCLUDE = -I../${CERIUM}/include/TaskManager -I. -I.. LIBS = -L../${CERIUM}/TaskManager -lspemanager
--- a/example/word_count_test/spe/Print.cc Wed Dec 16 09:39:24 2009 +0900 +++ b/example/word_count_test/spe/Print.cc Wed Dec 16 15:27:46 2009 +0900 @@ -10,7 +10,6 @@ static int run_print(SchedTask *s, void *rbuf, void *wbuf) { -#ifdef SIMPLE_TASK WordCount *w = *(WordCount**)rbuf; unsigned long long *idata = w->o_data; // long task_num = w->task_num; @@ -23,14 +22,6 @@ * o_data[1] * */ -#else - unsigned long long *idata = (unsigned long long*)s->get_input(rbuf, 0); - unsigned long long *head_tail_flag = (unsigned long long*)s->get_input(rbuf, 1); - // long task_num = (long)s->get_param(0); - long status_num = (long)s->get_param(1); - int out_task_num = (int)s->get_param(2); - int pad = (int)s->get_param(3); -#endif unsigned long long word_data[2]; int flag_cal_sum = 0; @@ -75,7 +66,6 @@ word_data[i] = 0; } -#ifdef SIMPLE_TASK for (int i = 0; i < out_task_num ; i++) { word_data[0] += idata[i*w->out_size+0]; word_data[1] += idata[i*w->out_size+1]; @@ -86,21 +76,6 @@ flag_cal_sum++; } } -#else - for (int i = 1; i < out_task_num * pad - pad; i += pad) { - //printf("%llu ",head_tail_flag[i]); - //printf("%llu\n",head_tail_flag[i+1]); - if((head_tail_flag[i] == 1) && (head_tail_flag[i+1] == 0)) { - flag_cal_sum++; - } - } - - for (int i = 0; i < out_task_num*status_num; i += status_num) { - for (int j = 0; j < status_num; j++) { - word_data[j] += idata[i+j]; - } - } -#endif word_data[0] += flag_cal_sum;