Mercurial > hg > Members > kono > Cerium
annotate TaskManager/Cell/CellTaskManagerImpl.cc @ 720:dac59b74e02a
Cell fix
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 19 Dec 2009 10:43:19 +0900 |
parents | cafffff0f45a |
children | 2b167196cb27 |
rev | line source |
---|---|
321 | 1 #define DEBUG |
2 #include "error.h" | |
57 | 3 #include <stdio.h> |
4 #include <stdlib.h> | |
5 #include <string.h> | |
6 #include "CellTaskManagerImpl.h" | |
476
926d6aff886c
CellBufferManager removed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
380
diff
changeset
|
7 #include "CellTaskListInfo.h" |
501
4a2c9ff53605
Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
496
diff
changeset
|
8 #include "HTaskInfo.h" |
621 | 9 #include "SchedTask.h" |
635
8cc609285bbe
SimpleTask worked on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
629
diff
changeset
|
10 #include "MainScheduler.h" |
57 | 11 #include "types.h" |
672 | 12 #include "SysFunc.h" |
13 | |
720 | 14 static void send_alloc_reply(CellTaskManagerImpl *tm, int id, SpeThreads *speThreads); |
57 | 15 |
501
4a2c9ff53605
Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
496
diff
changeset
|
16 CellTaskManagerImpl::~CellTaskManagerImpl() |
67 | 17 { |
109 | 18 delete speThreads; |
19 delete [] speTaskList; | |
20 delete [] speTaskList_bg; | |
21 /** | |
321 | 22 * bufferManager は |
23 * ppeManager のなかで delete してもらう | |
109 | 24 */ |
25 // delete bufferManager; | |
26 delete [] flag_sendTaskList; | |
27 | |
28 delete ppeManager; | |
67 | 29 } |
30 | |
57 | 31 void |
501
4a2c9ff53605
Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
496
diff
changeset
|
32 CellTaskManagerImpl::init() |
57 | 33 { |
637 | 34 spe_running = 0; |
476
926d6aff886c
CellBufferManager removed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
380
diff
changeset
|
35 taskListImpl = new CellTaskListInfo; |
664 | 36 taskListImpl->init(16); |
476
926d6aff886c
CellBufferManager removed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
380
diff
changeset
|
37 |
501
4a2c9ff53605
Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
496
diff
changeset
|
38 activeTaskQueue = new HTaskInfo(); |
481
4896dffad67c
Double linked list modification done (tested on Mac OS X)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
479
diff
changeset
|
39 |
501
4a2c9ff53605
Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
496
diff
changeset
|
40 htaskImpl = activeTaskQueue ; // any HTaskInfo |
65 | 41 |
42 speThreads = new SpeThreads(machineNum); | |
43 speThreads->init(); | |
109 | 44 |
45 speTaskList = new TaskListPtr[machineNum]; | |
46 speTaskList_bg = new TaskListPtr[machineNum]; | |
476
926d6aff886c
CellBufferManager removed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
380
diff
changeset
|
47 |
109 | 48 for (int i = 0; i < machineNum; i++) { |
476
926d6aff886c
CellBufferManager removed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
380
diff
changeset
|
49 speTaskList[i] = taskListImpl->create(); |
926d6aff886c
CellBufferManager removed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
380
diff
changeset
|
50 speTaskList_bg[i] = taskListImpl->create(); |
109 | 51 } |
52 | |
53 flag_sendTaskList = new int[machineNum]; | |
54 for (int i = 0; i < machineNum; i++) { | |
55 flag_sendTaskList[i] = 1; | |
476
926d6aff886c
CellBufferManager removed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
380
diff
changeset
|
56 } |
321 | 57 // PPE 側の管理をする Manager |
109 | 58 ppeManager = new FifoTaskManagerImpl(machineNum); |
479
5bda98b0b56d
Double Linked List base TaskQueue
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
476
diff
changeset
|
59 // 大半のTaskQueueInfoは、共有される |
637 | 60 MainScheduler *mscheduler = new MainScheduler; |
61 ppeManager->init(mscheduler, this); | |
619 | 62 |
63 ppeManager->get_scheduler()->set_manager(this); | |
637 | 64 |
619 | 65 schedTaskManager = new SchedTask(); |
66 schedTaskManager->init(0,0,0,ppeManager->get_scheduler()); | |
57 | 67 } |
68 | |
109 | 69 void |
501
4a2c9ff53605
Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
496
diff
changeset
|
70 CellTaskManagerImpl::append_activeTask(HTaskPtr task) |
109 | 71 { |
72 if (task->cpu_type == CPU_PPE) { | |
501
4a2c9ff53605
Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
496
diff
changeset
|
73 ppeManager->append_activeTask(task); |
109 | 74 } else { |
501
4a2c9ff53605
Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
496
diff
changeset
|
75 activeTaskQueue->addLast(task); |
109 | 76 } |
77 } | |
78 | |
321 | 79 // SPE_ANY が指定されていた時に |
80 // これをインクリメントしつつ呼ぶことにする。 | |
81 // 乱数使ってもいいけどさ。 | |
109 | 82 int cur_anySpeid = 0; |
83 | |
84 /** | |
321 | 85 * ActiveTaskQueue から Task を |
86 * 各 SPE に渡す TaskList に入れる | |
109 | 87 * |
321 | 88 * ここの activeTaskQueue は FifoTaskManagerImpl のと意味が違い、 |
89 * spe に渡される Task だけ入っている | |
109 | 90 */ |
91 void | |
501
4a2c9ff53605
Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
496
diff
changeset
|
92 CellTaskManagerImpl::set_runTaskList() |
70 | 93 { |
94 TaskListPtr list; | |
704
6d497c098455
Compatibility mode works.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
672
diff
changeset
|
95 SimpleTaskPtr task; |
109 | 96 int speid; |
70 | 97 |
501
4a2c9ff53605
Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
496
diff
changeset
|
98 while (HTaskPtr htask = activeTaskQueue->poll()) { |
70 | 99 |
109 | 100 if (htask->cpu_type == SPE_ANY) { |
101 speid = cur_anySpeid++; | |
102 cur_anySpeid = (cur_anySpeid < machineNum) | |
103 ? cur_anySpeid : 0; | |
70 | 104 } else { |
321 | 105 // -1 してるのは |
106 // htask->cpu_type - CPU_SPE で | |
107 // SPE0 = 1, SPE1 = 2, ... SPE5 = 6 ってなってるので | |
108 // 配列的 (SPE0 = arr[0], SPE1 = arr[1]) にするため | |
109 | 109 speid = htask->cpu_type - CPU_SPE - 1; |
110 | |
321 | 111 // SPU の数以上が指定されていれば |
112 // とりあえず MAX_USE_SPE_NUM (実際に動く SPE の最大数) で | |
113 // あまり求めてそれを使うことにする。 | |
114 // ここで判定するもんでもないか? | |
109 | 115 if (speid >= machineNum) { |
116 speid %= machineNum; | |
117 } | |
70 | 118 } |
109 | 119 |
120 list = speTaskList_bg[speid]; | |
121 | |
122 if (list->length >= TASK_MAX_SIZE) { | |
476
926d6aff886c
CellBufferManager removed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
380
diff
changeset
|
123 TaskListPtr newList = taskListImpl->create(); |
109 | 124 newList = TaskListInfo::append(newList, speTaskList_bg[speid]); |
125 speTaskList_bg[speid] = newList; | |
126 list = newList; | |
127 } | |
128 | |
129 task = &list->tasks[list->length++]; | |
713
f725c6455d19
remove SIMPLE_TASK conditional
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
704
diff
changeset
|
130 |
704
6d497c098455
Compatibility mode works.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
672
diff
changeset
|
131 if (htask->command==TaskArray1) { |
6d497c098455
Compatibility mode works.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
672
diff
changeset
|
132 // compatibility |
6d497c098455
Compatibility mode works.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
672
diff
changeset
|
133 // Task with ListData is stored in the ListData |
6d497c098455
Compatibility mode works.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
672
diff
changeset
|
134 int next = (htask->r_size+sizeof(SimpleTask))/sizeof(SimpleTask); |
6d497c098455
Compatibility mode works.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
672
diff
changeset
|
135 if (list->length+next>=TASK_MAX_SIZE) { |
6d497c098455
Compatibility mode works.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
672
diff
changeset
|
136 list->length--; |
6d497c098455
Compatibility mode works.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
672
diff
changeset
|
137 TaskListPtr newList = taskListImpl->create(); |
6d497c098455
Compatibility mode works.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
672
diff
changeset
|
138 newList = TaskListInfo::append(newList, speTaskList_bg[speid]); |
6d497c098455
Compatibility mode works.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
672
diff
changeset
|
139 speTaskList_bg[speid] = newList; |
6d497c098455
Compatibility mode works.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
672
diff
changeset
|
140 list = newList; |
6d497c098455
Compatibility mode works.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
672
diff
changeset
|
141 task = &list->tasks[list->length++]; |
6d497c098455
Compatibility mode works.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
672
diff
changeset
|
142 } |
6d497c098455
Compatibility mode works.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
672
diff
changeset
|
143 Task *array = (Task*)&list->tasks[list->length]; |
6d497c098455
Compatibility mode works.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
672
diff
changeset
|
144 list->length += next; |
6d497c098455
Compatibility mode works.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
672
diff
changeset
|
145 memcpy(array, htask->rbuf, htask->r_size); |
6d497c098455
Compatibility mode works.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
672
diff
changeset
|
146 free(htask->rbuf); |
6d497c098455
Compatibility mode works.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
672
diff
changeset
|
147 htask->rbuf = 0; htask->r_size = 0; |
6d497c098455
Compatibility mode works.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
672
diff
changeset
|
148 *task = *(SimpleTask*)htask; |
6d497c098455
Compatibility mode works.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
672
diff
changeset
|
149 } else { |
6d497c098455
Compatibility mode works.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
672
diff
changeset
|
150 *task = *(SimpleTask*)htask; |
6d497c098455
Compatibility mode works.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
672
diff
changeset
|
151 } |
6d497c098455
Compatibility mode works.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
672
diff
changeset
|
152 |
70 | 153 } |
109 | 154 } |
155 | |
156 void | |
501
4a2c9ff53605
Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
496
diff
changeset
|
157 CellTaskManagerImpl::run() |
109 | 158 { |
159 TaskListPtr ppeTaskList = NULL; | |
70 | 160 |
109 | 161 do { |
719
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
162 // PPE side |
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
163 ppeTaskList = ppeManager->get_runTaskList(); |
647
7c9ded1ea750
MailManager rewrite. not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
640
diff
changeset
|
164 ppeManager->schedule(ppeTaskList); |
720 | 165 ppeManager->mail_check(); |
719
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
166 // SPE side |
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
167 do { |
720 | 168 mail_check(); |
719
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
169 // SPE に送る TaskList の準備 |
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
170 set_runTaskList(); |
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
171 // TaskList 待ちの SPE に TaskList を送る |
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
172 for (int i = 0; i < machineNum; i++) { |
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
173 if (flag_sendTaskList[i] == 1 && speTaskList_bg[i]->length >= 1 ) { |
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
174 send_taskList(i); |
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
175 spe_running++; |
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
176 } |
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
177 } |
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
178 } while (ppeManager->activeTaskQueue->empty() && !waitTaskQueue->empty()); |
637 | 179 } while (ppeTaskList || spe_running >0); |
70 | 180 } |
181 | |
65 | 182 /** |
321 | 183 * SPE からのメールをチェックする |
640
a909c50081c2
SimpeTask on Cell worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
638
diff
changeset
|
184 */ |
a909c50081c2
SimpeTask on Cell worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
638
diff
changeset
|
185 |
719
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
186 void |
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
187 CellTaskManagerImpl::mail_check() |
57 | 188 { |
719
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
189 memaddr data; |
109 | 190 |
719
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
191 // SPE Scheduler からの mail check |
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
192 for (int id = 0; id < machineNum; id++) { |
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
193 while (speThreads->has_mail(id, 1, &data)) { |
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
194 if (data == (memaddr)MY_SPE_STATUS_READY) { |
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
195 // MY_SPE_STATUS_READY: SPE が持ってた Task 全て終了 |
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
196 flag_sendTaskList[id] = 1; |
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
197 spe_running--; |
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
198 } else if (data == (memaddr)MY_SPE_COMMAND_MALLOC) { |
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
199 // MY_SPE_COMMAND_MALLOC SPE からのmain memory request |
720 | 200 send_alloc_reply(this, id, speThreads); |
719
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
201 } else if (data > (memaddr)MY_SPE_NOP) { |
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
202 // 終了したタスク(PPEにあるのでアドレス) |
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
203 HTaskPtr task = (HTaskPtr)data; |
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
204 task->post_func(schedTaskManager, task->post_arg1, task->post_arg2); |
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
205 check_task_finish(task,waitTaskQueue); |
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
206 } |
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
207 // MY_SPE_NOP: 特に意味のないコマンド |
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
208 } |
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
209 } |
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
210 } |
109 | 211 |
719
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
212 static void |
720 | 213 send_alloc_reply(CellTaskManagerImpl *tm, int id, SpeThreads *speThreads) |
719
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
214 { |
273 | 215 |
719
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
216 /** |
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
217 * info[0] = alloc_id; (CellScheduler::mainMem_alloc 参照) |
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
218 * info[1] = alloc_addr; |
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
219 */ |
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
220 memaddr alloc_info[2]; |
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
221 long alloc_size; |
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
222 long command; |
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
223 |
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
224 speThreads->get_mail(id, 2, alloc_info); |
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
225 command = (long)alloc_info[0]; |
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
226 alloc_size = (long)alloc_info[1]; |
109 | 227 |
719
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
228 |
720 | 229 alloc_info[1] = (memaddr)tm->allocate(alloc_size); |
719
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
230 //__debug_ppe("[PPE] MALLOCED 0x%lx from [SPE %d]\n", alloc_info[1],id); |
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
231 // 今のところ何もしてない。どうも、この allocate を free |
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
232 // するのは、SPE task が返した値を見て行うらしい。それは、 |
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
233 // 忘れやすいのではないか? |
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
234 speThreads->add_output_tasklist(command, alloc_info[1], alloc_size); |
109 | 235 |
719
cafffff0f45a
clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
718
diff
changeset
|
236 speThreads->send_mail(id, 2, alloc_info); |
109 | 237 } |
66 | 238 |
109 | 239 /** |
321 | 240 * 条件を満たしたら SPE に TaskList を送信する |
241 * 条件1. SPE が持ってた TaskList を終了して、次の TaskList を待ってる | |
242 * 条件2. SPE に送る TaskList に Task がある | |
109 | 243 * |
321 | 244 * SPE で実行終了した TaskList [speTaskList] と |
245 * これから実行する TaskList [speTaskList_bg] のバッファを入れ替える | |
246 * ついでに実行終了したやつは clear しておく。 | |
109 | 247 */ |
248 void | |
249 CellTaskManagerImpl::send_taskList(int id) | |
250 { | |
251 TaskListPtr tmp; | |
252 | |
253 tmp = speTaskList[id]; | |
254 speTaskList[id] = speTaskList_bg[id]; | |
255 speTaskList_bg[id] = tmp; | |
256 | |
476
926d6aff886c
CellBufferManager removed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
380
diff
changeset
|
257 taskListImpl->clear_taskList(speTaskList_bg[id]); |
109 | 258 |
629
8843edf37c0e
Cell 64 bit tried, but not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
621
diff
changeset
|
259 speThreads->send_mail(id, 1, (memaddr *)&speTaskList[id]); |
109 | 260 flag_sendTaskList[id] = 0; |
57 | 261 } |
262 | |
672 | 263 void CellTaskManagerImpl::show_profile() { |
264 for (int id = 0; id < machineNum; id++) { | |
265 HTaskPtr t = create_task(ShowTime); | |
266 t->set_cpu((CPU_TYPE)(id+2)); | |
267 t->spawn(); | |
268 } | |
269 } | |
270 | |
271 void CellTaskManagerImpl::start_profile() { | |
272 for (int id = 0; id < machineNum; id++) { | |
273 HTaskPtr t = create_task(StartProfile); | |
274 t->set_cpu((CPU_TYPE)(id+2)); | |
275 t->spawn(); | |
276 } | |
277 } | |
278 | |
380 | 279 |
109 | 280 #ifdef __CERIUM_CELL__ |
57 | 281 TaskManagerImpl* |
282 create_impl(int num) | |
283 { | |
67 | 284 return new CellTaskManagerImpl(num); |
57 | 285 } |
109 | 286 #endif // __CERIUM_CELL |