Mercurial > hg > Members > kono > Cerium
changeset 194:72dcf908ec52
fix
author | gongo@localhost.localdomain |
---|---|
date | Tue, 20 Jan 2009 14:50:41 +0900 |
parents | 102dad2949a0 |
children | 8143bbade40d |
files | TaskManager/Cell/SpeThreads.cc TaskManager/Cell/spe/SchedTask.cc TaskManager/Cell/spe/main.cc TaskManager/ChangeLog TaskManager/Fifo/FifoTaskManagerImpl.cc TaskManager/Makefile.def TaskManager/Test/test_render/Keyboard.cpp TaskManager/Test/test_render/spe/CreateSpan.cpp TaskManager/Test/test_render/spe/DrawSpan.cpp TaskManager/Test/test_render/spe/Load_Texture.cpp TaskManager/Test/test_render/viewer.cpp TaskManager/kernel/ppe/MailManager.cc TaskManager/kernel/ppe/TaskManager.cc TaskManager/kernel/schedule/SchedTask.cc include/TaskManager/CellScheduler.h include/TaskManager/SchedTask.h include/TaskManager/Scheduler.h include/TaskManager/TaskManager.h |
diffstat | 18 files changed, 136 insertions(+), 27 deletions(-) [+] |
line wrap: on
line diff
--- a/TaskManager/Cell/SpeThreads.cc Tue Jan 13 19:06:13 2009 +0900 +++ b/TaskManager/Cell/SpeThreads.cc Tue Jan 20 14:50:41 2009 +0900 @@ -43,19 +43,18 @@ status = ((stop_info.result.spe_exit_code & 0xff) << 8) | (stop_info.result.spe_signal_code & 0xff); - printf("[SPE %d] ", arg_t->speid); switch(stop_info.stop_reason) { case SPE_EXIT: - printf("SPE_EXIT stop_info.result.stop_exit_code=0x%x\n", stop_info.result.spe_exit_code); + //printf("SPE_EXIT stop_info.result.stop_exit_code=0x%x\n", stop_info.result.spe_exit_code); break; case SPE_STOP_AND_SIGNAL: - printf("SPE_STOP_AND_SIGNAL stop_info.result.stop_signal_code=%d\n", stop_info.result.spe_signal_code); + printf("[SPE %d] SPE_STOP_AND_SIGNAL stop_info.result.stop_signal_code=%d\n", arg_t->speid, stop_info.result.spe_signal_code); break; case SPE_RUNTIME_ERROR: - printf("SPE_RUNTIME_ERROR stop_info.result.spe_runtime_error=%d\n", stop_info.result.spe_runtime_error); + printf("[SPE %d] SPE_RUNTIME_ERROR stop_info.result.spe_runtime_error=%d\n", arg_t->speid, stop_info.result.spe_runtime_error); break; case SPE_RUNTIME_EXCEPTION: - printf("SPE_RUNTIME_EXCEPTION stop_info.result.spe_runtime_exception=%d\n", stop_info.result.spe_runtime_exception); + printf("[SPE %d] SPE_RUNTIME_EXCEPTION stop_info.result.spe_runtime_exception=%d\n", arg_t->speid, stop_info.result.spe_runtime_exception); break; } @@ -103,7 +102,6 @@ &frontend_thread_run, (void*)&args[i]); #else pthread_create(&threads[i], NULL, - //&spe_thread_run, (void*)spe_ctx[i]); &spe_thread_run, (void*)&args[i]); #endif }
--- a/TaskManager/Cell/spe/SchedTask.cc Tue Jan 13 19:06:13 2009 +0900 +++ b/TaskManager/Cell/spe/SchedTask.cc Tue Jan 20 14:50:41 2009 +0900 @@ -385,6 +385,12 @@ } } +int +SchedTask::get_cpuid(void) +{ + return __scheduler->id; +} + /** * task->add_inData で与えられた順番に対応する index (0〜n-1) で、 * buffer から対応するデータを返す。
--- a/TaskManager/Cell/spe/main.cc Tue Jan 13 19:06:13 2009 +0900 +++ b/TaskManager/Cell/spe/main.cc Tue Jan 20 14:50:41 2009 +0900 @@ -1,5 +1,6 @@ #include <stdio.h> #include "CellScheduler.h" +#include "spu_mfcio.h" #include "error.h" extern unsigned char _end[]; @@ -14,21 +15,21 @@ unsigned code_size = (unsigned)&_end; unsigned heap_size = ls_size - code_size; -#if 0 __debug(" ls_size:%10d bytes\n", ls_size); __debug("code_size:%10d bytes\n", code_size); __debug("heap_size:%10d bytes\n", heap_size); -#else - printf(" ls_size:%10d bytes\n", ls_size); - printf("code_size:%10d bytes\n", code_size); - printf("heap_size:%10d bytes\n", heap_size); -#endif manager = new CellScheduler(); manager->init(); manager->id = (int)argc; + spu_write_decrementer(0x7FFFFFFFU); + unsigned int prof = spu_read_decrementer(); manager->run(); + prof -= spu_read_decrementer(); + + printf("%f\n", prof/79800000.0f*1000.0f); + manager->finish(); return 0;
--- a/TaskManager/ChangeLog Tue Jan 13 19:06:13 2009 +0900 +++ b/TaskManager/ChangeLog Tue Jan 20 14:50:41 2009 +0900 @@ -1,3 +1,36 @@ +2009-01-20 Wataru MIYAGUNI <gongo@cr.ie.u-ryukyu.ac.jp> + + * Cell/spe/SchedTask.cc (SchedTask::get_cpuid): add + printf 井 CPU cャс + + PPE = 0 + SPE = 0spu_num-1; + + PPE 0 篁ュ医若SPE 茴 + -1 若c純絅純障 + + User Task с篁ヤ罕篏睡障 + + int cpuid = smanager->get_cpuid(); + + + * Cell/SpeThreads.cc (SpeThreads::spe_thread_run): fix + SPE_EXIT 冴罩e幻腟篋 + 若с<祉若吾荀障(篆冴荀障c) + 茵腓冴 + + * kernel/ppe/MailManager.cc (MailManager::destroy): fix + ♂若c for() c + TaskQueueInfo.cc с腟絮 while() 眼 + + * kernel/ppe/TaskManager.cc (TaskManager::~TaskManager): add + kernel/main.cc + + delete manager; + + TaskManagerImpl::~TaskManagerImpl 若喝冴 + c ~TaskManager <c祉 + 2009-01-05 Wataru MIYAGUNI <gongo@cr.ie.u-ryukyu.ac.jp> * all : fix
--- a/TaskManager/Fifo/FifoTaskManagerImpl.cc Tue Jan 13 19:06:13 2009 +0900 +++ b/TaskManager/Fifo/FifoTaskManagerImpl.cc Tue Jan 20 14:50:41 2009 +0900 @@ -26,6 +26,7 @@ scheduler = new MainScheduler(); scheduler->init(); scheduler->set_mailManager(mailManager); + scheduler->id = 0; bufferManager = new BufferManager; bufferManager->init();
--- a/TaskManager/Makefile.def Tue Jan 13 19:06:13 2009 +0900 +++ b/TaskManager/Makefile.def Tue Jan 20 14:50:41 2009 +0900 @@ -25,7 +25,7 @@ IMPL_CELL_OBJS = $(IMPL_CELL_SRCS:.cc=.o) CC = g++ -CFLAGS = -O0 -Wall `sdl-config --cflags` -g +CFLAGS = -O9 -Wall `sdl-config --cflags` -g LIBS = INCLUDE = -I../include/TaskManager \ No newline at end of file
--- a/TaskManager/Test/test_render/Keyboard.cpp Tue Jan 13 19:06:13 2009 +0900 +++ b/TaskManager/Test/test_render/Keyboard.cpp Tue Jan 20 14:50:41 2009 +0900 @@ -43,6 +43,7 @@ } if (keys[SDLK_a] == SDL_PRESSED) { + printf("ahsas\n"); square.push_work(); } else { square.release_work();
--- a/TaskManager/Test/test_render/spe/CreateSpan.cpp Tue Jan 13 19:06:13 2009 +0900 +++ b/TaskManager/Test/test_render/spe/CreateSpan.cpp Tue Jan 20 14:50:41 2009 +0900 @@ -168,6 +168,7 @@ } return (scale > scale_max) ? scale_max : scale; + //return scale_max; } /** @@ -384,7 +385,7 @@ (int)(span->tex_width*tex_x_len), (int)(span->tex_height*tex_y_len), tex_scale_max); - scale = (8 > tex_scale_max) ? tex_scale_max : 8; + //scale = (8 > tex_scale_max) ? tex_scale_max : 8; uint32 *tapestry = getTapestry(tex_width, tex_height, scale, tex_addr);
--- a/TaskManager/Test/test_render/spe/DrawSpan.cpp Tue Jan 13 19:06:13 2009 +0900 +++ b/TaskManager/Test/test_render/spe/DrawSpan.cpp Tue Jan 20 14:50:41 2009 +0900 @@ -1,6 +1,5 @@ #include <stdlib.h> #include <string.h> -#include <spu_mfcio.h> #include "DrawSpan.h" #include "polygon_pack.h" #include "texture.h" @@ -11,6 +10,12 @@ #define TEX_LOAD 1 #define FB_STORE 2 +//#define PROFILE + +#if defined(PROFILE) +# include <spu_mfcio.h> +#endif + SchedDefineTask(DrawSpan); DrawSpan::~DrawSpan(void) @@ -210,8 +215,6 @@ renew_task->add_param((int)linebuf); renew_task->add_param((int)zRow); - //fprintf(stderr, "[%p] start %u\n", curr, spu_readch(SPU_RdDec)); - /** * 莎桁帥鴻緇 */ @@ -234,6 +237,8 @@ doneWrite = 1; } +#define Prof(st,cur) (((st)-(cur))/79800000.0f * 1000.0f) + int DrawSpan::run(void *rbuf, void *wbuf) { @@ -261,6 +266,13 @@ doneWrite = 0; + int tileNum = 0; + int flag = 0; + +#if defined(PROFILE) + uint32 profile = spu_read_decrementer(); + printf("%d %u DrawSpan start\n", smanager->get_cpuid(), profile); +#endif do { /** * SpanPack->next 絖翫 @@ -313,6 +325,7 @@ continue; } + flag = 1; tex_xpos = (int)((span->tex_width-1) * tex1); tex_ypos = (int)((span->tex_height-1) * tey1); @@ -323,8 +336,17 @@ tex_localy = tex_ypos % TEXTURE_SPLIT_PIXEL; if (!isAvailableTile(tex_addr)) { +# if defined(PROFILE) + printf("%d %u start load tile\n", + smanager->get_cpuid(), spu_read_decrementer()); +# endif set_rgb(tex_addr); smanager->dma_wait(TEX_LOAD); +# if defined(PROFILE) + printf("%d %u end load tile\n", + smanager->get_cpuid(), spu_read_decrementer()); +# endif + tileNum++; } rgb = get_rgb(tex_localx, tex_localy, tex_addr); @@ -338,6 +360,7 @@ float tex_x, tex_y, tex_z; for (int j = js; j <= je; j++) { + flag = 1; localx = getLocalX(x-1+j); tex_z = z*(x_len-1-j)/(x_len-1) + zpos*j/(x_len-1); @@ -363,7 +386,7 @@ */ if (!isAvailableTile(tex_addr)) { spack->info.start = t; -#if 1 +#if 0 set_rgbs(tex_addr, getTile(span->tex_width-1, tex_ypos, span->tex_width, span->tex_addr)); @@ -371,13 +394,27 @@ reboot(spack, j); goto FINISH; #else + +# if defined(PROFILE) + printf("%d %u start load tile\n", + smanager->get_cpuid(), + spu_read_decrementer()); +# endif + set_rgb(tex_addr); smanager->dma_wait(TEX_LOAD); + tileNum++; + +# if defined(PROFILE) + printf("%d %u end load tile\n", + smanager->get_cpuid(), + spu_read_decrementer()); +# endif #endif } rgb = get_rgb(tex_localx, tex_localy, tex_addr); - + zRow[localx + (rangex*localy)] = tex_z; linebuf[localx + (rangex*localy)] = rgb; } @@ -405,6 +442,14 @@ * linebuf, zRow free() */ free(free_spack); + +#if defined(PROFILE) + printf("%d %u DrawSpan end\n", + smanager->get_cpuid(), spu_read_decrementer()); + if (flag) { + printf("%d %d tileNum\n", smanager->get_cpuid(), tileNum); + } +#endif return 0; }
--- a/TaskManager/Test/test_render/spe/Load_Texture.cpp Tue Jan 13 19:06:13 2009 +0900 +++ b/TaskManager/Test/test_render/spe/Load_Texture.cpp Tue Jan 20 14:50:41 2009 +0900 @@ -1,5 +1,4 @@ #include <stdlib.h> -#include <spu_mfcio.h> #include <string.h> #include "Load_Texture.h" #include "texture.h" @@ -27,7 +26,5 @@ = smanager->global_alloc(GLOBAL_TILE_LIST, sizeof(TileList)); TileListPtr tileList = new(tileList_tmp) TileList; - spu_writech(SPU_WrDec, 0x7FFFFFFFU); - return 0; }
--- a/TaskManager/Test/test_render/viewer.cpp Tue Jan 13 19:06:13 2009 +0900 +++ b/TaskManager/Test/test_render/viewer.cpp Tue Jan 20 14:50:41 2009 +0900 @@ -43,8 +43,8 @@ if (SDL_NumJoysticks()) { SDL_Joystick *joy = SDL_JoystickOpen(0); if (!joy) { - fprintf(stderr, "%s: failed to open joystick", __FUNCTION__); - fprintf(stderr, "Instead use Keyboard\n"); + printf("%s: failed to open joystick", __FUNCTION__); + printf("Instead use Keyboard\n"); return new Keyboard; } else { printf("Use Joystick\n");
--- a/TaskManager/kernel/ppe/MailManager.cc Tue Jan 13 19:06:13 2009 +0900 +++ b/TaskManager/kernel/ppe/MailManager.cc Tue Jan 20 14:50:41 2009 +0900 @@ -69,9 +69,18 @@ { MailQueuePtr q; +#if 0 for (q = mailQueuePool; q; q = q->next) { free(q); } +#else + q = mailQueuePool; + while (q) { + MailQueuePtr tmp = q->next; + free(q); + q = tmp; + } +#endif freeMailQueue = mailQueuePool = NULL; }
--- a/TaskManager/kernel/ppe/TaskManager.cc Tue Jan 13 19:06:13 2009 +0900 +++ b/TaskManager/kernel/ppe/TaskManager.cc Tue Jan 20 14:50:41 2009 +0900 @@ -2,6 +2,11 @@ TaskManager::TaskManager(int num) : machineNum(num) {} +TaskManager::~TaskManager(void) +{ + delete m_impl; +} + /** * create_impl(int); *
--- a/TaskManager/kernel/schedule/SchedTask.cc Tue Jan 13 19:06:13 2009 +0900 +++ b/TaskManager/kernel/schedule/SchedTask.cc Tue Jan 20 14:50:41 2009 +0900 @@ -193,7 +193,7 @@ { __debug("[SchedTask:%s]\n", __FUNCTION__); - //__scheduler->dma_wait(DMA_WRITE); + __scheduler->dma_wait(DMA_WRITE); free(__writebuf); /** @@ -385,6 +385,12 @@ } } +int +SchedTask::get_cpuid(void) +{ + return __scheduler->id; +} + /** * task->add_inData で与えられた順番に対応する index (0〜n-1) で、 * buffer から対応するデータを返す。
--- a/include/TaskManager/CellScheduler.h Tue Jan 13 19:06:13 2009 +0900 +++ b/include/TaskManager/CellScheduler.h Tue Jan 20 14:50:41 2009 +0900 @@ -13,8 +13,6 @@ public: BASE_NEW_DELETE(CellScheduler); - int id; - void init_impl(void); void *allocate(int size);
--- a/include/TaskManager/SchedTask.h Tue Jan 13 19:06:13 2009 +0900 +++ b/include/TaskManager/SchedTask.h Tue Jan 20 14:50:41 2009 +0900 @@ -114,6 +114,8 @@ //--- User API --- + int get_cpuid(void); + void* get_input(void *buff, int index); void* get_output(void *buff, int index); uint32 get_inputAddr(int index); @@ -149,6 +151,10 @@ SchedTask *outer; + int get_cpuid(void) { + return outer->get_cpuid(); + } + void* get_input(int index) { return outer->get_input(outer->__readbuf, index); }