annotate TaskManager/kernel/schedule/Scheduler.cc @ 1737:6bd9a57eb44d draft

minor fix
author Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
date Sat, 02 Nov 2013 17:34:40 +0900
parents 91b690b27066
children 94a824cde2e4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1142
801d57ae1e29 cut compile CreatePolygonTask on spe side because not enough spe memory. We have to use code loading.
yutaka@localhost.localdomain
parents: 1124
diff changeset
1 //#include <stdio.h>
50
7927e00fb8e2 *** empty log message ***
gongo
parents: 48
diff changeset
2 #include <stdlib.h>
736
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
3 #include <stdarg.h>
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
4 #include "Scheduler.h"
736
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
5 #include "SchedTask.h"
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
6 #include "SchedNop.h"
923
382a48afb061 fix DMA/Mail wait profiler
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 893
diff changeset
7 #include "SysFunc.h"
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
8 #include "error.h"
386
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
9 #include <assert.h>
621
64e05530e333 Cell fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 619
diff changeset
10 #include "TaskManagerImpl.h"
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
11
313
25dfa7499162 fix ppu mail box waiting (mainMem allocate)
kono@localhost.localdomain
parents: 301
diff changeset
12 /*
25dfa7499162 fix ppu mail box waiting (mainMem allocate)
kono@localhost.localdomain
parents: 301
diff changeset
13 * Edit kernel/schedule/xx.cc, Cell/spe/xx.cc will be over writen by this.
25dfa7499162 fix ppu mail box waiting (mainMem allocate)
kono@localhost.localdomain
parents: 301
diff changeset
14 * Do not edit Cell/spe/xx.cc unless there is no kernel/schedule/xx.cc files.
25dfa7499162 fix ppu mail box waiting (mainMem allocate)
kono@localhost.localdomain
parents: 301
diff changeset
15 */
25dfa7499162 fix ppu mail box waiting (mainMem allocate)
kono@localhost.localdomain
parents: 301
diff changeset
16
698
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 690
diff changeset
17 TaskObject task_list[MAX_TASK_OBJECT];
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
18
1147
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
19 #ifndef NOT_CHECK
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
20 int entry_cmd[MAX_TASK_OBJECT];
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
21 int task_count = 0;
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
22 #endif
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
23
501
7ddbe22d4cdb Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 483
diff changeset
24 Scheduler::~Scheduler()
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
25 {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
26 delete connector;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
27 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
28
1510
81f1afd1851f separate TaskObject and GpuTaskObject
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1480
diff changeset
29 int
664
beb0f17c19f9 word count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 635
diff changeset
30 null_run(SchedTask* smanager, void* r, void *w)
beb0f17c19f9 word count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 635
diff changeset
31 {
1464
3f2230d79eba TaskList no compile errors
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1421
diff changeset
32 smanager->printf("Calling Undefined Task %d\n", smanager->atask->command);
664
beb0f17c19f9 word count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 635
diff changeset
33 return 0;
beb0f17c19f9 word count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 635
diff changeset
34 }
beb0f17c19f9 word count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 635
diff changeset
35
1471
e8db2e2d426c fix not working yet.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1468
diff changeset
36 void null_loader(Scheduler *m, int task_id);
689
ecf63089f5bb Task Array generation worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 664
diff changeset
37
301
7f991471d43f remove deprecated source. not work.
tkaito@localhost.localdomain
parents: 298
diff changeset
38 /*! @brief speTaskの入出力のパイプラインバッファを確保する
7f991471d43f remove deprecated source. not work.
tkaito@localhost.localdomain
parents: 298
diff changeset
39 */
7f991471d43f remove deprecated source. not work.
tkaito@localhost.localdomain
parents: 298
diff changeset
40
1631
39a381fec1e7 cpu, gpu coexistence
shohei kokubo
parents: 1612
diff changeset
41 void
39a381fec1e7 cpu, gpu coexistence
shohei kokubo
parents: 1612
diff changeset
42 init_task_list(TaskObject* task_list) {
39a381fec1e7 cpu, gpu coexistence
shohei kokubo
parents: 1612
diff changeset
43 for (int i = 0; i< MAX_TASK_OBJECT; i++) {
39a381fec1e7 cpu, gpu coexistence
shohei kokubo
parents: 1612
diff changeset
44 task_list[i].run = null_run;
39a381fec1e7 cpu, gpu coexistence
shohei kokubo
parents: 1612
diff changeset
45 task_list[i].load = null_loader;
39a381fec1e7 cpu, gpu coexistence
shohei kokubo
parents: 1612
diff changeset
46 task_list[i].wait = null_loader;
39a381fec1e7 cpu, gpu coexistence
shohei kokubo
parents: 1612
diff changeset
47 task_list[i].gputask = new GpuTaskObject();
39a381fec1e7 cpu, gpu coexistence
shohei kokubo
parents: 1612
diff changeset
48
39a381fec1e7 cpu, gpu coexistence
shohei kokubo
parents: 1612
diff changeset
49 #ifndef NOT_CHECK
1637
a0014faececa fix conflict set cpu
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1631
diff changeset
50 entry_cmd[i] = NULL;
1631
39a381fec1e7 cpu, gpu coexistence
shohei kokubo
parents: 1612
diff changeset
51 #endif
39a381fec1e7 cpu, gpu coexistence
shohei kokubo
parents: 1612
diff changeset
52
39a381fec1e7 cpu, gpu coexistence
shohei kokubo
parents: 1612
diff changeset
53 }
39a381fec1e7 cpu, gpu coexistence
shohei kokubo
parents: 1612
diff changeset
54 }
39a381fec1e7 cpu, gpu coexistence
shohei kokubo
parents: 1612
diff changeset
55
1229
424c1f16e704 add args useRefDma
Daichi TOMA <e085740@ie.u-ryukyu.ac.jp>
parents: 1213
diff changeset
56 //useRefDmaは、0という初期値が設定されている。
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
57 void
1479
163220e54cc0 remove hard code for TaskLog
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1471
diff changeset
58 Scheduler::init(TaskManagerImpl *m, int useRefDma, int export_task_log)
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
59 {
388
3d1e86396d16 MemHash (OS X version)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 387
diff changeset
60 hash = 0;
664
beb0f17c19f9 word count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 635
diff changeset
61
1147
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
62 #ifndef NOT_CHECK
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
63 task_count = 0;
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
64 #endif
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
65
635
c56f6847fb87 SimpleTask worked on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 634
diff changeset
66 set_manager(m);
1229
424c1f16e704 add args useRefDma
Daichi TOMA <e085740@ie.u-ryukyu.ac.jp>
parents: 1213
diff changeset
67 init_impl(useRefDma);
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
68
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
69 for (int i = 0; i < 2; i++) {
800
54f0180cea0f run16 word count ( not yet worked. )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 792
diff changeset
70 buff_taskList[i] = (TaskListPtr)m->allocate(sizeof(TaskList));
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
71 }
373
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
72
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
73 buffFlag_taskList = 0;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
74
298
768452fab95e from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
75 // bzero でもいいけど
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
76 for (int i = 0; i < MAX_GLOBAL_AREA; i++) {
373
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
77 globalList[i] = NULL;
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
78 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
79
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
80 for (int i = 0; i < MAX_MAINMEM_AREA; i++) {
631
30dd8a3deb4a Cell 64 bit tried, but not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 625
diff changeset
81 mainMemList[i] = (memaddr)NULL;
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
82 }
373
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
83
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
84 }
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
85
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
86 void
690
107e6e77f482 Bulk task on going.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 689
diff changeset
87 Scheduler::run(SchedTaskBase* task1)
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
88 {
690
107e6e77f482 Bulk task on going.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 689
diff changeset
89
107e6e77f482 Bulk task on going.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 689
diff changeset
90 // Pipeline Stage
107e6e77f482 Bulk task on going.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 689
diff changeset
91 SchedTaskBase* task2 = new SchedNop();
107e6e77f482 Bulk task on going.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 689
diff changeset
92 SchedTaskBase* task3 = new SchedNop();
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
93 // main loop
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
94 do {
1510
81f1afd1851f separate TaskObject and GpuTaskObject
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1480
diff changeset
95
1448
3ee29c1733d1 separate function for GpuTest
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1421
diff changeset
96 task1->read();
3ee29c1733d1 separate function for GpuTest
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1421
diff changeset
97 task2->exec();
3ee29c1733d1 separate function for GpuTest
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1421
diff changeset
98 task3->write();
1510
81f1afd1851f separate TaskObject and GpuTaskObject
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1480
diff changeset
99
81f1afd1851f separate TaskObject and GpuTaskObject
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1480
diff changeset
100 delete task3;
81f1afd1851f separate TaskObject and GpuTaskObject
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1480
diff changeset
101
373
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
102 task3 = task2;
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
103 task2 = task1;
1448
3ee29c1733d1 separate function for GpuTest
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1421
diff changeset
104 //SchedMailの場合、Mailの待ちが入る
3ee29c1733d1 separate function for GpuTest
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1421
diff changeset
105 task1 = task1->next(this, 0);
1510
81f1afd1851f separate TaskObject and GpuTaskObject
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1480
diff changeset
106
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
107 } while (task1);
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
108
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
109 delete task3;
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
110 delete task2;
50
7927e00fb8e2 *** empty log message ***
gongo
parents: 48
diff changeset
111 }
48
70a0ac46133e *** empty log message ***
gongo
parents: 42
diff changeset
112
50
7927e00fb8e2 *** empty log message ***
gongo
parents: 48
diff changeset
113
7927e00fb8e2 *** empty log message ***
gongo
parents: 48
diff changeset
114 void
501
7ddbe22d4cdb Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 483
diff changeset
115 Scheduler::finish()
50
7927e00fb8e2 *** empty log message ***
gongo
parents: 48
diff changeset
116 {
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
117 free(buff_taskList[0]);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
118 free(buff_taskList[1]);
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
119 }
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
120
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
121 /**
298
768452fab95e from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
122 * あらかじめ memory allocte してある TaskList の領域を
768452fab95e from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
123 * パイプラインの各処理が交代して使う。
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
124 */
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
125 TaskListPtr
501
7ddbe22d4cdb Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 483
diff changeset
126 Scheduler::get_curListBuf()
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
127 {
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
128 buffFlag_taskList ^= 1;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
129
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
130 return buff_taskList[buffFlag_taskList];
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
131 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
132
871
d30617ef4b20 fix get segment dma tag zero problem
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 804
diff changeset
133
386
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
134 /*
1585
90c0ad32655f init dim
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1511
diff changeset
135 ここから下は、memory 以下にあるべき
90c0ad32655f init dim
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1511
diff changeset
136 */
386
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
137
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
138 void*
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
139 Scheduler::global_alloc(int id, int size)
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
140 {
792
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 786
diff changeset
141
800
54f0180cea0f run16 word count ( not yet worked. )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 792
diff changeset
142 globalList[id] = manager->allocate(size);
792
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 786
diff changeset
143
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
144 return globalList[id];
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
145 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
146
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
147 void*
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
148 Scheduler::global_get(int id)
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
149 {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
150 return globalList[id];
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
151 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
152
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
153 void
373
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
154 Scheduler::global_set(int id, void *addr)
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
155 {
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
156 globalList[id] = addr;
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
157 }
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
158
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
159 void
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
160 Scheduler::global_free(int id)
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
161 {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
162 free(globalList[id]);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
163 globalList[id] = NULL;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
164 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
165
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
166 /**
298
768452fab95e from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
167 * mainMem_alloc で確保したメインメモリの領域アドレスを返す。
768452fab95e from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
168 * これは Fifo, Cell で共通
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
169 */
631
30dd8a3deb4a Cell 64 bit tried, but not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 625
diff changeset
170 memaddr
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
171 Scheduler::mainMem_get(int id)
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
172 {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
173 return mainMemList[id];
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
174 }
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
175
1510
81f1afd1851f separate TaskObject and GpuTaskObject
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1480
diff changeset
176 /**
423
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
177 * Task load API
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
178 */
425
cebb48da955e add code load API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 423
diff changeset
179 void
872
d7b0c0f8514c add overlay segment
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 871
diff changeset
180 Scheduler::allocate_code_segment(int size, int count, struct tbl *table)
425
cebb48da955e add code load API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 423
diff changeset
181 {
437
e924d6cca813 overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 425
diff changeset
182 // 既に overlay 領域があるので、それを追加する必要がある...
442
6c63423a7dea hoge... size/count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 441
diff changeset
183 code_segment_pool = createMemList(size, count);
872
d7b0c0f8514c add overlay segment
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 871
diff changeset
184 if (table) {
d7b0c0f8514c add overlay segment
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 871
diff changeset
185 MemorySegment* here = (MemorySegment*)(
1585
90c0ad32655f init dim
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1511
diff changeset
186 manager->allocate(sizeof(MemorySegment)));
1737
6bd9a57eb44d minor fix
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 1733
diff changeset
187 here->data = &(table->vma);
872
d7b0c0f8514c add overlay segment
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 871
diff changeset
188 here->size = size;
1510
81f1afd1851f separate TaskObject and GpuTaskObject
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1480
diff changeset
189 here->address = (memaddr)here;
81f1afd1851f separate TaskObject and GpuTaskObject
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1480
diff changeset
190 code_segment_pool->addLast(here);
872
d7b0c0f8514c add overlay segment
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 871
diff changeset
191 }
425
cebb48da955e add code load API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 423
diff changeset
192 }
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
193
423
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
194 static void
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
195 load_task(Scheduler *m, int task_id)
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
196 {
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
197 MemorySegment *s = m->get_segment(
1585
90c0ad32655f init dim
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1511
diff changeset
198 task_list[task_id].location,
90c0ad32655f init dim
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1511
diff changeset
199 m->code_segment_pool,
90c0ad32655f init dim
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1511
diff changeset
200 task_list[task_id].end-task_list[task_id].location);
423
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
201 task_list[task_id].segment = s;
871
d30617ef4b20 fix get segment dma tag zero problem
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 804
diff changeset
202 // calcurate call address
1510
81f1afd1851f separate TaskObject and GpuTaskObject
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1480
diff changeset
203 TaskObjectRun run =
871
d30617ef4b20 fix get segment dma tag zero problem
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 804
diff changeset
204 (TaskObjectRun)(
1585
90c0ad32655f init dim
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1511
diff changeset
205 (char*)task_list[task_id].segment->data +
90c0ad32655f init dim
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1511
diff changeset
206 task_list[task_id].entry_offset);
871
d30617ef4b20 fix get segment dma tag zero problem
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 804
diff changeset
207 task_list[task_id].run = run;
874
188e8bc16aca new hash function
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 873
diff changeset
208 #if 0
873
c50f39fbb6ca fix hash problem ( unsigned int-> long overflow )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 872
diff changeset
209 m->printf("loadng task id %d at 0x%x entry 0x%x location 0x%x\n",task_id,
1585
90c0ad32655f init dim
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1511
diff changeset
210 (unsigned int)(task_list[task_id].segment->data ),
90c0ad32655f init dim
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1511
diff changeset
211 (unsigned int)(
90c0ad32655f init dim
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1511
diff changeset
212 (char*)task_list[task_id].segment->data +
90c0ad32655f init dim
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1511
diff changeset
213 task_list[task_id].entry_offset),
90c0ad32655f init dim
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1511
diff changeset
214 task_list[task_id].location);
538
5641d121818e code_load in read()
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 501
diff changeset
215 #endif
423
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
216 }
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
217
1471
e8db2e2d426c fix not working yet.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1468
diff changeset
218 void
423
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
219 null_loader(Scheduler *m, int task_id)
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
220 {
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
221 }
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
222
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
223 static void
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
224 wait_load(Scheduler *m, int task_id)
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
225 {
555
c5e09e9bbfa5 half finish for Cell
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 538
diff changeset
226 #if 0
442
6c63423a7dea hoge... size/count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 441
diff changeset
227 MemorySegment *s = task_list[task_id].segment;
6c63423a7dea hoge... size/count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 441
diff changeset
228 if (s)
1510
81f1afd1851f separate TaskObject and GpuTaskObject
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1480
diff changeset
229 m->printf("wait load task id %d 0x%x\n",task_id,(int)s->data);
442
6c63423a7dea hoge... size/count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 441
diff changeset
230 else
1510
81f1afd1851f separate TaskObject and GpuTaskObject
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1480
diff changeset
231 m->printf("wait load task id %d 000000\n",task_id);
538
5641d121818e code_load in read()
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 501
diff changeset
232 #endif
423
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
233 // wait for code segment load
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
234 m->wait_segment(task_list[task_id].segment);
538
5641d121818e code_load in read()
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 501
diff changeset
235 #if 0
736
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
236 m->printf("wait load task id %d done. creator = 0x%x entry_offset = 0x%x\n",task_id,
1585
90c0ad32655f init dim
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1511
diff changeset
237 (unsigned int)(task_list[task_id].run),
90c0ad32655f init dim
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1511
diff changeset
238 task_list[task_id].entry_offset);
538
5641d121818e code_load in read()
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 501
diff changeset
239 #endif
423
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
240 }
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
241
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
242 static void
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
243 null_waiter(Scheduler *m, int task_id)
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
244 {
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
245 }
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
246
1510
81f1afd1851f separate TaskObject and GpuTaskObject
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1480
diff changeset
247 extern void
1058
d3cb29f1eccb create task_name_list array in Scheduler.h
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 1024
diff changeset
248 register_task(int cmd, TaskObjectRun run, const char *str)
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
249 {
464
0d64bdb63005 task run is mere C function now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 461
diff changeset
250 task_list[cmd].run = run;
423
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
251 task_list[cmd].load = null_loader;
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
252 task_list[cmd].wait = null_waiter;
1147
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
253 task_list[cmd].name = str;
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
254
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
255 #ifndef NOT_CHECK
1510
81f1afd1851f separate TaskObject and GpuTaskObject
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1480
diff changeset
256 entry_cmd[task_count++] = cmd;
1147
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
257 #endif
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
258
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
259 }
373
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
260
1510
81f1afd1851f separate TaskObject and GpuTaskObject
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1480
diff changeset
261 extern void
81f1afd1851f separate TaskObject and GpuTaskObject
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1480
diff changeset
262 register_dynamic_task(int cmd,
1585
90c0ad32655f init dim
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1511
diff changeset
263 memaddr start, int size,
90c0ad32655f init dim
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1511
diff changeset
264 TaskObjectRun run, int entry_offset,
90c0ad32655f init dim
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1511
diff changeset
265 const char *str)
423
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
266 {
464
0d64bdb63005 task run is mere C function now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 461
diff changeset
267 task_list[cmd].run = run;
423
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
268 task_list[cmd].location = start;
442
6c63423a7dea hoge... size/count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 441
diff changeset
269 size &= 0xfffffffe;
441
54c49df8dcda slightly worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 439
diff changeset
270 task_list[cmd].end = start+size;
423
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
271 task_list[cmd].entry_offset = entry_offset;
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
272 task_list[cmd].load = load_task;
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
273 task_list[cmd].wait = wait_load;
1147
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
274 task_list[cmd].name = str;
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
275
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
276 #ifndef NOT_CHECK
1510
81f1afd1851f separate TaskObject and GpuTaskObject
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1480
diff changeset
277 entry_cmd[task_count++] = cmd;
1147
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
278 #endif
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
279
538
5641d121818e code_load in read()
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 501
diff changeset
280 #if 0
1585
90c0ad32655f init dim
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1511
diff changeset
281 this->printf("cmd = %d\n",cmd);
90c0ad32655f init dim
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1511
diff changeset
282 this->printf("locatation = 0x%x\n",start);
90c0ad32655f init dim
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1511
diff changeset
283 this->printf("end = 0x%x\n",start+size);
90c0ad32655f init dim
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1511
diff changeset
284 this->printf("size = 0x%x\n",size);
90c0ad32655f init dim
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1511
diff changeset
285 this->printf("entry = 0x%x\n",entry_offset);
538
5641d121818e code_load in read()
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 501
diff changeset
286 #endif
439
13c6740ab15f still overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 437
diff changeset
287
423
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
288 }
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
289
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
290
373
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
291 /*!
386
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
292
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
293 size 単位のMemory Segment を count 個作る
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
294
373
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
295 @param [size] リストの要素1つのサイズ
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
296 @param [count] 要素数
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
297 @return allocate した領域のポインタ
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
298
1585
90c0ad32655f init dim
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1511
diff changeset
299 */
373
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
300 MemList*
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
301 Scheduler::createMemList(int size, int count)
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
302 {
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
303 uint32 head_size = round_up16(sizeof(MemorySegment));
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
304 uint32 seg_size = round_up16(head_size+size);
800
54f0180cea0f run16 word count ( not yet worked. )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 792
diff changeset
305 char* mseg = (char*)manager->allocate(seg_size*count);
373
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
306 MemList* mlist = new MemList((MemorySegment*)mseg);
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
307
388
3d1e86396d16 MemHash (OS X version)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 387
diff changeset
308 if (!hash) {
1510
81f1afd1851f separate TaskObject and GpuTaskObject
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1480
diff changeset
309 hash = new MemHash();
388
3d1e86396d16 MemHash (OS X version)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 387
diff changeset
310 }
3d1e86396d16 MemHash (OS X version)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 387
diff changeset
311
373
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
312 for(int i = 0; i < count; i++) {
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
313 MemorySegment* next = (MemorySegment*)(mseg+seg_size*i);
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
314 char* data = (char*)next+head_size;
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
315 next->data = (void*)data;
386
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
316 next->size = size;
1510
81f1afd1851f separate TaskObject and GpuTaskObject
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1480
diff changeset
317 next->address = (memaddr)next;
373
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
318 mlist->addLast(next);
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
319 }
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
320
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
321 return mlist;
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
322 }
386
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
323
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
324 /*!
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
325
1585
90c0ad32655f init dim
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1511
diff changeset
326 Main Memory のSegmentを取得する
386
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
327
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
328 @param [addr] Main Memory のアドレス
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
329 @param [m] Mem List
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
330 @return allocate した領域のポインタ
1585
90c0ad32655f init dim
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1511
diff changeset
331 memory directory にあるべきだが...
386
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
332
1585
90c0ad32655f init dim
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1511
diff changeset
333 */
1510
81f1afd1851f separate TaskObject and GpuTaskObject
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1480
diff changeset
334 MemorySegment *
81f1afd1851f separate TaskObject and GpuTaskObject
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1480
diff changeset
335 Scheduler::get_segment(memaddr addr, MemList *m)
386
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
336 {
1154
yutaka@charles.cr.ie.u-ryukyu.ac.jp
parents: 1152
diff changeset
337 #ifdef USE_CACHE
yutaka@charles.cr.ie.u-ryukyu.ac.jp
parents: 1152
diff changeset
338
449
0bed2a9889f5 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 442
diff changeset
339 MemorySegment *s = m->getFirst();
1510
81f1afd1851f separate TaskObject and GpuTaskObject
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1480
diff changeset
340 return get_segment(addr, m, s->size);
1154
yutaka@charles.cr.ie.u-ryukyu.ac.jp
parents: 1152
diff changeset
341
yutaka@charles.cr.ie.u-ryukyu.ac.jp
parents: 1152
diff changeset
342 #else
yutaka@charles.cr.ie.u-ryukyu.ac.jp
parents: 1152
diff changeset
343
1161
cc1a50cac83d use MemorySegment API for pp load. do not check execution of the cell side. to be continued..
Yutaka_Kinjyo
parents: 1156
diff changeset
344 //addr が空だった場合はどうなるか
1162
8917aff8629c global allocate
Yutaka_Kinjyo
parents: 1161
diff changeset
345 //こうすると単純にFIFOか
1420
e8debff40a3d comment
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1417
diff changeset
346 // そうじゃなくて、単にbufferを余計に取って毎回DMAしているだけだよね。
1161
cc1a50cac83d use MemorySegment API for pp load. do not check execution of the cell side. to be continued..
Yutaka_Kinjyo
parents: 1156
diff changeset
347
cc1a50cac83d use MemorySegment API for pp load. do not check execution of the cell side. to be continued..
Yutaka_Kinjyo
parents: 1156
diff changeset
348 MemorySegment *s = m->getLast();
cc1a50cac83d use MemorySegment API for pp load. do not check execution of the cell side. to be continued..
Yutaka_Kinjyo
parents: 1156
diff changeset
349 m->moveToFirst(s);
1213
a49c02dffe6f DMA connector reogranization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1175
diff changeset
350 s->tag = connector->get_tag();
1163
b417abf82193 use Segment API for spackload
Yutaka_Kinjyo
parents: 1162
diff changeset
351 s->address = addr;
1417
70f461442b0f null DMA clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1362
diff changeset
352 s->data = connector->dma_load1(s->data, addr, s->size, s->tag);
1154
yutaka@charles.cr.ie.u-ryukyu.ac.jp
parents: 1152
diff changeset
353
yutaka@charles.cr.ie.u-ryukyu.ac.jp
parents: 1152
diff changeset
354 return s;
yutaka@charles.cr.ie.u-ryukyu.ac.jp
parents: 1152
diff changeset
355
yutaka@charles.cr.ie.u-ryukyu.ac.jp
parents: 1152
diff changeset
356 #endif
yutaka@charles.cr.ie.u-ryukyu.ac.jp
parents: 1152
diff changeset
357
437
e924d6cca813 overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 425
diff changeset
358 }
e924d6cca813 overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 425
diff changeset
359
1173
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
360 /*!
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
361
1585
90c0ad32655f init dim
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1511
diff changeset
362 free な Segmentを取得する(SPEのLSから)
90c0ad32655f init dim
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1511
diff changeset
363 書き込み専用の場合、dma_loadは必要ないので
90c0ad32655f init dim
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1511
diff changeset
364 こういう感じになるのかな.
1173
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
365
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
366 @param [addr] Main Memory のアドレス
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
367 @param [m] Mem List
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
368 @return allocate した領域のポインタ
1585
90c0ad32655f init dim
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1511
diff changeset
369 memory directory にあるべきだが...
1173
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
370
1585
90c0ad32655f init dim
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1511
diff changeset
371 */
1173
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
372
1510
81f1afd1851f separate TaskObject and GpuTaskObject
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1480
diff changeset
373 MemorySegment *
81f1afd1851f separate TaskObject and GpuTaskObject
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1480
diff changeset
374 Scheduler::get_free_segment(memaddr addr, MemList *m)
1173
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
375 {
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
376
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
377
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
378 if(addr == NULL) {
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
379 return NULL;
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
380 }
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
381
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
382 MemorySegment *s = m->getLast();
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
383 m->moveToFirst(s);
1213
a49c02dffe6f DMA connector reogranization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1175
diff changeset
384 s->tag = connector->get_tag();
1173
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
385 s->address = addr;
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
386
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
387 return s;
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
388
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
389 }
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
390
1175
d7486d6a5e37 minor change
Yutaka_Kinjyo
parents: 1173
diff changeset
391 /*!
d7486d6a5e37 minor change
Yutaka_Kinjyo
parents: 1173
diff changeset
392
d7486d6a5e37 minor change
Yutaka_Kinjyo
parents: 1173
diff changeset
393 指定した MemorySegment を上書きする
d7486d6a5e37 minor change
Yutaka_Kinjyo
parents: 1173
diff changeset
394
d7486d6a5e37 minor change
Yutaka_Kinjyo
parents: 1173
diff changeset
395 @param [s] 上書きするMemorySegment
d7486d6a5e37 minor change
Yutaka_Kinjyo
parents: 1173
diff changeset
396 @param [addr] 上書きするdataへのアドレス
d7486d6a5e37 minor change
Yutaka_Kinjyo
parents: 1173
diff changeset
397
1585
90c0ad32655f init dim
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1511
diff changeset
398 */
1175
d7486d6a5e37 minor change
Yutaka_Kinjyo
parents: 1173
diff changeset
399
d7486d6a5e37 minor change
Yutaka_Kinjyo
parents: 1173
diff changeset
400 void
1510
81f1afd1851f separate TaskObject and GpuTaskObject
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1480
diff changeset
401 Scheduler::overwrite_segment(MemorySegment *s, memaddr addr)
1175
d7486d6a5e37 minor change
Yutaka_Kinjyo
parents: 1173
diff changeset
402 {
d7486d6a5e37 minor change
Yutaka_Kinjyo
parents: 1173
diff changeset
403
d7486d6a5e37 minor change
Yutaka_Kinjyo
parents: 1173
diff changeset
404 if(addr == NULL) {
d7486d6a5e37 minor change
Yutaka_Kinjyo
parents: 1173
diff changeset
405 return;
d7486d6a5e37 minor change
Yutaka_Kinjyo
parents: 1173
diff changeset
406 }
d7486d6a5e37 minor change
Yutaka_Kinjyo
parents: 1173
diff changeset
407
d7486d6a5e37 minor change
Yutaka_Kinjyo
parents: 1173
diff changeset
408 s->address = addr;
1417
70f461442b0f null DMA clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1362
diff changeset
409 s->data = connector->dma_load1(s->data, addr, s->size, s->tag);
1175
d7486d6a5e37 minor change
Yutaka_Kinjyo
parents: 1173
diff changeset
410
d7486d6a5e37 minor change
Yutaka_Kinjyo
parents: 1173
diff changeset
411 }
d7486d6a5e37 minor change
Yutaka_Kinjyo
parents: 1173
diff changeset
412
1173
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
413
1585
90c0ad32655f init dim
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1511
diff changeset
414 int
90c0ad32655f init dim
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1511
diff changeset
415 Scheduler::max_cpu()
90c0ad32655f init dim
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1511
diff changeset
416 { // todo
1612
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 1611
diff changeset
417 return maxcpu-1;
1585
90c0ad32655f init dim
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1511
diff changeset
418 }
90c0ad32655f init dim
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1511
diff changeset
419
90c0ad32655f init dim
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1511
diff changeset
420 int
90c0ad32655f init dim
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1511
diff changeset
421 Scheduler::min_cpu()
90c0ad32655f init dim
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1511
diff changeset
422 { // todo
1611
6c8f9791262e fix min_cpu and max_cpu
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 1588
diff changeset
423 return mincpu;
1585
90c0ad32655f init dim
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1511
diff changeset
424 }
90c0ad32655f init dim
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1511
diff changeset
425
1510
81f1afd1851f separate TaskObject and GpuTaskObject
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1480
diff changeset
426 MemorySegment *
81f1afd1851f separate TaskObject and GpuTaskObject
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1480
diff changeset
427 Scheduler::get_segment(memaddr addr, MemList *m, int size)
437
e924d6cca813 overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 425
diff changeset
428 {
1124
c43f49400c22 add mail profile
yutaka@localhost.localdomain
parents: 1123
diff changeset
429
437
e924d6cca813 overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 425
diff changeset
430 // memory segment のsizeをoverride する場合がある
386
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
431 MemorySegment *s = hash->get(addr);
1123
2a63ba2c9506 bug fix.
yutaka@localhost.localdomain
parents: 1121
diff changeset
432
386
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
433 if (s) {
1124
c43f49400c22 add mail profile
yutaka@localhost.localdomain
parents: 1123
diff changeset
434
1510
81f1afd1851f separate TaskObject and GpuTaskObject
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1480
diff changeset
435 /* 既に load されている */
1585
90c0ad32655f init dim
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1511
diff changeset
436 // this->printf("get_segement loaded %llx 0x%x size 0x%d\n",addr,s->data,size);
1510
81f1afd1851f separate TaskObject and GpuTaskObject
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1480
diff changeset
437 m->moveToFirst(s);
81f1afd1851f separate TaskObject and GpuTaskObject
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1480
diff changeset
438 return s;
386
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
439 }
1154
yutaka@charles.cr.ie.u-ryukyu.ac.jp
parents: 1152
diff changeset
440
1121
d6725e0a7b3e get_segment test.
tkaito@henri
parents: 1062
diff changeset
441
1510
81f1afd1851f separate TaskObject and GpuTaskObject
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1480
diff changeset
442 /* LRU なので、もっとも使われてない segment を上書きする */
386
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
443 s = m->getLast();
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
444 m->moveToFirst(s);
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
445
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
446 memaddr old_addr = s->address;
1213
a49c02dffe6f DMA connector reogranization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1175
diff changeset
447 s->tag = connector->get_tag();
1417
70f461442b0f null DMA clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1362
diff changeset
448 s->data = connector->dma_load1(s->data, addr, size, s->tag);
386
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
449 /* 前のをhashから削除 */
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
450 hash->remove(old_addr);
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
451 /* 新しいaddress を登録 */
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
452 s->address = addr;
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
453 hash->put(s->address, s);
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
454
1585
90c0ad32655f init dim
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1511
diff changeset
455 // this->printf("get_segement %llx 0x%x size 0x%d\n",addr, s->data,size);
439
13c6740ab15f still overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 437
diff changeset
456
386
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
457 return s;
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
458 }
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
459
423
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
460
1173
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
461
386
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
462 /*!
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
463
1585
90c0ad32655f init dim
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1511
diff changeset
464 Main Memory のSegmentを書き出す
90c0ad32655f init dim
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1511
diff changeset
465 Segment は get_segement されていて、
90c0ad32655f init dim
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1511
diff changeset
466 追い出されていてはいけない。
90c0ad32655f init dim
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1511
diff changeset
467 それを保証するのは難しい?
386
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
468
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
469 @param [addr] Main Memory のアドレス
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
470 @param [m] Mem List
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
471 @return allocate した領域のポインタ
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
472
1585
90c0ad32655f init dim
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1511
diff changeset
473 */
386
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
474 void
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
475 Scheduler::put_segment(MemorySegment *s)
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
476 {
1163
b417abf82193 use Segment API for spackload
Yutaka_Kinjyo
parents: 1162
diff changeset
477
b417abf82193 use Segment API for spackload
Yutaka_Kinjyo
parents: 1162
diff changeset
478 if (s == NULL) return;
1213
a49c02dffe6f DMA connector reogranization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1175
diff changeset
479 s->tag = connector->get_tag();
a49c02dffe6f DMA connector reogranization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1175
diff changeset
480 connector->dma_store(s->data, s->address, s->size, s->tag);
386
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
481 }
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
482
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
483 /*!
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
484
1585
90c0ad32655f init dim
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1511
diff changeset
485 Main Memory のSegmentを読込、書き出しを待つ
386
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
486
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
487 @param [id] MemorySegment のid
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
488
1585
90c0ad32655f init dim
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1511
diff changeset
489 */
386
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
490 void
387
b6fce69839b5 no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 386
diff changeset
491 Scheduler::wait_segment(MemorySegment *s)
386
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
492 {
1163
b417abf82193 use Segment API for spackload
Yutaka_Kinjyo
parents: 1162
diff changeset
493 if (s == NULL) return;
1213
a49c02dffe6f DMA connector reogranization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1175
diff changeset
494 if (s->tag) connector->dma_wait(s->tag);
391
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 388
diff changeset
495 s->tag = 0;
386
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
496 }
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
497
1510
81f1afd1851f separate TaskObject and GpuTaskObject
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1480
diff changeset
498 long Scheduler::get_random() {
621
64e05530e333 Cell fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 619
diff changeset
499 #if defined(__SPU__)
1510
81f1afd1851f separate TaskObject and GpuTaskObject
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1480
diff changeset
500 return 0;
621
64e05530e333 Cell fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 619
diff changeset
501 #else
1510
81f1afd1851f separate TaskObject and GpuTaskObject
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1480
diff changeset
502 return random();
621
64e05530e333 Cell fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 619
diff changeset
503 #endif
64e05530e333 Cell fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 619
diff changeset
504
64e05530e333 Cell fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 619
diff changeset
505 }
64e05530e333 Cell fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 619
diff changeset
506
1510
81f1afd1851f separate TaskObject and GpuTaskObject
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1480
diff changeset
507 int
736
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
508 Scheduler::printf(const char * format, ...)
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
509 {
786
043c98537bc5 fix early free of TaskArray, add SchedTaskArrayNop stage.
yutaka@localhost.localdomain
parents: 743
diff changeset
510 #if !defined(__SPU__) || 1
736
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
511 va_list ap;
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
512 va_start(ap,format);
743
55ccf5f6d9af continue..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 736
diff changeset
513 int ret= vprintf0(format, ap);
736
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
514 va_end(ap);
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
515 return ret;
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
516 #else
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
517 return 0;
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
518 #endif
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
519 }
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
520
1510
81f1afd1851f separate TaskObject and GpuTaskObject
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1480
diff changeset
521 int
743
55ccf5f6d9af continue..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 736
diff changeset
522 Scheduler::vprintf0(const char * format, va_list ap)
736
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
523 {
786
043c98537bc5 fix early free of TaskArray, add SchedTaskArrayNop stage.
yutaka@localhost.localdomain
parents: 743
diff changeset
524 #if !defined(__SPU__) || 1
736
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
525 int ret= vprintf(format, ap);
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
526 return ret;
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
527 #else
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
528 return 0;
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
529 #endif
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
530 }
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
531
386
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
532 /* end */