Mercurial > hg > Members > kono > Cerium
changeset 636:d433fc37587d
Cell Simple Task compiled. but not worked.
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 18 Nov 2009 19:09:40 +0900 |
parents | 8cc609285bbe |
children | 5530fa36d42e |
files | TaskManager/Cell/spe/SpeTaskManagerImpl.cc TaskManager/Cell/spe/SpeTaskManagerImpl.h TaskManager/Cell/spe/main.cc TaskManager/Makefile.cell TaskManager/kernel/ppe/HTaskInfo.cc TaskManager/kernel/ppe/HTaskInfo.h TaskManager/kernel/ppe/TaskManagerImpl.cc TaskManager/kernel/ppe/TaskManagerImpl.h TaskManager/kernel/sys_task/SysTasks.h example/Simple/spe/Makefile example/Simple/spe/spe-main.cc |
diffstat | 11 files changed, 47 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/TaskManager/Cell/spe/SpeTaskManagerImpl.cc Wed Nov 18 18:36:25 2009 +0900 +++ b/TaskManager/Cell/spe/SpeTaskManagerImpl.cc Wed Nov 18 19:09:40 2009 +0900 @@ -1,13 +1,39 @@ #include "SpeTaskManagerImpl.h" #include "Scheduler.h" +#include <stdlib.h> HTaskPtr TaskManagerImpl::create_task(int cmd) {return 0;} +HTaskPtr TaskManagerImpl::create_task(int cmd, memaddr rbuf, long rs, memaddr wbuf, long ws) { return 0; } void TaskManagerImpl::set_task_depend(HTaskPtr master, HTaskPtr slave) {} void TaskManagerImpl::spawn_task(HTaskPtr) {} void TaskManagerImpl::set_task_cpu(HTaskPtr, CPU_TYPE) {} -void* TaskManagerImpl::allocate(int size) { return scheduler->allocate(size); } -void* TaskManagerImpl::allocate(int size,int align) { return scheduler->allocate(size,align); } +void* +TaskManagerImpl::allocate(int size, int alignment) +{ + if (size==0) return 0; +#if defined(__SPU__) + return malloc(size); +#else + void *buff; + posix_memalign(&buff, alignment, size); + return buff; +#endif +} +void* +TaskManagerImpl::allocate(int size) +{ + if (size==0) return 0; +#if defined(__SPU__) + return malloc(size); +#else + void *buff; + posix_memalign(&buff, DEFAULT_ALIGNMENT, size); + return buff; +#endif +} + +
--- a/TaskManager/Cell/spe/SpeTaskManagerImpl.h Wed Nov 18 18:36:25 2009 +0900 +++ b/TaskManager/Cell/spe/SpeTaskManagerImpl.h Wed Nov 18 19:09:40 2009 +0900 @@ -20,18 +20,20 @@ Scheduler *scheduler; /* constructor */ - TaskManagerImpl(Scheduler *s) { scheduler = s; } + TaskManagerImpl() { } ~TaskManagerImpl() { } // user HTaskPtr create_task(int cmd); + HTaskPtr create_task(int cmd, memaddr rbuf, long rs, memaddr wbuf, long ws); void set_task_depend(HTaskPtr master, HTaskPtr slave); void spawn_task(HTaskPtr); void set_task_cpu(HTaskPtr, CPU_TYPE); void* allocate(int size); void* allocate(int size,int align); + void set_scheduler(Scheduler *s) { scheduler = s; }; Scheduler* get_scheduler() { return scheduler; }; };
--- a/TaskManager/Cell/spe/main.cc Wed Nov 18 18:36:25 2009 +0900 +++ b/TaskManager/Cell/spe/main.cc Wed Nov 18 19:09:40 2009 +0900 @@ -20,12 +20,13 @@ __debug("code_size:%10d bytes\n", code_size); __debug("heap_size:%10d bytes\n", heap_size); + TaskManagerImpl *tm = new TaskManagerImpl(); + manager = new CellScheduler(); - manager->init(); + manager->init(tm); manager->id = (int)argc; - TaskManagerImpl *tm = new TaskManagerImpl(manager); - manager->set_manager(tm); + tm->set_scheduler(manager); spu_write_decrementer(0x7FFFFFFFU); unsigned int prof = spu_read_decrementer();
--- a/TaskManager/Makefile.cell Wed Nov 18 18:36:25 2009 +0900 +++ b/TaskManager/Makefile.cell Wed Nov 18 19:09:40 2009 +0900 @@ -35,7 +35,7 @@ EXTRA_CFLAGS = -D__CERIUM_CELL__ -DHAS_POSIX_MEMALIGN -fno-strict-aliasing -SPE_CFLAGS = -D__CERIUM_CELL__ -fno-exceptions -fno-rtti -Wall -O9 +SPE_CFLAGS = -DSIMPLE_TASK -D__CERIUM_CELL__ -fno-exceptions -fno-rtti -Wall -O9 all: default @@ -55,7 +55,7 @@ $(CELL_SPE_SCHEDULE_SRC): kernel/schedule/*.cc cp kernel/schedule/*.cc $(CELL_SPE_DIR)/ cp kernel/memory/*.cc $(CELL_SPE_DIR)/ - cp kernel/ppe/{TaskList.cc,TaskQueue.cc,Task.cc} $(CELL_SPE_DIR)/ + cp kernel/ppe/{TaskQueue.cc,Task.cc} $(CELL_SPE_DIR)/ $(CELL_SPE_OBJS): %.o : %.cc $(SPUCC) $(SPE_CFLAGS) $(INCLUDE) -c $< -o $@
--- a/TaskManager/kernel/ppe/HTaskInfo.cc Wed Nov 18 18:36:25 2009 +0900 +++ b/TaskManager/kernel/ppe/HTaskInfo.cc Wed Nov 18 19:09:40 2009 +0900 @@ -82,11 +82,11 @@ } HTaskPtr -HTaskInfo::create(int cmd, void *rbuf, int rs, void *wbuf, int ws) +HTaskInfo::create(int cmd, memaddr rbuf, int rs, memaddr wbuf, int ws) { HTaskPtr task = create(cmd); - task->set_input((memaddr)rbuf, rs); - task->set_output((memaddr)wbuf, ws); + task->set_input(rbuf, rs); + task->set_output(wbuf, ws); return task; }
--- a/TaskManager/kernel/ppe/HTaskInfo.h Wed Nov 18 18:36:25 2009 +0900 +++ b/TaskManager/kernel/ppe/HTaskInfo.h Wed Nov 18 19:09:40 2009 +0900 @@ -14,7 +14,7 @@ /* functions */ HTaskPtr create(int cmd); - HTaskPtr create(int cmd, void *rbuf, int rs, void *wbuf, int ws); + HTaskPtr create(int cmd, memaddr rbuf, int rs, memaddr wbuf, int ws); void free_(HTaskPtr queue);
--- a/TaskManager/kernel/ppe/TaskManagerImpl.cc Wed Nov 18 18:36:25 2009 +0900 +++ b/TaskManager/kernel/ppe/TaskManagerImpl.cc Wed Nov 18 19:09:40 2009 +0900 @@ -44,7 +44,7 @@ } HTaskPtr -TaskManagerImpl::create_task(int cmd,void *rbuf, long r_size, void *wbuf, long w_size) +TaskManagerImpl::create_task(int cmd,memaddr rbuf, long r_size, memaddr wbuf, long w_size) { HTaskPtr new_task;
--- a/TaskManager/kernel/ppe/TaskManagerImpl.h Wed Nov 18 18:36:25 2009 +0900 +++ b/TaskManager/kernel/ppe/TaskManagerImpl.h Wed Nov 18 19:09:40 2009 +0900 @@ -43,7 +43,7 @@ // user HTaskPtr create_task(int cmd); - HTaskPtr create_task(int cmd, void *rbuf, long r_size, void *rbuf, long w_size); + HTaskPtr create_task(int cmd, memaddr rbuf, long r_size, memaddr wbuf, long w_size); void set_task_depend(HTaskPtr master, HTaskPtr slave); void spawn_task(HTaskPtr); void set_task_cpu(HTaskPtr, CPU_TYPE);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TaskManager/kernel/sys_task/SysTasks.h Wed Nov 18 19:09:40 2009 +0900 @@ -0,0 +1,2 @@ +StartTask, +FinishTask,
--- a/example/Simple/spe/Makefile Wed Nov 18 18:36:25 2009 +0900 +++ b/example/Simple/spe/Makefile Wed Nov 18 19:09:40 2009 +0900 @@ -6,7 +6,7 @@ SRCS = $(filter-out $(SRCS_EXCLUDE),$(SRCS_TMP)) OBJS = $(SRCS:.cc=.o) -CC = spu-g++ -DABIBIT=$(ABIBIT) +CC = spu-g++ -DABIBIT=$(ABIBIT) -DSIMPLE_TASK CFLAGS = -g -Wall -fno-exceptions -fno-rtti #-DDEBUG INCLUDE = -I../${CERIUM}/include/TaskManager -I. -I.. LIBS = -L../${CERIUM}/TaskManager -lspemanager