Mercurial > hg > Members > kono > Cerium
changeset 244:59c3b9df3c67
mail modify
author | e065746@localhost.localdomain |
---|---|
date | Sun, 31 May 2009 20:08:42 +0900 |
parents | 52db409f255a |
children | 0b028a881f3b e19d2c9e85b0 1d8b8a4ac453 |
files | TaskManager/Cell/CellTaskManagerImpl.cc TaskManager/Cell/SpeThreads.cc TaskManager/Test/test_render/spe/CreatePolygon.cpp TaskManager/Test/test_render/spe/CreateSpan.cpp TaskManager/Test/test_render/viewer.cpp include/TaskManager/SpeThreads.h include/TaskManager/TaskList.h |
diffstat | 7 files changed, 76 insertions(+), 33 deletions(-) [+] |
line wrap: on
line diff
--- a/TaskManager/Cell/CellTaskManagerImpl.cc Sun May 31 16:26:20 2009 +0900 +++ b/TaskManager/Cell/CellTaskManagerImpl.cc Sun May 31 20:08:42 2009 +0900 @@ -180,14 +180,11 @@ ppeManager->mail_check(mail_list, &waitTaskQueue); do { - int data; - + unsigned int data; // SPE Scheduler からの mail check - for (int id = 0; id < machineNum; id++) { - while (1) { - data = speThreads->get_mail(id); - if (data < 0) break; + for (int id = 0; id < machineNum; id++) { + while (speThreads->check_mail(id, 1, &data)) { /** * MY_SPE_STATUS_READY: SPE が持ってた Task 全て終了 @@ -209,16 +206,24 @@ * info[0] = alloc_id; (CellScheduler::mainMem_alloc 参照) * info[1] = alloc_addr; */ - unsigned int alloc_info[2]; + unsigned int alloc_info[3]; int alloc_size; + int command; - // ださい - while ((alloc_info[0] = speThreads->get_mail(id)) < 0); - while ((alloc_size = speThreads->get_mail(id)) < 0); + speThreads->get_mail(id, 2, alloc_info); + command = alloc_info[0]; + allock_size = alloc_info[1]; + alloc_info[1] = (unsigned int)allocate(alloc_size); + /* + * allocate された領域は今の SPE buffer にリンクとして接続する + * ここでは TaskList を allocate(new) して登録してやろうか + */ - speThreads->send_mail(id, alloc_info, 2); + speThreads->add_output_tasklist(command, alloc_info[1], alloc_size); + + speThreads->send_mail(id, 2, alloc_info); } else if (data > MY_SPE_NOP) { __debug_ppe("[PPE] recv from [SPE %d] : 0x%x\n", id, data); check_task_finish((HTaskPtr)data); @@ -269,7 +274,7 @@ bufferManager->clear_taskList(speTaskList_bg[id]); - speThreads->send_mail(id, (unsigned int *)&speTaskList[id], 1); + speThreads->send_mail(id, 1, (unsigned int *)&speTaskList[id]); flag_sendTaskList[id] = 0; } @@ -280,7 +285,8 @@ void *buff; posix_memalign(&buff, DEFAULT_ALIGNMENT, size); - + + // bzero はコストが高いのでやりたくない bzero(buff, size); return buff;
--- a/TaskManager/Cell/SpeThreads.cc Sun May 31 16:26:20 2009 +0900 +++ b/TaskManager/Cell/SpeThreads.cc Sun May 31 20:08:42 2009 +0900 @@ -10,7 +10,7 @@ int ret; for (int i = 0; i < spe_num; i++) { - send_mail(i, &mail, 1); + send_mail(i, 1, &mail); } for (int i = 0; i < spe_num; i++) { @@ -107,6 +107,7 @@ } } + /** * SPE からのメールを受信する。 * @@ -116,12 +117,20 @@ * if ([ret] < 0) no data read */ int -SpeThreads::get_mail(int speid) +SpeThreads::get_mail(int speid, int count, unsigned int* ret) +{ + while(spe_out_mbox_status(spe_ctx[speid]) < count); + return spe_out_mbox_read(spe_ctx[speid], ret, count); +} + +int +SpeThreads::check_mail(int speid, int count, unsigned int* ret) { - unsigned int ret = (unsigned int)(-1); - - spe_out_mbox_read(spe_ctx[speid], &ret, 1); - return ret; + if (spe_out_mbox_status(spe_ctx[speid]) >= count) { + return spe_out_mbox_read(spe_ctx[speid], ret, count); + } else { + return 0; + } } /** @@ -139,8 +148,19 @@ * @param [num] The number of messages */ void -SpeThreads::send_mail(int speid, unsigned int *data, int num) +SpeThreads::send_mail(int speid, int num, unsigned int *data) +{ + spe_in_mbox_write(spe_ctx[speid], data, num, SPE_MBOX_ALL_BLOCKING); +} + +void +SpeThreads::add_output_tasklist(int command, void *buff, int alloc_size) { - while (spe_in_mbox_status(spe_ctx[speid]) < num); - spe_in_mbox_write(spe_ctx[speid], data, num, SPE_MBOX_ANY_NONBLOCKING); + /* + * output TaskList が無ければ新しく作る + * あれば TaskList に allocate した Task を追加 + * command に対応した Task の初期化を実行する + * SPE に data が書き出し終わった後に PPE 側で初期化 + */ + }
--- a/TaskManager/Test/test_render/spe/CreatePolygon.cpp Sun May 31 16:26:20 2009 +0900 +++ b/TaskManager/Test/test_render/spe/CreatePolygon.cpp Sun May 31 20:08:42 2009 +0900 @@ -85,11 +85,12 @@ if (pp->info.size >= MAX_SIZE_TRIANGLE) { PolygonPackPtr next; + // smanager Task 篏0 с PolygonPack->task_id smanager->mainMem_alloc(0, sizeof(PolygonPack)); smanager->mainMem_wait(); next = (PolygonPackPtr)smanager->mainMem_get(0); - pp->next = next; + pp->next = next; // TaskManager 眼с鴻 tmp_pp = pp; pp = send_pp; @@ -101,9 +102,11 @@ pp_addr = next; - smanager->dma_wait(PP_LOAD); + smanager->dma_wait(PP_LOAD); // 紊筝荀 smanager->dma_load(pp, (uint32)pp_addr, sizeof(PolygonPack), PP_LOAD); + // 罨< dma_wait 潟鴻蕭сゃゃ潟ч綽荀 + smanager->dma_wait(PP_LOAD); pp->init();
--- a/TaskManager/Test/test_render/spe/CreateSpan.cpp Sun May 31 16:26:20 2009 +0900 +++ b/TaskManager/Test/test_render/spe/CreateSpan.cpp Sun May 31 20:08:42 2009 +0900 @@ -1,6 +1,7 @@ #include "CreateSpan.h" #include "viewer_types.h" +// DMA channel static const int SPAN_PACK_LOAD = 5; static const int SPAN_PACK_STORE = 6; static const int POLYGON_PACK_LOAD = 7; @@ -294,7 +295,7 @@ smanager->mainMem_wait(); next = (SpanPackPtr)smanager->mainMem_get(0); - spack->next = next; + spack->next = next; // TaskManager с tmp_spack = spack; spack = send_spack; @@ -486,6 +487,7 @@ sizeof(SpanPack), SPAN_PACK_STORE); smanager->dma_wait(SPAN_PACK_STORE); + // smanager allocate free smanager с鴻 free(free_pp); free(free_spack); free(vMid10);
--- a/TaskManager/Test/test_render/viewer.cpp Sun May 31 16:26:20 2009 +0900 +++ b/TaskManager/Test/test_render/viewer.cpp Sun May 31 20:08:42 2009 +0900 @@ -177,7 +177,7 @@ } task_next = manager->create_task(TASK_DUMMY); - task_next->set_post(&post2runLoop, NULL); + #if 0 // 茫娯с篁 SceneGraphPack 篏 @@ -192,13 +192,17 @@ for (int i = 0; i < spe_num; i++) { task_tex = manager->create_task(TASK_INIT_TEXTURE); - /* 絨篏帥鴻鐚 */ + /* + * 絨篏帥鴻鐚 + */ task_tex->set_cpu((CPU_TYPE)((int)SPE_0 + i)); task_next->wait_for(task_tex); task_tex->spawn(); } - task_next->spawn(); + task_next->set_post(&post2runLoop, NULL); // set_post(function(this->run_loop()), NULL) + task_next->spawn(); + // TASK_INIT_TEXTURE 腟c DUMMY_TASK Viewer::run_loop() 若 } void @@ -224,7 +228,7 @@ } task_next = manager->create_task(TASK_DUMMY); - task_next->set_post(post2runDraw, NULL); + #if 0 // SceneGraphPack update @@ -292,7 +296,11 @@ } task_create_pp->spawn(); + + // Barrier + task_next->set_post(post2runDraw, NULL); // set_post(function(this->run_draw()), NULL) task_next->spawn(); + // TASK_CREATE_SPAN 腟c DUMMY_TASK Viewer::run_draw() 若 } void @@ -302,7 +310,6 @@ HTaskPtr task_draw; task_next = manager->create_task(TASK_DUMMY); - task_next->set_post(post2runLoop, NULL); ppack->clear(); for (int i = 0; i < spackList_length; i++) { @@ -361,7 +368,9 @@ } } + task_next->set_post(post2runLoop, NULL); // set_post(function(this->run_loop()), NULL) task_next->spawn(); + // TASK_DRAW_SPAN 腟c DUMMY_TASK Viewer::run_loop() 若 frames++; }
--- a/include/TaskManager/SpeThreads.h Sun May 31 16:26:20 2009 +0900 +++ b/include/TaskManager/SpeThreads.h Sun May 31 20:08:42 2009 +0900 @@ -19,10 +19,12 @@ /* functions */ void init(void); - int get_mail(int speid); - void send_mail(int speid, unsigned int *data, int num); + int get_mail(int speid, int count, unsigned int* ret); // BLOCKING + int check_mail(int speid, int count, unsigned int* ret); // NONBLOCK + void send_mail(int speid, int num, unsigned int *data); // BLOCKING static void *spe_thread_run(void *arg); static void *frontend_thread_run(void *arg); + void add_output_tasklist(int command, void *buff, int alloc_size); private: /* variables */
--- a/include/TaskManager/TaskList.h Sun May 31 16:26:20 2009 +0900 +++ b/include/TaskManager/TaskList.h Sun May 31 20:08:42 2009 +0900 @@ -19,7 +19,8 @@ int length; // 4 byte TaskList *next; // 4 byte Task tasks[TASK_MAX_SIZE]; // 512 - int a[2]; // padding + TaskList *output; // 4 byte + int a[1]; // padding static TaskList* append(TaskList*, TaskList*); };