Mercurial > hg > Game > Cerium
changeset 2000:ac16a57f5dd7 draft
fix get_nextTaskArea
author | kkb |
---|---|
date | Fri, 02 May 2014 19:30:48 +0900 |
parents | 278e6ae50b72 |
children | 3e3cc12096f7 |
files | TaskManager/kernel/ppe/HTask.cc TaskManager/kernel/ppe/HTask.h TaskManager/kernel/ppe/QueueInfo.h TaskManager/kernel/ppe/Task.h TaskManager/kernel/ppe/TaskManagerImpl.cc example/Bulk/Makefile example/Bulk/Makefile.cuda example/Bulk/Makefile.gpu example/Bulk/Makefile.macosx |
diffstat | 9 files changed, 124 insertions(+), 28 deletions(-) [+] |
line wrap: on
line diff
--- a/TaskManager/kernel/ppe/HTask.cc Fri May 02 16:41:31 2014 +0900 +++ b/TaskManager/kernel/ppe/HTask.cc Fri May 02 19:30:48 2014 +0900 @@ -167,16 +167,17 @@ last = task->next(); return task; } - Task *next=get_nextTaskArea(t,tl); + int task_size = Task::calc_size(param_count, inData_count, outData_count); + Task *next=get_nextTaskArea(t,tl,task_size); next->init(id, param_count, inData_count, outData_count); last = next->next(); return next; } Task * -HTask::get_nextTaskArea(Task *t, TaskList *tl) { +HTask::get_nextTaskArea(Task *t, TaskList *tl, int task_size) { Task *next = t->next(); - if (next >= tl->last()) { + if (((char*)(tl->last()))-((char*)(next)) < task_size) { tl->set_last(t); TaskListPtr nextTaskList = mimpl->createTaskList(); nextTaskList->prev = tl;
--- a/TaskManager/kernel/ppe/HTask.h Fri May 02 16:41:31 2014 +0900 +++ b/TaskManager/kernel/ppe/HTask.h Fri May 02 19:30:48 2014 +0900 @@ -65,7 +65,7 @@ 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); Task *next_task_array(int id, Task *t, int param_count, int inData_count, int outData_count); - Task *get_nextTaskArea(Task* t, TaskList* tl); + Task *get_nextTaskArea(Task* t, TaskList* tl, int task_size); void spawn_task_array(Task *t); int task_count();
--- a/TaskManager/kernel/ppe/QueueInfo.h Fri May 02 16:41:31 2014 +0900 +++ b/TaskManager/kernel/ppe/QueueInfo.h Fri May 02 19:30:48 2014 +0900 @@ -138,9 +138,9 @@ T* p = q; for (; num-- > 0;) { p->waiter = NULL; - p->initOnce(); + p->initOnce(); addLast(p); - p = (T*)ROUND_UP_ALIGN((long)(p+1),DEFAULT_ALIGNMENT); + p = (T*)ROUND_UP_ALIGN((long)(p+1),DEFAULT_ALIGNMENT); } return 0;
--- a/TaskManager/kernel/ppe/Task.h Fri May 02 16:41:31 2014 +0900 +++ b/TaskManager/kernel/ppe/Task.h Fri May 02 19:30:48 2014 +0900 @@ -56,13 +56,7 @@ outData_count = outs; 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); - - task_size = round_up16(sizeof(Task)) - + round_up16(sizeof(memaddr)*params) - + round_up16(sizeof(ListElement)*ins) - + round_up16(sizeof(ListElement)*outs); - + task_size = calc_size(params, ins, outs); } int size() {
--- a/TaskManager/kernel/ppe/TaskManagerImpl.cc Fri May 02 16:41:31 2014 +0900 +++ b/TaskManager/kernel/ppe/TaskManagerImpl.cc Fri May 02 19:30:48 2014 +0900 @@ -292,19 +292,19 @@ tasklog->finish_time = rdtsc(); while(TaskQueue *p = me->wait_me->poll()) { - HTaskPtr you = p->task; - QueueInfo<TaskQueue> *wait_i = you->wait_i; - // 相手の wait queue から自分(を指しているTaskQueue)を削除 - wait_i->remove(p->waiter); - // queue を free する - wait_i->free_(p->waiter); + HTaskPtr you = p->task; + QueueInfo<TaskQueue> *wait_i = you->wait_i; + // 相手の wait queue から自分(を指しているTaskQueue)を削除 + wait_i->remove(p->waiter); + // queue を free する + wait_i->free_(p->waiter); + + if (wait_i->empty()) { + wait_queue->remove(you); + append_activeTask(you); + } - if (wait_i->empty()) { - wait_queue->remove(you); - append_activeTask(you); - } - - wait_i->free_(p); // p->wait_i, p->wait_me は再利用される + wait_i->free_(p); // p->wait_i, p->wait_me は再利用される } // このTaskList は終わったので、今 free して良いが、TaskListInfo に入っているので、
--- a/example/Bulk/Makefile Fri May 02 16:41:31 2014 +0900 +++ b/example/Bulk/Makefile Fri May 02 19:30:48 2014 +0900 @@ -16,9 +16,20 @@ @echo "Make for PS3 (Cell)" @$(MAKE) -f Makefile.cell +gpu: FORCE + @echo "Make for GPU" + @$(MAKE) -f Makefile.gpu + +cuda: FORCE + @echo "Make for CUDA" + @$(MAKE) -f Makefile.cuda + FORCE: +test: + ./twice + clean: @$(MAKE) -f Makefile.macosx clean @$(MAKE) -f Makefile.linux clean - @$(MAKE) -f Makefile.cell clean \ No newline at end of file + @$(MAKE) -f Makefile.cell clean
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example/Bulk/Makefile.cuda Fri May 02 19:30:48 2014 +0900 @@ -0,0 +1,49 @@ +include ./Makefile.def + +SRCS_TMP = $(wildcard *.cc) +SRCS_EXCLUDE = # 除外するファイルを書く +SRCS = $(filter-out $(SRCS_EXCLUDE),$(SRCS_TMP)) +OBJS = $(SRCS:.cc=.o) + +TASK_DIR = ppe +CUDA_TASK_DIR = cuda + +TASK_SRCS_TMP = $(wildcard $(TASK_DIR)/*.cc) +TASK_SRCS_EXCLUDE = +TASK_SRCS = $(filter-out $(TASK_DIR)/$(TASK_SRCS_EXCLUDE),$(TASK_SRCS_TMP)) $(wildcard $(CUDA_TASK_DIR)/*.cc) +TASK_OBJS = $(TASK_SRCS:.cc=.o) + +CUDA_SRCS_TMP = $(wildcard $(CUDA_TASK_DIR)/*.cu) +CUDA_SRCS_EXCLUDE = # 除外するファイルを書く +CUDA_SRCS = $(filter-out $(CUDA_TASK_DIR)/$(CUDA_SRCS_EXCLUDE),$(CUDA_SRCS_TMP)) +CUDA_OBJS = $(CUDA_SRCS:.cu=.ptx) + +CFLAGS += -D__CERIUM_GPU__ +LIBS += `sdl-config --libs` -lCudaManager -F/Library/Frameworks -framework CUDA + +INCLUDE += -I/Developer/NVIDIA/CUDA-5.5/include + +NVCC = /Developer/NVIDIA/CUDA-5.5/bin/nvcc +NVCCFLAGS = -ptx -arch=sm_20 + +.SUFFIXES: .cc .o + +.cc.o: + $(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@ + +all: $(TARGET) + +$(TARGET): $(OBJS) $(TASK_OBJS) $(CUDA_SRCS_TMP) $(CUDA_TASK_DIR) + $(NVCC) $(NVCCFLAGS) $(CUDA_SRCS_TMP) -o $(CUDA_TASK_DIR)/$@.ptx + $(CC) -o $@ $(OBJS) $(TASK_OBJS) $(LIBS) + +link: + $(CC) -o $(TARGET) $(OBJS) $(TASK_OBJS) $(LIBS) + +debug: $(TARGET) + sudo ppu-gdb ./$(TARGET) + +clean: + rm -f $(TARGET) $(OBJS) $(TASK_OBJS) $(CUDA_OBJS) + rm -f *~ \#* + rm -f cuda/*~ cuda/\#*
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example/Bulk/Makefile.gpu Fri May 02 19:30:48 2014 +0900 @@ -0,0 +1,41 @@ +include ./Makefile.def + +SRCS_TMP = $(wildcard *.cc) +SRCS_EXCLUDE = # 除外するファイルを書く +SRCS = $(filter-out $(SRCS_EXCLUDE),$(SRCS_TMP)) +OBJS = $(SRCS:.cc=.o) + +TASK_DIR = ppe +TASK_SRCS_TMP = $(wildcard $(TASK_DIR)/*.cc) +TASK_SRCS_EXCLUDE = +TASK_SRCS = $(filter-out $(TASK_DIR)/$(TASK_SRCS_EXCLUDE),$(TASK_SRCS_TMP)) +TASK_OBJS = $(TASK_SRCS:.cc=.o) + +#LIBS += -lFifoManager `sdl-config --libs` +CFLAGS += `sdl-config --cflags` `xml2-config --cflags` +LIBS += -lGpuManager +LIBS += `sdl-config --libs` `xml2-config --libs` -lSDL_image -Wl,-framework,OpenGL -framework opencl + +CC += -m$(ABIBIT) + +.SUFFIXES: .cc .o + +.cc.o: + $(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@ + +all: $(TARGET) + +$(TARGET): $(OBJS) $(TASK_OBJS) + $(CC) $(OPT) -o $@ $(OBJS) $(TASK_OBJS) $(LIBS) + +link: + $(CC) $(OPT) -o $(TARGET) $(OBJS) $(TASK_OBJS) $(LIBS) + +debug: $(TARGET) + sudo gdb ./$(TARGET) + +clean: + rm -f $(TARGET) $(OBJS) $(TASK_OBJS) + rm -f *~ \#* + rm -f ppe/*~ ppe/\#* + rm -f spe/*~ spe/\#*
--- a/example/Bulk/Makefile.macosx Fri May 02 16:41:31 2014 +0900 +++ b/example/Bulk/Makefile.macosx Fri May 02 19:30:48 2014 +0900 @@ -11,9 +11,9 @@ TASK_SRCS = $(filter-out $(TASK_DIR)/$(TASK_SRCS_EXCLUDE),$(TASK_SRCS_TMP)) TASK_OBJS = $(TASK_SRCS:.cc=.o) -#LIBS += -lFifoManager `sdl-config --libs` +LIBS += -lFifoManager CFLAGS += `sdl-config --cflags` `xml2-config --cflags` -LIBS += -lGpuManager +#LIBS += -lGpuManager LIBS += `sdl-config --libs` `xml2-config --libs` -lSDL_image -Wl,-framework,OpenGL -framework opencl CC += -m$(ABIBIT)