annotate TaskManager/ChangeLog @ 1479:163220e54cc0 draft

remove hard code for TaskLog
author Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
date Tue, 24 Jul 2012 17:15:15 +0900
parents eee4f68409dd
children 622a7d053537
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1473
8ecdbe8fde1f comments
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1472
diff changeset
1 2012-7-15 Shinji KONO <kono@ie.u-ryukyu.ac.jp>
8ecdbe8fde1f comments
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1472
diff changeset
2
8ecdbe8fde1f comments
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1472
diff changeset
3 GpuTaskManager は明らかに不要。FifoManager は CellTaskManager の簡易版に過ぎない。
8ecdbe8fde1f comments
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1472
diff changeset
4 CellTaskManager にも Cell 依存性はないはず。(DMA/Mail にしか依存しない) なので、
8ecdbe8fde1f comments
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1472
diff changeset
5 CellTaskManager => TaskManager で一つにすることが可能。
8ecdbe8fde1f comments
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1472
diff changeset
6
8ecdbe8fde1f comments
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1472
diff changeset
7 そもそも -cpu 0 で fifo にするようにしたのだった。
8ecdbe8fde1f comments
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1472
diff changeset
8
8ecdbe8fde1f comments
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1472
diff changeset
9 SpeTaskManager が必要なのは、SchedTask のAPIのため。ってことは、SpeTaskManager は Impl を継承してはいけない。
8ecdbe8fde1f comments
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1472
diff changeset
10 TaskManager には interface だけ定義されるべき。
8ecdbe8fde1f comments
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1472
diff changeset
11
1475
eee4f68409dd bound default malloc
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1473
diff changeset
12 inListData とかは DMA しないなら不要なんだよな。切れるようにするべきか?
eee4f68409dd bound default malloc
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1473
diff changeset
13
1473
8ecdbe8fde1f comments
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1472
diff changeset
14 2012-7-15 Shinji KONO <kono@ie.u-ryukyu.ac.jp>
1465
fc5b23108608 TaskList on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1427
diff changeset
15
fc5b23108608 TaskList on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1427
diff changeset
16 inData をmallocしないで、小さいものは SchedTask に入れておく方が良い。
fc5b23108608 TaskList on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1427
diff changeset
17 HTask には TaskList が必ず付くようになったので、create_task した時に、dependency と
fc5b23108608 TaskList on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1427
diff changeset
18 CPU が同一なら、そのTaskList を再利用して良い。そのためには、それらを最初に定義した
fc5b23108608 TaskList on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1427
diff changeset
19 方が良い。
fc5b23108608 TaskList on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1427
diff changeset
20
1472
0c5a0a734e55 comment
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1465
diff changeset
21 これだと、GPU は一つだけだし、GPU にすると、Many Core 側が動かないと思うんだけど。
0c5a0a734e55 comment
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1465
diff changeset
22 まぁ、そうだよな。
0c5a0a734e55 comment
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1465
diff changeset
23
1473
8ecdbe8fde1f comments
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1472
diff changeset
24 いろいろ消したので、不要なものが多い。切れない TaskLog とか -DNOT_CHECK とか。
8ecdbe8fde1f comments
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1472
diff changeset
25
8ecdbe8fde1f comments
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1472
diff changeset
26 そもそも、GpuScheduler::run が呼ばれてないらしい。
8ecdbe8fde1f comments
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1472
diff changeset
27
8ecdbe8fde1f comments
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1472
diff changeset
28 2012-3-16 Shinji KONO <kono@ie.u-ryukyu.ac.jp>
1427
db5c022d871c task array uses TaskList. (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1426
diff changeset
29
db5c022d871c task array uses TaskList. (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1426
diff changeset
30 create_taskを sub task でやると、tasklist のallocate にlockがいる。
db5c022d871c task array uses TaskList. (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1426
diff changeset
31 SchedTask->task_create でschedulr毎に tasklist を持たせてやるとlockは不要になる。
db5c022d871c task array uses TaskList. (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1426
diff changeset
32 task create は GPU/SPU 側では作成しないはず。しても良いが。TaskList を作って書きだせば良い。
db5c022d871c task array uses TaskList. (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1426
diff changeset
33 それは、まぁ、先のことにして。
db5c022d871c task array uses TaskList. (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1426
diff changeset
34
1426
1bf286e37ba3 add ChangeLog
Daichi TOMA
parents: 1402
diff changeset
35 2012-3-11 Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
1bf286e37ba3 add ChangeLog
Daichi TOMA
parents: 1402
diff changeset
36
1bf286e37ba3 add ChangeLog
Daichi TOMA
parents: 1402
diff changeset
37 create_task_array を、rbuf上にtaskarrayを構築している。
1bf286e37ba3 add ChangeLog
Daichi TOMA
parents: 1402
diff changeset
38 TaskList上に直接構成する。
1bf286e37ba3 add ChangeLog
Daichi TOMA
parents: 1402
diff changeset
39 next_task_arrayで、任意のTaskを選択できるようにする。
1bf286e37ba3 add ChangeLog
Daichi TOMA
parents: 1402
diff changeset
40
1bf286e37ba3 add ChangeLog
Daichi TOMA
parents: 1402
diff changeset
41 setTaskListで、作成したTaskListを直接TaskListQueueに挿入する。
1bf286e37ba3 add ChangeLog
Daichi TOMA
parents: 1402
diff changeset
42 これを、TaskArray1として実行する。
1bf286e37ba3 add ChangeLog
Daichi TOMA
parents: 1402
diff changeset
43 これでコピーがなくなる。
1bf286e37ba3 add ChangeLog
Daichi TOMA
parents: 1402
diff changeset
44
1bf286e37ba3 add ChangeLog
Daichi TOMA
parents: 1402
diff changeset
45 SimpleTaskと、TaskArray1のみになる。
1bf286e37ba3 add ChangeLog
Daichi TOMA
parents: 1402
diff changeset
46 TaskListの大きさが可変になるので、ポインタタグで大きさを示す。
1bf286e37ba3 add ChangeLog
Daichi TOMA
parents: 1402
diff changeset
47
1bf286e37ba3 add ChangeLog
Daichi TOMA
parents: 1402
diff changeset
48 TaskListをロードするパイプラインを1段足す。
1bf286e37ba3 add ChangeLog
Daichi TOMA
parents: 1402
diff changeset
49
1402
815dd5f2d150 Add ChangeLog
sugi
parents: 1165
diff changeset
50 2012-2-15 Shinji KONO <kono@ie.u-ryukyu.ac.jp>
815dd5f2d150 Add ChangeLog
sugi
parents: 1165
diff changeset
51
815dd5f2d150 Add ChangeLog
sugi
parents: 1165
diff changeset
52 create_taskを可変長にして、それをそのままspu側に転送する
815dd5f2d150 Add ChangeLog
sugi
parents: 1165
diff changeset
53 task_listの大きさは現在固定。このままだと無駄な転送が増える。
815dd5f2d150 Add ChangeLog
sugi
parents: 1165
diff changeset
54 task_listのアドレスを送る際に、下位3bitがあいているのでこれを大きさに使う。
815dd5f2d150 Add ChangeLog
sugi
parents: 1165
diff changeset
55
815dd5f2d150 Add ChangeLog
sugi
parents: 1165
diff changeset
56 可変長にするが、ScedTask::nextでcur_indexを使っているがこれをnext()とlast()
815dd5f2d150 Add ChangeLog
sugi
parents: 1165
diff changeset
57 に置き換える。これでTask_array1とTask_arrayを消すことができる。
815dd5f2d150 Add ChangeLog
sugi
parents: 1165
diff changeset
58
815dd5f2d150 Add ChangeLog
sugi
parents: 1165
diff changeset
59 create_taskがTask_listに直接書き込んでいく。wait_forはcreate_taskのみにかかる。
815dd5f2d150 Add ChangeLog
sugi
parents: 1165
diff changeset
60 next()で、Task_arrayを追加するAPIにする。
815dd5f2d150 Add ChangeLog
sugi
parents: 1165
diff changeset
61
815dd5f2d150 Add ChangeLog
sugi
parents: 1165
diff changeset
62 TaskManagerImpl::set_taskList()でactive_task_queueからtask_listにcopyしている。
815dd5f2d150 Add ChangeLog
sugi
parents: 1165
diff changeset
63 ここで、copyしないでcreate_taskで作成したlistをそのまま使う。
815dd5f2d150 Add ChangeLog
sugi
parents: 1165
diff changeset
64
1165
ab8ed4d1d211 get_matrix_scale
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1146
diff changeset
65 2011-5-21 Shinji KONO <kono@ie.u-ryukyu.ac.jp>
ab8ed4d1d211 get_matrix_scale
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1146
diff changeset
66
ab8ed4d1d211 get_matrix_scale
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1146
diff changeset
67 spu 上の bound で、ListElement を書き換えるようにすると、
ab8ed4d1d211 get_matrix_scale
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1146
diff changeset
68 ListElement を64bitにできる。
ab8ed4d1d211 get_matrix_scale
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1146
diff changeset
69
ab8ed4d1d211 get_matrix_scale
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1146
diff changeset
70 あとは mail の返値を EA を使って 64bit addressにすれば、Cell でも64bit で
ab8ed4d1d211 get_matrix_scale
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1146
diff changeset
71 動くようになるか。
ab8ed4d1d211 get_matrix_scale
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1146
diff changeset
72
ab8ed4d1d211 get_matrix_scale
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1146
diff changeset
73
ab8ed4d1d211 get_matrix_scale
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1146
diff changeset
74 2011-2-22 Yutaka Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp>
1146
1fd472cd1ee9 ChangeLog
yutaka@localhost.localdomain
parents: 1123
diff changeset
75
1fd472cd1ee9 ChangeLog
yutaka@localhost.localdomain
parents: 1123
diff changeset
76 SPE使った場合、光源が変なバグ直したん。
1fd472cd1ee9 ChangeLog
yutaka@localhost.localdomain
parents: 1123
diff changeset
77 task/CreateSpanでは normal はしっかり扱っていたが spe/CreateSpanは、そのコードがなかった。反映ミスかな。
1fd472cd1ee9 ChangeLog
yutaka@localhost.localdomain
parents: 1123
diff changeset
78 % cp task/CreateSpan spe/CreateSpan で解決。
1fd472cd1ee9 ChangeLog
yutaka@localhost.localdomain
parents: 1123
diff changeset
79
1fd472cd1ee9 ChangeLog
yutaka@localhost.localdomain
parents: 1123
diff changeset
80 SPEのTaskがPPEで実行されるようになっていたから、発現しなかったのかも。
1fd472cd1ee9 ChangeLog
yutaka@localhost.localdomain
parents: 1123
diff changeset
81 PPE で動いた Task がSPEで動こない場合は
1fd472cd1ee9 ChangeLog
yutaka@localhost.localdomain
parents: 1123
diff changeset
82
1fd472cd1ee9 ChangeLog
yutaka@localhost.localdomain
parents: 1123
diff changeset
83 ・コードが違う
1fd472cd1ee9 ChangeLog
yutaka@localhost.localdomain
parents: 1123
diff changeset
84 ・データ構造が合わせきれていない(アラインメント、16バイトの倍数)
1fd472cd1ee9 ChangeLog
yutaka@localhost.localdomain
parents: 1123
diff changeset
85 ・Taskの wait ができていない
1fd472cd1ee9 ChangeLog
yutaka@localhost.localdomain
parents: 1123
diff changeset
86
1fd472cd1ee9 ChangeLog
yutaka@localhost.localdomain
parents: 1123
diff changeset
87 とか挙げられる。「同じコードのはず」という先入観あると手こずるのかも。
1fd472cd1ee9 ChangeLog
yutaka@localhost.localdomain
parents: 1123
diff changeset
88 spe と ppe の Task を diff とるスクリプト書けばいいかな。
1fd472cd1ee9 ChangeLog
yutaka@localhost.localdomain
parents: 1123
diff changeset
89 あとは、どのTaskがどこで実行されているかは確認できた方がいい。debugモードに入れるべきかな。
1fd472cd1ee9 ChangeLog
yutaka@localhost.localdomain
parents: 1123
diff changeset
90
1fd472cd1ee9 ChangeLog
yutaka@localhost.localdomain
parents: 1123
diff changeset
91 データ構造のチェックも、if文でチェックしてやればできるはず。
1fd472cd1ee9 ChangeLog
yutaka@localhost.localdomain
parents: 1123
diff changeset
92 Task の wait のチェックは、ガントチャートを表示してやるとわかるはず。
1fd472cd1ee9 ChangeLog
yutaka@localhost.localdomain
parents: 1123
diff changeset
93
1fd472cd1ee9 ChangeLog
yutaka@localhost.localdomain
parents: 1123
diff changeset
94 でも実はまだ、gaplant が Cell/光源ON では表示されない。が上のチェックを入れたら、もしかしたら、分かるかも知れない。
1fd472cd1ee9 ChangeLog
yutaka@localhost.localdomain
parents: 1123
diff changeset
95
1fd472cd1ee9 ChangeLog
yutaka@localhost.localdomain
parents: 1123
diff changeset
96 ------------------------------------------------------------------------------------------------------------------
1fd472cd1ee9 ChangeLog
yutaka@localhost.localdomain
parents: 1123
diff changeset
97
1fd472cd1ee9 ChangeLog
yutaka@localhost.localdomain
parents: 1123
diff changeset
98 あと、CreatePolygonFromSceneGraph をSPEで動くようにしたせいか、FPSが落ちました(ありゃりゃ。)。
1fd472cd1ee9 ChangeLog
yutaka@localhost.localdomain
parents: 1123
diff changeset
99 SPEに持っていくために、メモリアロケートを多様しているせいかも。
1fd472cd1ee9 ChangeLog
yutaka@localhost.localdomain
parents: 1123
diff changeset
100 そこは、DataSegment いれて、メモリ管理してやれば、解消されるのかな。
1fd472cd1ee9 ChangeLog
yutaka@localhost.localdomain
parents: 1123
diff changeset
101 ちなみに、CreatePolygon はSPEで動かすと、メモリ足りないそうで、SPE側のコンパイルは切って、PPEで動いてます。(ありゃりゃ)
1fd472cd1ee9 ChangeLog
yutaka@localhost.localdomain
parents: 1123
diff changeset
102
1fd472cd1ee9 ChangeLog
yutaka@localhost.localdomain
parents: 1123
diff changeset
103
1fd472cd1ee9 ChangeLog
yutaka@localhost.localdomain
parents: 1123
diff changeset
104 ball_bound 25 〜 30 FPS
1fd472cd1ee9 ChangeLog
yutaka@localhost.localdomain
parents: 1123
diff changeset
105
1fd472cd1ee9 ChangeLog
yutaka@localhost.localdomain
parents: 1123
diff changeset
106 だいぶ、落ちたな。ball_bound だけは、CP を SPE で動かしても、動くんだけど、FPSは同じ。
1fd472cd1ee9 ChangeLog
yutaka@localhost.localdomain
parents: 1123
diff changeset
107 きゃー。パイプライン化しないとダメってことですね。
1fd472cd1ee9 ChangeLog
yutaka@localhost.localdomain
parents: 1123
diff changeset
108
1fd472cd1ee9 ChangeLog
yutaka@localhost.localdomain
parents: 1123
diff changeset
109 ・きっちりTask化したなら、パイプライン化しないと元がとれない
1fd472cd1ee9 ChangeLog
yutaka@localhost.localdomain
parents: 1123
diff changeset
110
1fd472cd1ee9 ChangeLog
yutaka@localhost.localdomain
parents: 1123
diff changeset
111
1fd472cd1ee9 ChangeLog
yutaka@localhost.localdomain
parents: 1123
diff changeset
112 いろいろバグから、チェックすべきコードがわかったりするのね。
1fd472cd1ee9 ChangeLog
yutaka@localhost.localdomain
parents: 1123
diff changeset
113
1fd472cd1ee9 ChangeLog
yutaka@localhost.localdomain
parents: 1123
diff changeset
114
1123
2a63ba2c9506 bug fix.
yutaka@localhost.localdomain
parents: 1052
diff changeset
115 2011-2-12 Yutaka Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp>
2a63ba2c9506 bug fix.
yutaka@localhost.localdomain
parents: 1052
diff changeset
116
1472
0c5a0a734e55 comment
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1465
diff changeset
117 MemHash の hash() の返り値の受け取りが int でした。そのせいで、配列のindexがマイナスを示し、値が毎回変わる結果に。
1123
2a63ba2c9506 bug fix.
yutaka@localhost.localdomain
parents: 1052
diff changeset
118 キャッシュに失敗しているので、毎回テクスチャのロードが入っていた見たいです。
2a63ba2c9506 bug fix.
yutaka@localhost.localdomain
parents: 1052
diff changeset
119 そのロード時間が busy_ratio の値に含まれていた。なぜ? unsinged intになおし
2a63ba2c9506 bug fix.
yutaka@localhost.localdomain
parents: 1052
diff changeset
120 その結果なんと!
2a63ba2c9506 bug fix.
yutaka@localhost.localdomain
parents: 1052
diff changeset
121
2a63ba2c9506 bug fix.
yutaka@localhost.localdomain
parents: 1052
diff changeset
122 Cell
2a63ba2c9506 bug fix.
yutaka@localhost.localdomain
parents: 1052
diff changeset
123
2a63ba2c9506 bug fix.
yutaka@localhost.localdomain
parents: 1052
diff changeset
124 ball_bound 40 〜 50 FPS
2a63ba2c9506 bug fix.
yutaka@localhost.localdomain
parents: 1052
diff changeset
125 universe 約 20 FPS
2a63ba2c9506 bug fix.
yutaka@localhost.localdomain
parents: 1052
diff changeset
126 gaplant 40 FPS
2a63ba2c9506 bug fix.
yutaka@localhost.localdomain
parents: 1052
diff changeset
127 panel 3 FPS
2a63ba2c9506 bug fix.
yutaka@localhost.localdomain
parents: 1052
diff changeset
128 ieshoot 30 FPS
2a63ba2c9506 bug fix.
yutaka@localhost.localdomain
parents: 1052
diff changeset
129
2a63ba2c9506 bug fix.
yutaka@localhost.localdomain
parents: 1052
diff changeset
130 です。タスクリストのメール時間も全体の速度が速くなったので、7,8%から30%になり改善の余地あり。面白くなってきました。
2a63ba2c9506 bug fix.
yutaka@localhost.localdomain
parents: 1052
diff changeset
131
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
132 2010-12-10 Shinji KONO <kono@ie.u-ryukyu.ac.jp>
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
133
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
134 task_list を PPE の main memory において、それを get_segment で取って来る。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
135 実行する object は、PPE 側の main memory 上に置く。それを get_segment で
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
136 copy して実行する。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
137
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
138 taskのindata/outdata/get_segment を実際にはコピーしないようにすると良いのだが...
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
139 そうすれば、実行時のアドレスが変わらないのでデバッグが容易。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
140 そういうオプション? いや、get_segment をそういうようにする?
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
141
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
142 task_list 上に固定アドレス task かどうかの選択を入れれば良いのか。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
143
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
144 とりあえず、task_list を get_segment するところから書くのが良さそう。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
145
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
146 task_list のaddress を SPE にどうやって教えるかと言う問題がある。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
147 mail かな。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
148
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
149 tag 使う? argv で渡すってあり? envp で送れるのではないか?
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
150 envp はダメだが、argv では渡せるらしい。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
151
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
152 まず、ppe と spe の task_list を作る API の設計と実装をするべきらしい。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
153
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
154 Task 側のは無視 (おぉ?!) SPE 側の SchedRegister も不要。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
155
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
156 get_segment だけでできる?
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
157
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
158 PPE側で、
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
159
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
160 TaskRegister(Task ID, 0 file, entry symbol); // PPE fixed task
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
161 SpeTaskRegister(Task ID, object file, entry symbol); // SPE dynamic task
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
162 SpeTaskRegister(Task ID, 0, entry symbol); // SPE fixed task
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
163
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
164 を指定することになる。 PPE 側は自動的に登録される ( -cpu 0 があるから )
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
165 task_list と spu_task_list が同時に初期化される
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
166
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
167 object file は、.a でも良い。(良いの?) embed しても良い。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
168
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
169 と言うことは、今までのように run を使い回しっ手のいうは許されないってこと?
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
170 その方が良いでしょう。変更大きいけど。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
171
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
172 SPE側に固定する Task はどうするの?
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
173
966
4cd17f86dda6 minor fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 941
diff changeset
174 2010-8-7 Shinji KONO <kono@ie.u-ryukyu.ac.jp>
4cd17f86dda6 minor fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 941
diff changeset
175
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
176 get_segmentのinlineは、その場に static に置いて、default のものを置いておく。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
177 size のcheckはしない。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
178
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
179 MemList は廃止。QueueInfo に。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
180
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
181 Data 領域は、2^n 管理で、move/compaction を行なう。(が、今は書かない)
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
182
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
183 とりあえず、SPUのobject管理だが...
966
4cd17f86dda6 minor fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 941
diff changeset
184
4cd17f86dda6 minor fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 941
diff changeset
185 2010-8-6 Shinji KONO <kono@ie.u-ryukyu.ac.jp>
4cd17f86dda6 minor fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 941
diff changeset
186
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
187 Bulk, Simple, basic は一つにするべきだよな。many_task は、sort と言う名前に変えるべき。
966
4cd17f86dda6 minor fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 941
diff changeset
188
940
e01b551f25d6 unknown dead lock still...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 932
diff changeset
189 2010-7-31 Shinji KONO <kono@ie.u-ryukyu.ac.jp>
e01b551f25d6 unknown dead lock still...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 932
diff changeset
190
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
191 なんと、simple task を SchedTaskManager 経由で作ると、
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
192 PPE task しか作れなくなっていたらしい。それは遅いよ。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
193 SchedTaskManagerのtask managerがFifoManagerだったのが
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
194 原因。CellTaskManager を使う時には、FifoManagerは消せる?
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
195
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
196 その代わり、dead lock が起きる。待ち先のtaskが消滅する場合が
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
197 あるらしい。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
198
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
199 やっぱり、既に終了した task に対して wait for してしまうのが
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
200 まずいらしい。自分で HTask をfree してやれば良いわけだが..
941
fc6cfaae6de7 add no_auto_free flag on HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 940
diff changeset
201
924
1640b14ec15a show dma wait format
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 918
diff changeset
202 2010-7-30 Shinji KONO <kono@ie.u-ryukyu.ac.jp>
1640b14ec15a show dma wait format
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 918
diff changeset
203
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
204 TASK_LIST_MAIL でない方が高速なみたい
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
205 sort (many_task) が、とっても遅くなっている
924
1640b14ec15a show dma wait format
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 918
diff changeset
206
918
e66a08b5cd83 add loadelf in tmp/old.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 893
diff changeset
207 2010-7-24 Shinji KONO <kono@ie.u-ryukyu.ac.jp>
e66a08b5cd83 add loadelf in tmp/old.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 893
diff changeset
208
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
209 やっぱり、load module のlinkの解決はやらないといけないので、
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
210 無理に、SchedTaskのAPI全部を virtual にする必要はないらしい。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
211 spu-gcc spe/ChainCal.o -Wl,-R,spe-main -o tmp.o
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
212 と言う形で、link してやれば良い。(ただし、必要なものが参照されている場合)
918
e66a08b5cd83 add loadelf in tmp/old.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 893
diff changeset
213
893
2faa1f62d925 fix SimpleTask alignment
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 888
diff changeset
214 2010-7-16 Shinji KONO <kono@ie.u-ryukyu.ac.jp>
2faa1f62d925 fix SimpleTask alignment
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 888
diff changeset
215
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
216 SimpleTask のsizeを16の倍数に。そうしないと、Taskのaligmentが16に
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
217 ならないので、gcc -O9 で破綻する。
893
2faa1f62d925 fix SimpleTask alignment
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 888
diff changeset
218
888
b6c45005a3bc call savedTask->write() in TaskArray finish.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 833
diff changeset
219 2010-7-14 Shinji KONO <kono@ie.u-ryukyu.ac.jp>
b6c45005a3bc call savedTask->write() in TaskArray finish.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 833
diff changeset
220
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
221 SchedTaskArray::exec の run の値が最適化で、おかしくなるのは、gcc のbugらしい。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
222 SimpleTask の finish mail が返るのが早すぎる。write を呼ぶのが正しい。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
223 cur_index++ してしまうと、task1/task2 のcur_indexが同じになってしまう。
888
b6c45005a3bc call savedTask->write() in TaskArray finish.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 833
diff changeset
224
830
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 816
diff changeset
225 2010-5-25 Shinji KONO <kono@ie.u-ryukyu.ac.jp>
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 816
diff changeset
226
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
227 PPE側のpost_funcやtaskを実行している時にもSPEからのメールは読んでしまう
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
228 のが望ましい。読んで、とりあえずfifoに入れておく。その場で処理しても良いが、
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
229 check_task_list_finishとかが再帰的に呼びされるのがやっかい。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
230
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
231 Task 実行ループは Scheduler にpoling routineを登録するのが良さそう。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
232 post_func は、SchedTask 経由で poling すれば良い。
833
577bde5d0cec poling (may recurse..)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 830
diff changeset
233
806
fb49e881f2ed TaslListInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 796
diff changeset
234 2010-5-22 Shinji KONO <kono@ie.u-ryukyu.ac.jp>
fb49e881f2ed TaslListInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 796
diff changeset
235
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
236 CpuThread を作るなら、create_task は、manager にメールで教えないとだめ。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
237 CpuManager みたいなものを用意しないとダメか。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
238
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
239 HTask から、waitfor/create_task とかは、TaskManager を呼んでいる。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
240 そのたびに CAS (Check and set) するのはばかげているよな〜
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
241 TaskManager にメールで送る方が良いのではないか。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
242
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
243 wait_for する Task が既に終了していると、存在しないTaskあるいは、
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
244 別な Task を wait_for する場合がある。いわゆるゾンビだけど、これは
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
245 どうしよう? 生きているかどうかを識別するように id を付けるか?
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
246
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
247 どうも、TaskManager.{h,cc} は要らないっぽい。TMmain に渡されるのも
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
248 SchedTask である方が自然。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
249
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
250 TaskListInfo は循環リストなので、SPU/PPU scheduler に渡す前に、
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
251 getLast()->next = 0 する必要がある。freeAll() する前に、直さないと
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
252 だめ。getList() みたいなものを用意しても良いが...
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
253
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
254 Scheduler のconnector(DMA) / Memory 関連は Scheduler.{h,cc} から
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
255 追い出すべき。connector/memory とかを SchedTask に持たせれば良い。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
256 そうすると、API追加でScheduelr.{h,cc} / TaskManagerImple とかを修正する
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
257 必要がなくなる。
816
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 814
diff changeset
258
796
dec384f55712 ChangeLog
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
259 2010-5-11 Shinji KONO <kono@ie.u-ryukyu.ac.jp>
dec384f55712 ChangeLog
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
260
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
261 speTaskList_bg は追放するべきだと思われる。(done)
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
262
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
263 PPE task はTaskList をすべて実行するまで戻って来ない。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
264 なので、spe のmail checkが疎かになっている。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
265 PPE task の実行途中で SPEのmail checkを行なうべき。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
266
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
267 Fifo/Cell TaskManagerImpl は統一できるのではないか? (done)
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
268
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
269 SchedTask は今は各Taskのselfを返しているがTaskListにするべき
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
270 spe からのメールはTaskListが空になった時で良い。早めに、
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
271
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
272 PPE Taskを早めに起動する義理はある? あるかも知れない。Quick Reply Property。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
273
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
274 TaskList もDataSegement化するべきだと思われる。(done)
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
275
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
276 Scheduler::task_list もDataSegment化して、メインメモリ上に置く。
796
dec384f55712 ChangeLog
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 789
diff changeset
277
789
aa894c646235 changelog
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 786
diff changeset
278 2010-4-28 Shinji KONO <kono@ie.u-ryukyu.ac.jp>
aa894c646235 changelog
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 786
diff changeset
279
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
280 SchedTaskBase のみにインスタンス変数を書かせて、
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
281 SchedTask*.h には method のみを書かせる。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
282 そうすると、デバッグが楽だし、object のallocateも楽。(done)
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
283
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
284 HTask(list) -> TaskList(array) -> SchedTask
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
285
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
286 というcopyだが、SchedTask で最初から作る方が良いのかも。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
287 それを DataSegment で共有する。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
288
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
289 SimpleTask のMailを、
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
290 if (mail_is_not_full) send_mail() ;
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
291 else if (queue is not full) enqueuue() ;
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
292 else wait_mail();
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
293 ってな感じに出来ないの?
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
294
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
295 Multi thread にすると、PPEのmail loop が暴走する可能性がある。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
296 このあたりなんか方法があるはずだが...
789
aa894c646235 changelog
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 786
diff changeset
297
786
043c98537bc5 fix early free of TaskArray, add SchedTaskArrayNop stage.
yutaka@localhost.localdomain
parents: 721
diff changeset
298 2010-4-24 Shinji KONO <kono@ie.u-ryukyu.ac.jp>
043c98537bc5 fix early free of TaskArray, add SchedTaskArrayNop stage.
yutaka@localhost.localdomain
parents: 721
diff changeset
299
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
300 write T3 T2 T1 TL TA0 TA1
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
301 exec T2 T1 TL TA0 TA1 TA2
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
302 read T1 TL TA TA1 TA2 T2
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
303 next T1 TL TA TA1 TA2* T2  
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
304
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
305 *のところで終了mailが出てTaskArrayのデータがfreeされてしまうので、よくない
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
306 そうならないように、一段TAN(SchedTaskArrayNop)を挟む。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
307
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
308 write T3 T2 T1 TL TA0 TA1 TA2 TAN%
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
309 exec T2 T1 TL TA0 TA1 TA2 TAN T2
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
310 read T1 TL TA TA1 TA2 TAN T2 T3
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
311 next T1 TL TA TA1 TA2 TAN T2 T3 
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
312
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
313 %のところで終了mailを送る。T2のreadのところで、TaskArrayのデータはreadbuff上にあるので
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
314 破壊されてしまう。なので、savedTask->task->self の値はTANにコピーして持っていく必要がある
786
043c98537bc5 fix early free of TaskArray, add SchedTaskArrayNop stage.
yutaka@localhost.localdomain
parents: 721
diff changeset
315
718
e78238b7c5d6 write dma miss.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 717
diff changeset
316 2009-12-19 Shinji KONO <kono@ie.u-ryukyu.ac.jp>
e78238b7c5d6 write dma miss.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 717
diff changeset
317
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
318 そうか、TaskList->next は、SPE 側で自分で呼び出しているわけね。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
319 と言うことは、schdule(list) が終るまでは、mail check に戻って
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
320 こない... それだと、ちょっとまずいね。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
321
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
322 となると、TaskList のfree(clear)のtimingは? schdule から抜けた
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
323 時と言うことになるわけだけど。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
324
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
325 waitQueue は、実は不要。しかし、終了条件、dead lock detection には
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
326 必要らしい。
721
a0cfe7b28882 cleanups..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 718
diff changeset
327
717
dfb3518d8694 TaskList load timing...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 708
diff changeset
328 2009-12-16 Shinji KONO <kono@ie.u-ryukyu.ac.jp>
dfb3518d8694 TaskList load timing...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 708
diff changeset
329
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
330 CellTaskManagerのTaskList_bg は変だよ。TaskList 自体が
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
331 queue なんだから、トップ二つを特別扱いしているだけでしょう。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
332
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
333 TaskList をread()しているのと同時にnext()されてしまうので、
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
334 next()の中で、TaskList の中身に触るのは良くない。SchedTask
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
335 は微妙に大丈夫らしい。TLのdma waitは、write になっていた。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
336
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
337 TaskArray/TaskArray1 は、TAの中身をnext()で判断しているので、
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
338 これはただしくない。TaskListLoad を間にはさむ手もあるが...
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
339
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
340 write T3 T2 T1 TL TA0 ! TL の dma wait
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
341 exec T2 T1 TL! TA0 TA1
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
342 read T1 TL* TA TA1 TA2 * TL の dma start
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
343 next T1 TL% TA TA1 TA2 % TAの作成判断
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
344
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
345 TaskListLoad をはさむ、安全だけど遅い方法
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
346
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
347 write T3 T2 T1 TLL TL
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
348 exec T2 T1 TLL! TL TA0
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
349 read T1 TLL*TL TA0 TA1
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
350 next T1 TLL TL% TA0 TA1
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
351
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
352 なんだけど、pointer の下位ビットで送ると、前者で実行できる。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
353 next で、TaskList のloadを始めてしまうという手もあるな...
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
354
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
355 write T3 T2 T1 TL TA0 ! TL の dma wait
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
356 exec T2 T1 TL TA0 TA1
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
357 read T1 TL! TA TA1 TA2 * TL の dma start
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
358 next T1* TL% TA TA1 TA2
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
359
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
360 こっっちかな...
717
dfb3518d8694 TaskList load timing...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 708
diff changeset
361
708
d41c62201b1e cleean up SchedTasks.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 703
diff changeset
362 2009-12-15 Shinji KONO <kono@ie.u-ryukyu.ac.jp>
d41c62201b1e cleean up SchedTasks.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 703
diff changeset
363
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
364 SimpleTask の実装が出来たので、TaskArray からは、
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
365 PPU側に詳細な情報を返せる。と言うことは、SPU側から
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
366 PPU Task を投入出来る。実装すればだけど。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
367
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
368 Task 側から書き出し情報を設定するAPIが必要。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
369 マニュアルも書くか。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
370
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
371 Down cast をすべてなくしたい。Sched*.cc からは取れました。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
372
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
373 まだ、いらないものが結構あるらしい...
708
d41c62201b1e cleean up SchedTasks.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 703
diff changeset
374
703
0c8ad8d99656 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 695
diff changeset
375 2009-12-14 Shinji KONO <kono@ie.u-ryukyu.ac.jp>
0c8ad8d99656 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 695
diff changeset
376
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
377 ようやっと動きました。SIMPLE_TASK でないのとの互換性
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
378 を維持するべきか? 頑張れば出来ると思うけど...
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
379
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
380 方法は二つ。TaskList に無理矢理 Task を詰め込むか、
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
381 今までのHTaskを、TaskArray に読み変えるか。前者は変更が
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
382 多い。後者は、wait_for が微妙。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
383
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
384 前者で実装しました。そのうち落すかも。エラーチェックと、
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
385 エラー処理関数が必要。コメントを書かないと。
708
d41c62201b1e cleean up SchedTasks.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 703
diff changeset
386
695
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 693
diff changeset
387 2009-12-12 Shinji KONO <kono@ie.u-ryukyu.ac.jp>
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 693
diff changeset
388
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
389 SchedTask::next で、TaskArray を認識して、そこで、
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
390 SchedTaskArrayLoad を作る。次のSchedTask を用意して、
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
391 SchedTaskArrayLoad にsavedSchedTaskとして引き渡す。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
392
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
393 SchedTaskArrayLoad::read は、TaskArray をload する。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
394 SchedTaskArrayLoad::next は、SchedTaskArray を返す。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
395 この時に、saveedSchedTask を引き継ぐ。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
396 write/exec は何もしない。(これで、pipe line を空ける)
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
397
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
398 SchedTaskArray::read は、List DMA をload する。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
399 SchedTaskArrayLoad::next は、TaskArray 上のTaskを返す。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
400 exec/write は、List DMA 対応で動作する。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
401 もうない場合には、SchedTaskArrayLoad から伝えられた
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
402 saveされた SchedTask を返す。mail も送る。
695
29bd0882272a TaskArray on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 693
diff changeset
403
690
107e6e77f482 Bulk task on going.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 684
diff changeset
404 2009-12-7 Shinji KONO <kono@ie.u-ryukyu.ac.jp>
107e6e77f482 Bulk task on going.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 684
diff changeset
405
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
406 pipeline stageは、loop local だから、instance 変数である必
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
407 要はない。途中で中断することはない。これを一時変数にして、
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
408 再帰的にpipeline stage を呼び出せば良いらしい。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
409
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
410 pipeline stage のtask1に引数で new SchedTaskList を渡すと、
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
411 run()でtask1 = new SchedNop() するよりループ二回ぐらい高速
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
412 になるらしい。が、おそらく、ほとんど影響はない。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
413
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
414 pipelineで既に走っている次のTaskのreadを停める必要があるら
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
415 しい。前もってNopを入れて置く方法もあるが、TaskListの境界が
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
416 問題になる。停めないとパイプラインバッファを新たに取る必要
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
417 があり連鎖的にはまる。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
418
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
419 writeしている奴もいるしな。スケジューラは一段しかネストしな
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
420 いから新しくバッファ取るか? いや、やっぱり許されないか。い
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
421 や、取るか。うーん、悩ましい。どうせ、Task list は確保しな
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
422 いとだめだから… 再帰しないで、もとのスケジューラで動かした
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
423
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
424
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
425 そのためには、既に Pipeline に入っているTaskが邪魔か。2つTask
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
426 を投入して、間に TaskList read が入ってもなんとかなるように
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
427 工夫するのが良いっぽい
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
428
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
429 なんか、Renew Task の道を歩んでいる気もするが...
693
c512e879153a document
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 690
diff changeset
430
683
262f28511797 changelog
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 673
diff changeset
431 2009-12-6 Shinji KONO <kono@ie.u-ryukyu.ac.jp>
262f28511797 changelog
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 673
diff changeset
432
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
433 やっぱり、Graphical なprofileが欲しいかな。どのDMA/Taskに時間がかかっている
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
434 かが見えるようなものが。profile で、メインメモリにlogを書き出すようなもの
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
435 が必要。deubg 用のデータ書き出しツールがいるな。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
436
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
437 log header
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
438 command(16) cpu-id(16) event(32) time(64)
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
439 struct debug_log {
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
440 uint16 command;
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
441 uint16 cpu-id;
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
442 uint32 event;
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
443 uint32 time;
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
444 }
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
445 ぐらい? get_segment 使うべきか。連続領域に使える get_segement があると
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
446 良いわけね。write とも言うが。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
447
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
448 sort で、memcpy しているのは変。read/write buffer をflipしてやると
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
449 良い。両方とも握っているんだから問題ない。ただし、read/write buffer
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
450 の大きさは等しい必要がある。SchedTask->flip_read_write_buffer(); か?
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
451 sort ちゃんとは動いているんだよ。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
452
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
453 word_count_test の稼働率が10%なのはひどい。word_count の方だと偏りが
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
454 あって、一部が50%になるが10%ぐらい。DMA待ちではなくて、メール待ちに
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
455 なっている。PPUネックになっているっぽい。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
456
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
457 TaskArray は、SchedTask を拡張して処理する。next で、次のTaskを
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
458 用意する感じか。inData/outData の処理も。
684
ecf7e09b1fe8 adding Array Task.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 683
diff changeset
459
673
5e5e8eb8da5a profiling worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 659
diff changeset
460 2009-12-5 Shinji KONO <kono@ie.u-ryukyu.ac.jp>
5e5e8eb8da5a profiling worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 659
diff changeset
461
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
462 なんかなぁ。一つの機能を付け加えようとすると、
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
463
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
464 TaskManager/Cell/CellTaskManagerImpl.cc
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
465 TaskManager/Cell/CellTaskManagerImpl.h TaskManager/Cell/spe/CellDmaManager.cc
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
466 TaskManager/Cell/spe/CellDmaManager.h TaskManager/Cell/spe/ShowTime.cc TaskManager/Cell/spe/ShowTime.h
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
467 TaskManager/Cell/spe/SpeTaskManagerImpl.cc TaskManager/Cell/spe/SpeTaskManagerImpl.h
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
468 TaskManager/Cell/spe/main.cc TaskManager/Fifo/FifoTaskManagerImpl.cc
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
469 TaskManager/Fifo/FifoTaskManagerImpl.h TaskManager/Makefile.cell TaskManager/kernel/ppe/TaskManager.h
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
470 TaskManager/kernel/ppe/TaskManagerImpl.h TaskManager/kernel/schedule/DmaManager.h
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
471 TaskManager/kernel/schedule/SchedTask.cc TaskManager/kernel/schedule/SchedTask.h
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
472 TaskManager/kernel/schedule/Scheduler.h TaskManager/kernel/sys_task/SysTasks.h
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
473 example/word_count_test/main.cc
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
474
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
475 こんなにファイルをいじらないと出来ない。それって、全然、ダメじゃん。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
476
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
477 なんでかなぁ。
673
5e5e8eb8da5a profiling worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 659
diff changeset
478 SchedTask -> Scheduler -> Connector
5e5e8eb8da5a profiling worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 659
diff changeset
479 TaskManagerImpl -> {CellTaskManager,FifoTaskManager/SpeTaskManager}
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
480 を全部、いじる羽目になる。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
481 SchedTask から system call するより、Task を定義して、
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
482 それを呼び出すって方がましかも。
673
5e5e8eb8da5a profiling worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 659
diff changeset
483
5e5e8eb8da5a profiling worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 659
diff changeset
484
659
c7199f162b64 bulk task list start.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 646
diff changeset
485 2009-11-23 Shinji KONO <kono@ie.u-ryukyu.ac.jp>
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
486 list.bound は廃止。list element から計算可能。
659
c7199f162b64 bulk task list start.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 646
diff changeset
487
640
ecf056ddd21a SimpeTask on Cell worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 638
diff changeset
488 2009-11-20 Shinji KONO <kono@ie.u-ryukyu.ac.jp>
ecf056ddd21a SimpeTask on Cell worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 638
diff changeset
489
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
490 mail_sendQueue の実装がだめ。こういう実装をすると、queue の
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
491 正しさを関数の中に閉じ込められない。なんか、無限リストにな
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
492 っているらしい。参照が、渡り歩いているどこかの場所でダメに
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
493 なっているらしい。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
494
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
495 実際、mail_sendQueue は、free list に置き換わってしまう。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
496 これまで、これがおかしくならなかった理由は不明。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
497
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
498 connector に外から手を入れないで、ちゃんとfunction callするべし。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
499
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
500 わかりました。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
501 if (list) {
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
502 ...
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
503 mainScheduler->send_mailList(in_mail_list);
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
504 }
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
505 out_mail_list = mainScheduler->recv_mailList();
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
506
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
507 としてしまったが、recv_mailList() でなく、send_mailList で、
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
508 mail_sendQueue をクリアしていたので、
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
509 } else {
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
510 mainScheduler->send_mailList(in_mail_list);
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
511 }
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
512 とする必要があったらしい。if (list) を入れたせいで、こうなった。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
513 でも、当然、recv_mailList() で clear するべき。atomicity の意味でも。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
514 なので、send_mailList() での clear は必要ない。
646
9f9390b45f78 send_mailList fix.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 640
diff changeset
515
640
ecf056ddd21a SimpeTask on Cell worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 638
diff changeset
516
637
20665e4060ea not yet worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 631
diff changeset
517 2009-11-19 Shinji KONO <kono@ie.u-ryukyu.ac.jp>
20665e4060ea not yet worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 631
diff changeset
518
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
519 finish_task を全員が待つ設定で、finish_task を終了判定に
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
520 使っている。それだと、すべてのtaskが、finish_task のwait queue
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
521 を*必ず*触りにいってしまう。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
522
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
523 finish_task への待ちを取り除くと、CellTaskManagerImpl::run()
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
524 が、
646
9f9390b45f78 send_mailList fix.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 640
diff changeset
525 do {
9f9390b45f78 send_mailList fix.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 640
diff changeset
526 ppeMail = ppeManager->schedule(ppeTaskList);
9f9390b45f78 send_mailList fix.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 640
diff changeset
527 cont:
9f9390b45f78 send_mailList fix.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 640
diff changeset
528 ppeTaskList = mail_check(ppeMail);
9f9390b45f78 send_mailList fix.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 640
diff changeset
529 } while (ppeTaskList);
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
530 とかやっているので、ここで抜けてしまう。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
531
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
532 要するに、SPUの状態を見て、running がなくなるのを調べるべき
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
533 なんだが、SpeTheads は「一つしかない」らしい。spe_running
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
534 で、走っているものがあるかどうか見るか?
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
535
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
536 Cell だと、MainScheduler と FifoScheduler の二種類の
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
537 スケジューラがあるのか。
646
9f9390b45f78 send_mailList fix.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 640
diff changeset
538
9f9390b45f78 send_mailList fix.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 640
diff changeset
539 MainScheduler --- task list -----> FifoScheduler
9f9390b45f78 send_mailList fix.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 640
diff changeset
540 MainScheduler <-- finish task ---- FifoScheduler
9f9390b45f78 send_mailList fix.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 640
diff changeset
541
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
542 というわけね。
637
20665e4060ea not yet worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 631
diff changeset
543
631
30dd8a3deb4a Cell 64 bit tried, but not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 625
diff changeset
544 2009-11-15 Shinji KONO <kono@ie.u-ryukyu.ac.jp>
30dd8a3deb4a Cell 64 bit tried, but not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 625
diff changeset
545
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
546 List DMAって、32bit address を使っているらしい。それは、ちょっと
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
547 ひどいなぁ。
631
30dd8a3deb4a Cell 64 bit tried, but not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 625
diff changeset
548
625
94d82f2c842f 64bit mode worked on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 619
diff changeset
549 2009-11-14 Shinji KONO <kono@ie.u-ryukyu.ac.jp>
94d82f2c842f 64bit mode worked on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 619
diff changeset
550
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
551 やっぱり、TaskList の存在が許せない。あったとしても不定長でしょう。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
552 無駄なコピーが多すぎる。
625
94d82f2c842f 64bit mode worked on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 619
diff changeset
553
619
278db3ca751d RenewTask removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 616
diff changeset
554 2009-11-14 Shinji KONO <kono@ie.u-ryukyu.ac.jp>
278db3ca751d RenewTask removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 616
diff changeset
555
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
556 Scheduler / TaskManger / TaskManagerImpl の区別が不明
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
557 HTask は、TaskManagerImpl を持ってる。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
558
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
559 Scheduler は SchedTask から直接見えないはずだが、SchedTask は、
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
560 Scheduler は知っているが、TaskManager は知らない。これがかなりの
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
561 混乱を生んでいる。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
562
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
563 SPU上では、TaskManager が存在しないのが原因らしいが、allcoate とかは、
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
564 TaskManager が行うはず。なので、SPU上にもTaskManagerがある方が自然。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
565
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
566 SchedTask が自分自身で scheduling してしまっているので、Scheduler
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
567 には、ほとんど仕事がない。なので、大半の処理を scheduler -> manager
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
568 経由で行うことになる。
619
278db3ca751d RenewTask removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 616
diff changeset
569
615
184d6d3f0cd9 remove uncessary Task Name definision
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 567
diff changeset
570 2009-11-14 Shinji KONO <kono@ie.u-ryukyu.ac.jp>
184d6d3f0cd9 remove uncessary Task Name definision
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 567
diff changeset
571
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
572 要するに、SPE task 側から addOutData できればよい。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
573 でも、別に、PPE側から計算してもよいはずだけどね。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
574 そうすれば、renew task は取り外せる。
615
184d6d3f0cd9 remove uncessary Task Name definision
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 567
diff changeset
575
184d6d3f0cd9 remove uncessary Task Name definision
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 567
diff changeset
576 SchedDefineTask1(DrawSpanEnd,draw_span_end);
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
577 で、名前を指定させておいて、さらに、
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
578 SchedExternTask(DrawSpanEnd);
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
579 SchedRegisterTask(TASK_DRAW_SPAN_END, DrawSpanEnd);
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
580 で、新しく名前を要求するのって、なんとかならんの? 読みづらいんだよ。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
581 DrawSpanEnd を、そのまま使ってもよさそうだけど?
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
582
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
583 せっかく、renew task を外したのに、HD crash で失ってしまいました。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
584
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
585 add_param が順序を持っているのは見づらい。数字で指定する方が合理的。
616
350b9b8c985f First addOutput rendering try failed.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 615
diff changeset
586
538
5641d121818e code_load in read()
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 503
diff changeset
587 2009-10-11 Shinji KONO <kono@ie.u-ryukyu.ac.jp>
5641d121818e code_load in read()
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 503
diff changeset
588
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
589 単純な、rbuf, wbuf + write return size の task のAPI
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
590 List DMA の API
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
591 投入 cpu 別の spawn method
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
592 Redering 時の内部からの DMA への直接アクセスへの禁止等など
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
593
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
594 set_post で登録する関数も、task のrun関数と同じ型にした方が便利そう。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
595
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
596 SPU側でも配列(TaskList)ではなく、TaskQueue で管理すれば、
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
597 renew task は簡単に実装できる。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
598
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
599 SchedTask の renew かそうでないかの区別は全部なくす。ex_init とかは、
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
600 なくなるはず。その代わり TaskQueue で管理する。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
601
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
602 TaskList に inListData/outListData が入っているのは、やはりおかしい。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
603 もっとコンパクトであるべき。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
604
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
605 TaskList は、こまめに終了をPPE側へ知らせるのではなく、TaskListの
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
606 書き換えで知らせる方が良い。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
607
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
608 SPUからPPUへ、create task 出来た方が良い。それはTaskList の書き出し
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
609 で行なう。
538
5641d121818e code_load in read()
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 503
diff changeset
610
503
516d5c91d5b4 comment
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 489
diff changeset
611 2009-10-11 Shinji KONO <kono@ie.u-ryukyu.ac.jp>
516d5c91d5b4 comment
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 489
diff changeset
612
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
613 ようやっと直せました。inListData/outListData は別に転送しないで、
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
614 一緒に転送してしまった方が良い。どうせ、いつも転送しているのだから。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
615
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
616 word_count が fifo の方が高速なのは、どうにかしてください。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
617
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
618 Renew Task の addInData は、メインメモリからDMAするので正しいらしい。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
619 直し方を間違えた。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
620
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
621 Task をmemcpyして、TaskList に入れているが、List DMA に直すべき。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
622 Simple Task を常に起動して、List DMA task は、その中で、Renew Task
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
623 として起動するのが良いのでは? そうすれば、Task Load 自体を Task に
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
624 出来る。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
625
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
626 Renew Task の実行順序が filo になっている。このあたり変なので、
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
627 修正するべきでしょう。Renew用の TaskList を持てば良いんじゃないか?
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
628 task->self の ad-hoc な使い方が泣ける。ひどすぎます。
503
516d5c91d5b4 comment
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 489
diff changeset
629
489
1d893ffbc5ff comment
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 481
diff changeset
630 2009-10-06 Shinji KONO <kono@ie.u-ryukyu.ac.jp>
1d893ffbc5ff comment
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 481
diff changeset
631
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
632 Task 内の create_task は、SchedTask に対してで、
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
633 PPE 上では、Manager に対してだよね。だから、出来る
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
634 ことがかなり異なる。これは、まずいだろ?
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
635
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
636 特に、PPE task に明示的に manager を渡すってのは、
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
637 とっても変。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
638
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
639 Renew Task の特別扱いが、いろいろ歪めているんだが、
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
640 view.cc で使っているので落せない。
489
1d893ffbc5ff comment
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 481
diff changeset
641
481
f9ffcffb6d09 Double linked list modification done (tested on Mac OS X)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 468
diff changeset
642 2009-10-05 Shinji KONO <kono@ie.u-ryukyu.ac.jp>
f9ffcffb6d09 Double linked list modification done (tested on Mac OS X)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 468
diff changeset
643
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
644 TaskQueue のfree list の管理はシステムで一つであるべき。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
645 TaskQueue は double linked list が当然らしい。
481
f9ffcffb6d09 Double linked list modification done (tested on Mac OS X)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 468
diff changeset
646
468
796f72cb21d9 test_nogl on Mac OS X worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 400
diff changeset
647 2009-10-02 Shinji KONO <kono@ie.u-ryukyu.ac.jp>
796f72cb21d9 test_nogl on Mac OS X worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 400
diff changeset
648
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
649 DrawSpan で、~DrawSpan() で、allocate したデータを DMA_WAIT
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
650 して、free しているが、これは、抽象化違反。Task で明示的に
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
651 DMAするのは禁止。Task 内で、add_outData 出来れば良い。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
652
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
653 renew が正しいような気がするが...
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
654
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
655 Task 内で大域変数は使えない。なので、smanager からallocateする
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
656 必要がある。Task の解放のタイミングではなくて、パイプラインの
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
657 タイミングでDMA waitとfreeを行なう必要がある。DrawSpan の場合は、
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
658 add_outData で良いが、内部で allocate/free は行なう必要がある。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
659 put_segement がパイプライン動作するべきなのか?
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
660
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
661 固定のDMA tagが邪魔。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
662
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
663 DrawSpan は全般的にダメだな〜
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
664
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
665 でも、その変更は大きいので、とりあえず動くようにしたい。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
666
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
667 memset 0 は、7.7.3 SL1 Data Cache Range Set to Zero コマンド
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
668 つかうべき。SPE側でやっても良い。でも、本来は全面埋まるのが
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
669 普通なのでどうでも良いけど。
468
796f72cb21d9 test_nogl on Mac OS X worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 400
diff changeset
670
386
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 381
diff changeset
671 2009-08-06 Shinji KONO <kono@ie.u-ryukyu.ac.jp>
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 381
diff changeset
672
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
673 で、MemList/MemHash が TaskManager 側に移ったので、
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
674 これで、code の management を書くことが出来る。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
675 そうすれば、SPEのメモリの限界をほんと気にする必要がなくなるはず。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
676
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
677 その前に、get_segment の例題を直さないと。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
678
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
679 DrawSpanRnew/reboot は使ってないらしい。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
680
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
681 Tree は、配列にしないでlinkをSPE側からたどるようになっている。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
682 それは良いのだが、Task 側で dma_wait するような実装は望ましくない。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
683 この部分も書き直す必要がある。list 構造の SPE上の Iterator を
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
684 実装すれば良い。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
685
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
686 memory 関係のコードが scheduler の下にあるのは面白くない。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
687
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
688 Scheduler で実装(__scheduler)に移譲している部分は、headerに
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
689 移した方が良い。
390
6087affae003 document
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 386
diff changeset
690
6087affae003 document
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 386
diff changeset
691 2009-08-06 Shinji KONO <kono@ie.u-ryukyu.ac.jp>
6087affae003 document
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 386
diff changeset
692
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
693 うーん、get_segemnt で、dma_wait のtagをなんとかする
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
694 必要があるらしい。get_tag() でなんとかなるけど、
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
695 他のtag との関係があるかな。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
696
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
697 完全に見えなくするべきでしょうけど... 今はいい。
386
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 381
diff changeset
698
381
ded8bb057315 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 376
diff changeset
699 2009-08-01 Shinji KONO <kono@ie.u-ryukyu.ac.jp>
ded8bb057315 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 376
diff changeset
700
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
701 MemList は動いたので、今度は TileHash を TaskManager 側に移動する
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
702 必要がある。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
703
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
704 その後、コードのLRUを書けば、Cerium は一通り出来上がり。
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
705
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
706 TaskManager と Scheduler の関係が一貫してない。複雑すぎる。
381
ded8bb057315 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 376
diff changeset
707
ded8bb057315 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 376
diff changeset
708
363
73630476453a See Changelog
tkaito@localhost.localdomain
parents: 356
diff changeset
709 2009-07-24 Kaito TAGANO <tkaito@cr.ie.u-ryukyu.ac.jp>
390
6087affae003 document
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 386
diff changeset
710
363
73630476453a See Changelog
tkaito@localhost.localdomain
parents: 356
diff changeset
711 長さ別の freeList と単一の HashTable で管理する
73630476453a See Changelog
tkaito@localhost.localdomain
parents: 356
diff changeset
712 TileList を廃止
73630476453a See Changelog
tkaito@localhost.localdomain
parents: 356
diff changeset
713 class MemorySegment {
73630476453a See Changelog
tkaito@localhost.localdomain
parents: 356
diff changeset
714 MemorySegment *next;
73630476453a See Changelog
tkaito@localhost.localdomain
parents: 356
diff changeset
715 MemorySegment *prev;
73630476453a See Changelog
tkaito@localhost.localdomain
parents: 356
diff changeset
716 uint64 size;
73630476453a See Changelog
tkaito@localhost.localdomain
parents: 356
diff changeset
717 uint64 address;
73630476453a See Changelog
tkaito@localhost.localdomain
parents: 356
diff changeset
718 uint64 dummy;
73630476453a See Changelog
tkaito@localhost.localdomain
parents: 356
diff changeset
719 // uint32 data[0];
73630476453a See Changelog
tkaito@localhost.localdomain
parents: 356
diff changeset
720 }
73630476453a See Changelog
tkaito@localhost.localdomain
parents: 356
diff changeset
721
73630476453a See Changelog
tkaito@localhost.localdomain
parents: 356
diff changeset
722 class MemList {
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
723 MemorySegment* first;
363
73630476453a See Changelog
tkaito@localhost.localdomain
parents: 356
diff changeset
724 MemorySegment* last;
73630476453a See Changelog
tkaito@localhost.localdomain
parents: 356
diff changeset
725
73630476453a See Changelog
tkaito@localhost.localdomain
parents: 356
diff changeset
726 MemList* createMemList(uint32 size, uint32 count);
73630476453a See Changelog
tkaito@localhost.localdomain
parents: 356
diff changeset
727 void addFirst(MemorySegment* e);
73630476453a See Changelog
tkaito@localhost.localdomain
parents: 356
diff changeset
728 void addLast(MemorySegment* e);
73630476453a See Changelog
tkaito@localhost.localdomain
parents: 356
diff changeset
729 MemorySegment* getFirst();
73630476453a See Changelog
tkaito@localhost.localdomain
parents: 356
diff changeset
730 MemorySegment* getLast();
73630476453a See Changelog
tkaito@localhost.localdomain
parents: 356
diff changeset
731 boolean remove(MemorySegment* e);
73630476453a See Changelog
tkaito@localhost.localdomain
parents: 356
diff changeset
732 void moveToFirst(MemorySegment* e); // or use();
73630476453a See Changelog
tkaito@localhost.localdomain
parents: 356
diff changeset
733 }
73630476453a See Changelog
tkaito@localhost.localdomain
parents: 356
diff changeset
734
73630476453a See Changelog
tkaito@localhost.localdomain
parents: 356
diff changeset
735 サイズ毎に freelist と activelist を持って、これを malloc free
73630476453a See Changelog
tkaito@localhost.localdomain
parents: 356
diff changeset
736 として使う。
73630476453a See Changelog
tkaito@localhost.localdomain
parents: 356
diff changeset
737 これのテストルーチンを書き終わったら、Tapestry をこれで書き直す
73630476453a See Changelog
tkaito@localhost.localdomain
parents: 356
diff changeset
738 LRU は使うたびに以下を呼び出す
73630476453a See Changelog
tkaito@localhost.localdomain
parents: 356
diff changeset
739
73630476453a See Changelog
tkaito@localhost.localdomain
parents: 356
diff changeset
740 void use(MemorySegment* e, MemList* active) {
73630476453a See Changelog
tkaito@localhost.localdomain
parents: 356
diff changeset
741 active.remove(e);
73630476453a See Changelog
tkaito@localhost.localdomain
parents: 356
diff changeset
742 active.addFirst(e);
73630476453a See Changelog
tkaito@localhost.localdomain
parents: 356
diff changeset
743 }
73630476453a See Changelog
tkaito@localhost.localdomain
parents: 356
diff changeset
744
73630476453a See Changelog
tkaito@localhost.localdomain
parents: 356
diff changeset
745
354
cfd20d609ace add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 279
diff changeset
746 2009-07-15 Yusuke KOBAYASHI <koba@cr.ie.u-ryukyu.ac.jp>
cfd20d609ace add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 279
diff changeset
747
cfd20d609ace add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 279
diff changeset
748 PPU からMainMemory にResource を Access する API
cfd20d609ace add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 279
diff changeset
749 長さ別の freeList と単一の HashTable で管理する
cfd20d609ace add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 279
diff changeset
750
386
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 381
diff changeset
751 読みだしAPI。set_rgb に相当。
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 381
diff changeset
752 uint32 segment_id = smanager->get_segment(memaddr addr, *MemList m)
354
cfd20d609ace add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 279
diff changeset
753 id は hash値に相当。
386
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 381
diff changeset
754 addr で指定された PPU の Address が Hash にあるかどうか調べる。
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 381
diff changeset
755 無ければ dma_load する。そして指定された id を返す。
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 381
diff changeset
756
400
984e7890db0c Fix examples.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 390
diff changeset
757 確保 API。set_rgb に相当。読み出さないで、hash entry だけ確保する。put しかしない部分用
984e7890db0c Fix examples.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 390
diff changeset
758 uint32 segment_id = smanager->get_null_segment(memaddr addr, *MemList m)
984e7890db0c Fix examples.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 390
diff changeset
759 id は hash値に相当。
984e7890db0c Fix examples.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 390
diff changeset
760
386
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 381
diff changeset
761 書き出しAPI、読みだしていること前提。
354
cfd20d609ace add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 279
diff changeset
762 smanager->put_segment(wait_id);
386
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 381
diff changeset
763
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 381
diff changeset
764 MemorySegment* smanager->wait_segment(uint32 segment_id)
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 381
diff changeset
765 id で指定された PPU の segment の copy の Address を返す。
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 381
diff changeset
766 必要があれば dma_wait を行う。書き出しも待ち合わせる。
354
cfd20d609ace add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 279
diff changeset
767
307
3fc86ddf5d1c clean up include
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 279
diff changeset
768 2009-06-8 Shinji KONO <kono@ie.u-ryukyu.ac.jp>
3fc86ddf5d1c clean up include
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 279
diff changeset
769
3fc86ddf5d1c clean up include
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 279
diff changeset
770 SchedTask/SchedTaskImpl の分離はあんまり意味がなかった。
3fc86ddf5d1c clean up include
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 279
diff changeset
771 SchedTaskBase が既にあるし。
3fc86ddf5d1c clean up include
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 279
diff changeset
772 とりあえず、__list とかは、private にしただけ。
3fc86ddf5d1c clean up include
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 279
diff changeset
773 ScheTaskImple を作っても、継承してprivateにすると、
3fc86ddf5d1c clean up include
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 279
diff changeset
774 warning は出るが、 User Task space の名前空間は結局汚れてしまう。
3fc86ddf5d1c clean up include
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 279
diff changeset
775
3fc86ddf5d1c clean up include
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 279
diff changeset
776 delegate するべきだと思うが、SchedTaskBase でないと、
3fc86ddf5d1c clean up include
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 279
diff changeset
777 動かないらしい。それだと、indirect が増えるので、ちょっといや。
3fc86ddf5d1c clean up include
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 279
diff changeset
778
279
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 276
diff changeset
779 2009-06-4 Shinji KONO <kono@ie.u-ryukyu.ac.jp>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 276
diff changeset
780
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 276
diff changeset
781 set_symbol は、もういらないよね?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 276
diff changeset
782
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 276
diff changeset
783 list dma 中心の実装にして、もっと細かく read/exec/write
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 276
diff changeset
784 した方が良いかも。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 276
diff changeset
785
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 276
diff changeset
786 post で、PPE task を渡せると良い。address は parameterとして送る
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 276
diff changeset
787
276
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
788 2009-02-13 Wataru MIYAGUNI <gongo@cr.ie.u-ryukyu.ac.jp>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
789
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
790 * kernel/ppe/Random.cc (reset): fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
791 urandom -> random とどれも読めなかったら
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
792 gettimeofday() での時間から seed を求めるように
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
793
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
794 2009-02-12 Wataru MIYAGUNI <gongo@cr.ie.u-ryukyu.ac.jp>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
795
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
796 * add: kernel/ppe/Random.cc
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
797 乱数生成クラス。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
798 ゲームだとユーザ使うでしょうきっと。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
799 一応 /dev/random から seed 取る様にしてます
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
800
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
801 2009-02-04 Wataru MIYAGUNI <gongo@cr.ie.u-ryukyu.ac.jp>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
802
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
803 * kernel/ppe/TaskManager.cc (TaskManager::allocate): rename
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
804 malloc -> allocate
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
805
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
806 * kernel/main.cc (main): fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
807 cerium_main を呼ぶのではなく、TMmain という名前にしました。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
808 ちょっと SDLmain をパクった感じで。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
809 まあ TaskManager の main で cerium_* って名前は微妙に変だからね。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
810
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
811 * kernel/ppe/TaskManager.cc (TaskManager::set_TMend): add
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
812 cerium_main があるんだから、cerium_end があってもいいじゃない。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
813 もっと言うと、TaskManager に main を隠すって流れなんだけど
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
814 終了を検知できないのはちとやりづらいかなと。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
815 たとえば測定とか。Task の post_func とかでもやれないことはないけどね。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
816 というわけで、ユーザが、プログラム終了時に呼ばれる関数を設定できるように。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
817
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
818 2009-01-20 Wataru MIYAGUNI <gongo@cr.ie.u-ryukyu.ac.jp>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
819
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
820 * Cell/spe/SchedTask.cc (SchedTask::get_cpuid): add
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
821 printf デバッグ時に、どの CPU かって知りたい時があるので。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
822
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
823 PPE = 0
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
824 SPE = 0〜spu_num-1;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
825
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
826 PPE は 0 以外に分かりやすい数字がいいんだけどなー。SPE と被るし。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
827 -1 とかはエラーっぽいから好かない。まあいいんだけど。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
828
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
829 User Task では以下の様に使用します
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
830
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
831 int cpuid = smanager->get_cpuid();
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
832
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
833
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
834 * Cell/SpeThreads.cc (SpeThreads::spe_thread_run): fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
835 SPE_EXIT が出る時は正常終了だけど、これだと
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
836 エラーでたようなメッセージに見えてしまう(俺がそう見えてしまった)ので
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
837 ここは表示しなくてもいいかな。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
838
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
839 * kernel/ppe/MailManager.cc (MailManager::destroy): fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
840 無限ループになってた。この for() 間違ってるかな。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
841 なんか TaskQueueInfo.cc とかでも、結局 while() に直してるし。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
842
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
843 * kernel/ppe/TaskManager.cc (TaskManager::~TaskManager): add
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
844 kernel/main.ccで
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
845
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
846 delete manager;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
847
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
848 としているのに、TaskManagerImpl::~TaskManagerImpl が呼び出されず
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
849 どうしてかなと思ったら、そもそも ~TaskManager が無かった。あほか
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
850
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
851 2009-01-05 Wataru MIYAGUNI <gongo@cr.ie.u-ryukyu.ac.jp>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
852
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
853 * all : fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
854 Scheduler::curIndex_taskList を削除し、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
855 SchedTask に持たせる様に変更。(SchedTask::__cur_index)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
856 それに伴い、SchedTask::__init__() も cur_index を入れる様に変更
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
857
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
858 2008-12-24 Wataru MIYAGUNI <gongo@cr.ie.u-ryukyu.ac.jp>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
859
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
860 * kernel/schedule/SchedTask.cc (SchedTask::ex_init_renew)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
861 (SchedTask::ex_init_normal): add
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
862 (SchedTask::__init__): fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
863
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
864 init でも ex_init を使える様に。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
865 あと、コンストラクタで渡していた引数を __init__() に渡す様にした。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
866 コンストラクタの引数あると、継承する時にいちいち親クラスのも書かないと
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
867 いけなかった。これ省略できないんだよな。めんどくさい。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
868
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
869 例.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
870 class Hoge : public SchedTask {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
871 Hoge(int i) : Task(i) {}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
872 };
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
873
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
874 なので、今までは Scheduler.h に SchedConstructor ってマクロを書いて
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
875 クラス名入れるだけで上の様な形になるようにしていた。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
876 でも、例えば
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
877
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
878 SchedTask -> Hoge -> Fuge っていうように Fuge ってタスクを
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
879 作りたいとき、上のままだと SchedTask に引数渡してしまうのでだめ。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
880 もうめんどくさいってことで、コンストラクタ全てデフォルトにして、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
881 __init__() の引数に渡す様にしました。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
882
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
883 (SchedTask::__set_renewFlag): add
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
884
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
885 ここで、PPEで生成されたか(normal)、SPE で生成されたか(renew) の
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
886 判定を行い、ex_xxx の設定もする
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
887
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
888 (SchedTask::get_inputSize, SchedTask::get_outputSize): add
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
889
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
890 アドレスだけじゃなく、そのサイズも取れた方がいいだろう
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
891
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
892
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
893 2008-12-23 Wataru MIYAGUNI <gongo@cr.ie.u-ryukyu.ac.jp>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
894
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
895 * Cell/spe/SchedTask.cc (SchedTask::get_outputAddr)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
896 (SchedTask::get_inputAddr): add
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
897
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
898 in/out のデータだけじゃなく、そのアドレスも取れた方がいいだろう
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
899
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
900 2008-12-22 Wataru MIYAGUNI <gongo@cr.ie.u-ryukyu.ac.jp>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
901
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
902 * Cell/spe/SchedTask.cc (SchedTask::__init__, SchedTask::read)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
903 (SchedTask::exec, SchedTask::write): fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
904 (SchedTask::ex_read_normal, SchedTask::ex_read_renew)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
905 (SchedTask::ex_exec_normal, SchedTask::ex_exec_renew)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
906 (SchedTask::ex_write_normal, SchedTask::ex_write_renew): add
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
907
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
908 SPE 内で生成されたタスクは、PPE で生成されたものと違い
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
909
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
910 - add->inData
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
911 : PPE から DMA or SPE 内のものをそのまま使う
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
912 - PPE にタスクが終了したことを知らせる
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
913 : 生成されたタスクを待つ必要があるなら、その時点では送らない
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
914
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
915 とか、まあいろいろ処理が違うわけです。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
916 そして、タスク内生成タスクの判断をする
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
917
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
918 __flag_renewTask ? 0 = PPE で生成 : 1 = SPE で生成
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
919
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
920 という変数がある。これでいくつか処理を分けてるんだけど、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
921 今までは
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
922
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
923 if (__flag_renewTask) {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
924 } else {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
925 }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
926
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
927 ってやってた。これではいかんという事で、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
928 __init__() 内で、関数ポインタに、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
929
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
930 ex_xxxx_normal: PPE で生成されたタスクに対する処理
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
931 ex_xxxx_renew: SPE で生成されたタスクに対する処理
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
932
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
933 と入れて、if 文無しでやってみた。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
934 今は ex_write_xxx しか書いてないが、これからread/exec でも
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
935 出てくると思うので、作っておいた
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
936
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
937
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
938 2008-12-19 Wataru MIYAGUNI <gongo@cr.ie.u-ryukyu.ac.jp>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
939
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
940 * Cell/spe/CellDmaManager.cc (CellDmaManager::dma_wait)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
941 (CellDmaManager::mail_write, CellDmaManager::mail_read): fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
942 writech、readch の関数を、wrap (って言い方でおk?)された関数に変更。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
943 最適化掛かってるっぽいし、長いよりはわかりやすいし。そのための wrap。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
944
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
945 例:
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
946 - before
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
947 spu_readch(SPU_RdInMspu_readch(SPU_RdInMbox);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
948 - after
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
949 spu_read_in_mbox(void);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
950
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
951 2008-11-05 Wataru MIYAGUNI <gongo@cr.ie.u-ryukyu.ac.jp>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
952
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
953 * add: Task 内での API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
954 Task 外での API は、今まで通り manager->create_task とかですが
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
955 タスク内でも、「オブジェクト->関数」の呼び出しがいいんじゃないか
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
956 って話になったので、付け加えました。今のところ、SchedTask.h の
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
957 内部クラスとして
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
958
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
959 STaskManager
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
960
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
961 ってのを加えて、ユーザはそのインスタンスである
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
962
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
963 smanager
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
964
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
965 からAPIにアクセスします。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
966 今までは __scheduler->dma_load とかいろいろやってたんですが
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
967 これからは全て smanager にしました。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
968 というわけで、ここに使える API 一覧。いずれゲーム班 wikiの方にも。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
969
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
970 - get_input, get_output, get_param
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
971 - create_task, wait_task
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
972 - global_alloc, global_get, global_free
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
973 - mainMem_alloc, mainMem_wait, mainMem_get
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
974 - dma_load, dma_store, dma_wait
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
975 - allocate
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
976
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
977 使い方は追々描きますが、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
978 今のところ上に変更しなくてもそのままの記述で動くはずです。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
979 いずれは全て移行してもらうことになりますがきっと。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
980
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
981
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
982 * kernel/schedule/SchedTask.cc:
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
983 いろいろ関数が増えてますが、ラッパーです。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
984
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
985 2008-11-01 Wataru MIYAGUNI <gongo@cr.ie.u-ryukyu.ac.jp>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
986
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
987 * add: kernel/main.cc
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
988 main loop をユーザに書かせるのはめんどくさいので、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
989 ライブラリ側で main() を書く事にしました。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
990 ユーザ側では main() の代わりに cerium_main() を
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
991 書かせるようにしています。引数は main() のをそのまま渡す感じで。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
992
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
993 Cerium 標準のオプションとして、-cpu は付けました。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
994 ゲームフレームワークってことで、-width とか -height は
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
995 標準でつけてもいいかなって話なので、これは後日実装。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
996 標準オプションで受け取った値にアクセスする方法も考えないと。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
997 manager->cpu とか manager->width とかは安易か?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
998
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
999 * add: Cell/PpeScheduler.cc
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1000 MainScheduler をそのまま使うと、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1001 PPE のタスクで mainMem_alloc で確保した領域がアライメント
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1002 取れていないため、SPE で使うと余裕でバスエラー。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1003
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1004 Scheduler->allocate で poxis_memalign で使えるように。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1005
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1006 * move: kernel/schedule/FifoDmaManager.cc, MainScheduler.cc
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1007 kernel というよりは Fifo バージョン用なので Fifo/ に移動。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1008
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1009
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1010 2008-10-21 Wataru MIYAGUNI <gongo@cr.ie.u-ryukyu.ac.jp>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1011
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1012 * kernel/ppe/TaskManagerImpl.cc (TaskManagerImpl::systask_init): fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1013 下に述べてる SysTask_Finish を regist する部分
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1014
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1015 (TaskManagerImpl::spawn_task):
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1016
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1017 SysTask_Finish に対して、タスクが spawn されるたびに
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1018 wait_for を掛けて、待つようにしている。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1019
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1020 * add: kernel/systask/
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1021 久々の更新乙
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1022
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1023 プログラム動かすとき、タスクが SPE だけで、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1024 PPE で待ってるタスクが無いとそのままプログラムが素通りするってことで
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1025 今まではユーザに、全てのタスクを待たせるタスクってのを書かせてた。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1026 まあもちろんめんどくさいので、いい加減追加した。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1027
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1028 system task っつーことで、spawn された全てのタスクを待つ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1029 SysTask_Finish を作った。これでいちいち task_finish とか作らなくておk
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1030
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1031 2008-08-10 Wataru MIYAGUNI <gongo@cr.ie.u-ryukyu.ac.jp>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1032
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1033 * thinking: add_update() ?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1034 現在、タスクは input/output があるわけですよ。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1035 で、例えば
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1036
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1037 - 入力データ : PolygoPpack
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1038 - 出力データ : SpanPack
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1039
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1040 ってなわけですが、別のタスクで
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1041
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1042 - 入力データ : SceneGraphPack (更新前)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1043 - 出力データ : SceneGraphPack (更新後)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1044
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1045 ってのがある。つまり Update なわけだ。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1046 今のところ、同じアドレスを add_inData, add_outData に設定して
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1047 タスク内で memcpy(wbuf, rbuf, sizeof(SceneGraphPack) とかしてる。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1048 まあそれはそれでいいのかわるいのか。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1049
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1050 in/out だけじゃなくて update も必要?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1051
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1052 2008-08-08 Wataru MIYAGUNI <gongo@cr.ie.u-ryukyu.ac.jp>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1053
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1054 * add: ../include/TaskManager/base.h
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1055 通常の new/delete では、RTTI とか 例外処理とかで
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1056 -fno-exceptions や -fno-rtti をコンパイルオプションにしても
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1057 効かなかったんだけど、operator new/delete をオーバーライドして
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1058 中身を普通の malloc/free にすると、上の処理が無くなるので
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1059 オプションが効くようになる。結果コードサイズも減ると。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1060 SPE の場合、70〜80KBは減りました。使わない手は無い。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1061 つーことで、一応動いてる。。。といいたけど動いてないorz
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1062 最適化 (-O2 とか -O9) をかけると止まる。SPE 上でね。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1063 FIFO バージョンだと問題ない。SPEだとだめだ。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1064 今わかってる、止まる場所は Scheduler::run() 内の
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1065
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1066 task3->write();
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1067
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1068 だ。task1~3までのnewは(多分)できているんだけど
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1069 そこを呼び出すと SPE 自体が終了してしまう。謎だ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1070
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1071 一応、俺作の new/delete は base.h に定義してあって、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1072 通常の API との切り替えは、base.h にある
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1073 BASE_NEW_DELETE を切り替えるだけでおk。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1074 全てのファイルではなく、現在は SPE で使いそうなところだけやってます。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1075 いずれは全部やったほうがいいかな〜
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1076
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1077 ライブラリ側の最適化はアウトだけど、ユーザ側では問題ないです。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1078 なので、今は
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1079
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1080 ライブラリ側(libspemanager.a)は最適化無し(-O0)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1081 ユーザ側(SchedTaskを継承したやつね)は最適化しても無問題 (-O9)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1082
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1083 でっす。ここらへん完璧なれば、だいぶ楽になる。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1084 つーかもう C++ やめ(ry
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1085
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1086
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1087 2008-08-07 Wataru MIYAGUNI <gongo@cr.ie.u-ryukyu.ac.jp>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1088
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1089 * change: mainMem_set -> mainMem_wait
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1090 allocate を待つんだから、なんとなく wait かな。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1091 あと、ユーザも使えるので、wait の方がわかりやすいと思ったり。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1092
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1093 2008-08-05 Wataru MIYAGUNI <gongo@cr.ie.u-ryukyu.ac.jp>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1094
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1095 * add: mainMem_alloc, mainMem_set, mainMem_get
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1096 SPE から メインメモリの領域に対して allocate できないと
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1097 SceneGraphの生成やら、結構クリティカルな処理を
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1098 全部 PPE でやらないといけなくなるってことで実装しました。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1099
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1100 流れとして
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1101
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1102 1 タスク中に、mainMem(id,size) を実行する事で、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1103 メインメモリに対して allocate のコマンドを発行。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1104
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1105 1.1 Scheduler から PPE に対して
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1106 - commmand (MY_SPE_COMMAND_MALLOC)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1107 - id (PPEから戻ってくるコマンドに必要)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1108 - size
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1109 を mailbox で送る
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1110
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1111 1.2 確保した領域はそのタスク内では取得できない(NULL が来ます)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1112 正確には、返事の mail をここでは read してないから
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1113
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1114 2. PPE では、受信した mail が MY_SPE_COMMAND_MALLOC だったら
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1115 次に来る mail が id と size であるとして read を行い、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1116 size を元に allocate する。allocate が完了したら
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1117 - id
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1118 - allocate された領域のアドレス
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1119 を SPE に mail で送る
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1120
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1121 3. SPE Scheduler では、SchedTaskList::read で、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1122 一つ前の TaskList 中で実行された mainMem_alloc の数だけ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1123 PPE からのメールを待つ。mainMem_set() の処理です。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1124
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1125 4. create_task されたタスク内で mainMem_get(id) とすると
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1126 allocate したメインメモリ領域のアドレスが得られる。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1127
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1128 こんな感じ。結構ださい実装なので、もうちょいスマートにいきたいよね。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1129 例題は Game_project/student/master/gongo/MainMemMalloc にあります。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1130 README にもおんなじこと書いてます。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1131
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1132 * memo: The number of available entries of Inbound/Outbound Mailbox
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1133 Outbound (SPE -> PPE) のmailboxデータキュー保持数は
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1134
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1135 /* SPE プログラム中 */
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1136 #include <spu_mfcio.h>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1137 spu_stat_out_mbox(void);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1138
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1139 で調べる事が出来る。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1140
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1141 --- 記述例 ---
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1142 printf("Available capacity of SPU Outbound Mailbox\n");
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1143 printf(" %d\n", spu_stat_out_mbox());
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1144
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1145 --- 実行結果 --
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1146 Available capacity of SPU Outbound Mailbox
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1147 1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1148
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1149 Inbound (PPE -> SPE) の mailbox データキュー保持数は
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1150
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1151 /* PPE プログラム中 */
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1152 #include <libspe2.h>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1153 spe_in_mbox_status(spe_context_ptr_t);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1154
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1155 で調べられます。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1156
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1157 --- 記述例 ---
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1158 printf("the number of available entries = %d\n",
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
1159 spe_in_mbox_status(spe_ctx));
276
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1160
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1161 --- 実行結果 ---
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1162 the number of available entries = 4
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1163
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1164 Outbound が少ないなー。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1165 In/Out 共に、キューが MAX の場合、減るまで wait 掛かるんだよな。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1166 それがどこまで影響あるかは実際にやらないと、ってことか。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1167
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1168 * fix: ファイル名の変更 (*.cpp -> *.cc)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1169 前々から先生に直せ言われてたので。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1170
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1171 cvs のファイル名を変える方法は簡単に二つ(てかこれだけ?)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1172
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1173 1. cvs rm hoge.cpp; cvs add hoge.cc
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1174 2. リポジトリを直接変更 mv hoge.cpp,v hoge.cc,v
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1175
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1176 めんどくさかったので 2 でやりました。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1177 Attic (削除されたファイルがあるリポジトリディレクトリ?)にも
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1178 同じ処理を行えば、tag で update かけてもちゃんと反映されました。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1179
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1180 2008-07-22 Wataru MIYAGUNI <gongo@cr.ie.u-ryukyu.ac.jp>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1181
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1182 * tag: open-campus-2008
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1183 次やる事は、Cell/spe 以下のコードサイズを減らすために
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1184 new/delete を消して malloc/free で統一する事。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1185 placement_new ってのを使えば、コンストラクタは呼べて
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1186 new ほどサイズ圧迫しないからこれにしようかな。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1187 逆の placement_delete ってのは自分で小細工しないと行けないらしい。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1188 まあ、これが旨く行けば 80KB ほど減るから。やるべきだろう。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1189
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1190 * Cell/spe/Scheduler.cpp (Scheduler::dma_load): アホなミスその2
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1191 自分で __scheduler->dma_store をやってもデータが送れない。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1192 そんな馬鹿な。つーことでいろいろ調べてもわからない。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1193 アドレスやサイズが違うのかと調べても違う。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1194 こうなったらっつーことでライブラリに printf 加えてみたら表示されない
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1195 あれ、おかしいな。たしかに Connector::dma_store に加えたはz・・
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1196
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1197 Scheduler::dma_store(void *buf, uint32 addr, uint32 size, uint32 mask)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1198 {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1199 <<<
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1200 connector->dma_load(buf, addr, size, mask);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1201 ========
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1202 connector->dma_store(buf, addr, size, mask);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1203 >>>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1204 }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1205
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1206 なぜ store から load を呼んでるのか不思議だった。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1207 Scheduler::dma_load をコピペして dma_store にした後、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1208 中の connector->dma_load を変えなかったってオチだな。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1209 下のミスと合わせて5,6時間費やしたよHAHAHA
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1210
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1211 * Cell/spe/SchedTask.cpp (SchedTask::exec): アホなミスその1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1212 Test/test_render で、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1213 SpanPack のデータが時々壊れてる感じがする。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1214 送る前までは正常だから生成に問題は無いはず。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1215 つーことでいろいろ調べたがわからず。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1216 printf デバッグすると動く不思議
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1217 なんだ、printf で遅くなったらできるってことは
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1218 DMA が完了する前に SchedTask::run にきてんのか?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1219 いやいや、そんなばかな。だってちゃんと wait し・・・
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1220
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1221 <<<
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1222 ============
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1223 __scheduler->dma_wait(DMA_READ);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1224 >>>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1225
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1226 はいはい wait し忘れ wait し忘れ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1227
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1228 2008-07-16 Wataru MIYAGUNI <gongo@cr.ie.u-ryukyu.ac.jp>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1229
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1230 * memo: if 文消した成果2 & memcpy するかしないかか
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1231 Renew Task では、inListData,outListData は新たに allocate して
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1232 使っているので、SchedTask にそって実行する場合、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1233
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1234 __scheduler->dma_load(__inListData, (uint32)__task->inData,
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
1235 sizeof(ListData), DMA_READ_IN_LIST);
276
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1236 __scheduler->dma_load(__outListData, (uint32)__task->outData,
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
1237 sizeof(ListData), DMA_READ_OUT_LIST);
276
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1238
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1239 の代わりに
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1240
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
1241 memcpy(__inListData, __task->inData, sizeof(ListData));
276
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1242 memcpy(__outListData, __task->outData, sizeof(ListData));
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1243 free(__task->inData);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1244 free(__task->outData);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1245
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1246 もしくは
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1247
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1248 __inListData = __task->inData;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1249 __outListData = __task->outData;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1250 (__task->inData と __task->outData は Destructor で free する)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1251
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1252 とやっています。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1253 memcpy が重いのはわかるんですが、下の方法では
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1254 Destructor で if 文使って free() しているわけです(このタスクが Renew か否か)。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1255 ですので、どっちが早いか試してみた。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1256
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1257 /**
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1258 * memcpy() して、すぐ free() する version
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1259 */
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1260 void
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1261 test_cpy(int flag, int *src)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1262 {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1263 if (flag) {
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
1264 memcpy(data, src, sizeof(int)*length);
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
1265 free(src);
276
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1266 }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1267 }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1268
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1269 /**
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1270 * 参照で扱って、最後に free() する version
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1271 */
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1272 void
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1273 test_nocpy(int flag, int *src)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1274 {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1275 if (flag) {
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
1276 data = src;
276
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1277 }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1278
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1279 // この部分を SchedTask::~SchedTask() と
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1280 // 思ってください
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1281 if (flag) {
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
1282 free(data);
276
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1283 }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1284 }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1285
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1286
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1287 これらの関数を10000回ループしました。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1288 src の allocate は関数の外でやっており、その部分は実行時間に含まれてません
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1289 flag は 1 or 0 の繰り返しです。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1290
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1291 - 実行結果 (1)
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
1292 :no copy
276
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1293 SPE time by SPU Decrementer: 0.035500
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1294 :copy
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1295 SPE time by SPU Decrementer: 0.057500
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1296
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1297 memcpy しないほうが速いらしいです。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1298 ためしに、flag を ずっと 1 にしてみました。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1299
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1300 - 実行結果 (2)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1301 :no copy
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1302 SPE time by SPU Decrementer: 0.055250
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1303 :copy
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1304 SPE time by SPU Decrementer: 0.053389
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1305
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1306 今度は copy するほうが早いという不思議。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1307 でもまあ、ずっと 1 ってことはないと思いますし、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1308 むしろ flag == 1 になるほうが少ないと思うので、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1309 no_copy version でやったほうがいいかな。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1310
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1311 おまけで、実行結果 (1) の環境で、test_nocpy を変えてみた
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1312
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1313 void
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1314 test_nocpy(int flag, int *src)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1315 {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1316 if (flag) {
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
1317 data = src;
276
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1318 }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1319
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1320 free((void*)(flag*(int)data));
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1321 }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1322
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1323 キャストしまくりですが、単純に free(flag*data) だと
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1324 「invalid operands of types 'int' and 'int*' to binary 'operator*'」って
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1325 出るので、キャストで逃げました。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1326 で、実行結果なんですが
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1327
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1328 - 実行結果 (3)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1329 :no copy
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1330 SPE time by SPU Decrementer: 0.040375
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1331 :copy
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1332 SPE time by SPU Decrementer: 0.059500
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1333
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1334 遅くなってーら。キャストが悪いのか。乗算が重いのか。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1335 branch が無い? spe の if 文と対決しても遅いのかー。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1336 例題が間違ってる可能性もあるが・・・ if 文は使っていくかなー
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1337
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1338
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1339 2008-07-10 Wataru MIYAGUNI <gongo@cr.ie.u-ryukyu.ac.jp>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1340
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1341 * fix: TaskGroup->group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1342 今まで slist っていう、ライブラリの単方向リスト構造体?を
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1343 使ってたんだけど、まあいろいろあって、TaskQueue を使うようにしました。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1344 最初からこれにするつもりではあったけどね。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1345 RenewTask や static_alloc とかの実装を優先したので
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1346 ライブラリを使いました。といっても、書いてみると
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1347 それほと記述量無いので最初から行っても良かったかなーと思ったり。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1348
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1349 そんなわけで動いてます。つーか、やめてよかったよ slist。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1350 slist を使ったやつと使ってない奴のファイルサイズがやばい
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1351
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1352 -rwxr-xr-x 1 gongo gongo 120672 2008-07-10 14:29 spe-main*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1353 -rwxr-xr-x 1 gongo gongo 180368 2008-07-10 13:40 spe-main.bak*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1354
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1355 .bak が slist を使ってる、上のやつが使ってないversionです。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1356 まさか 60k も違ってくるとは思わなかった。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1357 SPE LS の容量が 256k と考えると、かなりの痛手だったよ。アブねえ。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1358 インラインとか最適化掛けまくってて、コード量が増えてるからかなー。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1359
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1360 「SPU C/C++ 言語拡張」とかで、C++ のライブラリがSPUでも使えるよ〜
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1361 って書いてたから入れてみたんだけど。罠だったか。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1362 おそらく SPU に移植した側の人も「サイズが増えるのを覚悟で使え」って
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1363 ことだったんだろう。なかったら文句言う人も居そうだし。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1364
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1365 2008-07-09 Wataru MIYAGUNI <gongo@cr.ie.u-ryukyu.ac.jp>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1366
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1367 * fix: TaskGroup での task の扱い
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1368 下にもかいているけど (直したいところ (1))
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1369 TaskGroup->group が持つ要素は int で持ってて、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1370 それらは、同じく TaskGroup が持つ cur_id をインクリメントしていって、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1371 それを要素としていました。つまり、TaskGroup->group は、厳密にいえば
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1372 「どの Task があるか」ではなく、「いくつのタスクがあるか」を
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1373 あらわしているだけでした。slist を使う意味もなかったわけです。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1374
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1375 そこで、SchedTask が持つ、RenewTaskList の解放のタイミングを
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1376 RenewTaskList の一番最後のタスクが delete されるときにしました。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1377 これによって、アドレスが被ることがなくなったので
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1378 TaskGroup->group の要素を TaskPtr にできました。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1379 この方が、TaskGroup の意味的にもしっくりくるのでよかばってん。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1380
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1381 * memo: if 文消した成果
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1382
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1383 #ifdef FREE_TEST
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1384 free((ListDataPtr)(__flag_renewTask*(int)(__inListData)));
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1385 free((ListDataPtr)(__flag_renewTask*(int)(__outListData)));
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1386 free((TaskListPtr)(__flag_renewTask*(int)(__list)));
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1387 #else
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1388 if (__flag_renewTask) {
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
1389 free(__inListData);
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
1390 free(__outListData);
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
1391 free(__list);
276
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1392 }
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
1393 #endif
276
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1394
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1395 こんな感じで、いくつかか if 文を消してみた。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1396 そして、PPE側の main.cc で gettimeofday で計測してみた (各10回)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1397
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1398
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1399 - if 文消した場合
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1400 time: 1.222000
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1401 time: 1.230000
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1402 time: 1.241000
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1403 time: 1.230000
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1404 time: 1.223000
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1405 time: 1.257000
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1406 time: 1.219000
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1407 time: 1.228000
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1408 time: 1.220000
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1409 time: 1.229000
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1410 avarage: 1.2299
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1411
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1412 - if 文消してない場合
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1413 time: 1.225000
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1414 time: 1.215000
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1415 time: 1.229000
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1416 time: 1.218000
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1417 time: 1.223000
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1418 time: 1.214000
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1419 time: 1.225000
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1420 time: 1.215000
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1421 time: 1.224000
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1422 time: 1.219000
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1423 avarage: 1.2207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1424
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1425 あまり変わらな(ryむしr(ry
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1426 使い方がまずいのか、もっとと回数を増やせば変わってくるのかね。。。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1427 PPE でなく、 SPE のほうで計測すべきなのかなーとか思ったり思わなかったり。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1428
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1429
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1430 2008-07-08 Wataru MIYAGUNI <gongo@cr.ie.u-ryukyu.ac.jp>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1431
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1432 * add: Renew Task の wait
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1433 Renew Task は今まで「生成されたやつ全部待つ」だったのを
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1434
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1435 void SchedTask::wait_task(TaskPtr task);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1436
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1437 ってのを作って、任意のタスクに wait 掛けれるようにしました。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1438 名前が思いつかなかったお。。。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1439 動作確認済み・・・だと思います。例題・・・誰か例題を!(俺が
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1440
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1441
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1442 * fix: SchedTask の変数名
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1443 ユーザが継承して使う SchedTask クラスなんですが、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1444 今まで変数は list, task などを使ってました。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1445 が、これは一般に使われやすい変数名です。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1446 その証拠に、俺も例題書いている時に task って名前が被ってました。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1447
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1448 run(r, w)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1449 {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1450 ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1451
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1452 //TaskPtr task; <= 宣言してないのにエラーにならない
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1453 task = create_task(TASK_EXEC);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1454 }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1455
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1456 ってコードを書いてたせいで、Scheduler が使用する task を
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1457 上書きしたせいでバグってました。ってことがありました。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1458 上のように、宣言してないのに普通に通ってるのを気づきませんでした。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1459 今のところ変数名は __task とか __list にしてあります。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1460 private にしてもいいんだけどさ。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1461
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1462
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1463 2008-07-07 Wataru MIYAGUNI <gongo@cr.ie.u-ryukyu.ac.jp>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1464
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1465 * fix: if 文を無くしてみた
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1466 下の方に 「if () が多い」って書きましたが、いろいろ小細工を。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1467 SchedTask をやってみました。例えば
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1468
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1469 if (cmd != 0) {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1470 delete taskGroup;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1471 scheduler->mail_write(cmd);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1472 }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1473
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1474 ってのがありました。cmd ってのは taskGroup->status で
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1475 もし cmd が 0 でなければ、taskGroup はすでに空っぽで
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1476 待つべきタスクはすべて終了したので、taskGroup を delete し、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1477 mailbox で cmd を PPE に送ります(cmd にはすでに送るべきコマンドがある)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1478 でまあ、これくらいなら
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1479
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1480 delete (int*)((cmd != 0)*(int)(taskGroup));
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1481 scheduler->mail_write(cmd);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1482
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1483 ぐらいに直せました。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1484 delete や free では NULL を渡しても何もしない(?)って動作なので
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1485 これでも問題ない。つまり、cmd == 0 なら、taskGroup を
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1486 解放する必要は無いので NULL が delete に渡されるわけです
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1487 int* でキャストしてるのは、そのまま 0 を渡すと、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1488 「int型を delete するのはできない」的なエラーがでるからです。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1489 。。。だったら int* じゃなくて TaskGroupPtr じゃね?とか思った今。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1490
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1491 あと、PPE 側で 「mail == 0 なら NOP」 的な処理を入れました。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1492 これによって、cmd が 0 かその他で if を書く必要がなくなりました。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1493 問題があるとすれば、 SPE -> PPE の mailbox の queue の長さ。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1494 NOP コマンドを送って、queue の制限に引っかかって
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1495 mail_write が止まるんじゃないかなーとか少し心配です。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1496 ここらへんは optimize の時間に考える事かな。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1497 どうせ PPE では mail しか読んでないし、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1498 そこまで queue が埋まる事は無いと思いたい。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1499
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1500
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1501
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1502 あとはこんな感じかな
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1503
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1504 #if 1 // fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1505 free((void*)(flag_renewTask*(int)(list)));
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1506 #else
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1507 if (flag_renewTask) {
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
1508 free(list);
276
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1509 }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1510 #endif
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1511
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1512 動いてるのは確認したし、gdb で x/20i とかしたら
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1513 branch 命令が減ってるのは確認した。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1514 まあ -O9 とかで最適化掛けるとどっちも同じになるけどな。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1515
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1516
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1517 * add (API): static_alloc, static_get, static_free
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1518 SchedTask 自身だけが持つ領域ではなく、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1519 SPE 上に複数のタスクが共有したい領域を作る
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1520 これは task::run() 内で使用する。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1521
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1522 - void* static_alloc(int id, int size);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1523 @param [id] 領域ID。現在は 0〜31 まで使用可能 (Scheduler.h で定義)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1524 @param [size] 領域のサイズ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1525 @return allocate した領域のポインタ。下の static_get の返り値と同じ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1526
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1527 - void* static_get(int id);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1528 @param [id] static_alloc で作った領域 ID。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1529 @return 領域のポインタ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1530
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1531 - void static_free(int id);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1532 @param [id] 解放したい領域の ID
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1533
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1534 こんな感じかなー。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1535 static_free はさすがにユーザに任せるだろう。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1536 static_free し忘れると SPE には致命的なので、ここはよく伝える必要有
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1537
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1538 例題は
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1539 cvs: firefly:Game_project/student/master/gongo/Static
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1540
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1541 まあ Renew と大体同じですけどね。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1542 int 型配列 data を共有にして、各タスクでインクリメントしてる
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1543
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1544 * TODO: TaskGroup の扱い
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1545 通常の Task では、task->self には
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1546 自分が終了した時に PPE に送るコマンド(自分自身)になりますが、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1547 タスク中に生成されたタスク(もう何度も書くのめんどいんで Renew で)では
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1548 task->self は、task を待っている TaskGroup を表します。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1549
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1550 self という名前で意味が違うのでこういうことはやめたいんだが。。。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1551 といいながらやめないのが(ry
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1552
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1553 * memo:
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1554 下の 直したいところ (1) ってやつがよくわからんので、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1555 現在の状況だけ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1556
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1557 scheduler->add_groupTask() をするたびに
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1558
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1559 group.insert_front(cur_id++);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1560
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1561 されます。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1562 そして、scheduler->remove_groupTask() されると
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1563
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1564 group.remove(--cur_id);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1565
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1566 されます。要するに、どのタスクでも
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1567 cur_id だけが insert/remove されます。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1568 「どのタスクがあるか」ではなく「どれだけのタスクがあるか」ですね。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1569 実際にはしっかりと TaskPtr で管理したかったんですが、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1570 下にも書いたアドレスが被る云々の問題でそれもできず。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1571 やり方はあると思うんですが。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1572
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1573 うーん、うまく説明できないな。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1574
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1575 * tag: v20080707
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1576 タスク内タスク生成を作りました。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1577
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1578 [TODO]
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1579 SPE 上で領域を共有する API の
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1580
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1581 - static_alloc
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1582 - static_get
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1583 - static_free
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1584
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1585 を速攻で実装しよう。。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1586
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1587 * add: タスク内タスク生成
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1588 一応できたんですが、直したい。。。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1589 仕様としては
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1590
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1591 - 現在のタスク(T1) の中でタスクを生成したとする (Tc = T2, T3, ...)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1592 - 本来、T1 が終了次第、T1 が終わった事を PPE に伝えるが、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1593 ここでは、Tc が全て終わってから、T1 の終了を PPE に伝える
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1594 - Tc 内で再びタスクが生成されても(Tcc)、Tcc が終わってから T1 を(ry
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1595
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1596 現在は、生成したタスクすべてに対して wait_for をかけてる感じ。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1597 しかし、例えば Frame Buffer に書き込む時は待つ必要ない(はず)なので
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1598 タスク毎に wait_for を選べるようにした方がいいだろう。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1599
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1600 __ 例題
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1601 cvs firefly:Game_project/student/master/gongo/Renew
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1602
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1603 にあります。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1604 もうちょいちゃんとした例題が欲しいところです。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1605
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1606
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1607 __ 直したいところ (1)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1608
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1609 現在、Tc を管理する構造体として、TaskGroup を使ってます
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1610
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1611 class TaskGroup {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1612 unsigned int command; // T1 が PPE に送るコマンド
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1613 __gnu_cxx::slist<int> group; // Tc がある Linked List
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1614
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1615 // function は省略
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1616 };
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1617
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1618 slist じゃなくて、TaskQueue みたいに自分で作っても良かったんだけど。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1619 group.empty() == true になったら、command を PPE に送るって感じです。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1620
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1621 で、slist が持つデータが TaskPtr じゃなくて int の理由。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1622 まあいろいろあるんだけど(何)、アドレスが重複してしまうことです。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1623 最初は、create_task で得られた TaskPtr をキーとして使うつもりだったけど
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1624 その TaskPtr は TaskList から取った物で (&list->takss[index] みたいな)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1625 なんでそれじゃだめなのか。buff_taskList[2] (Scheduler.cpp 参照) を
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1626 使うと、交互に使用するのでアドレスは被る。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1627 新たに allocate すれば問題は無いが (t1とする)、SPE の LS の問題で
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1628 使わなくなった TaskList は free していかないといけない。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1629 で、free -> 再び allocate したとき (t2とする)、t1 と t2 の
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1630 アドレスが被ることがあった。当然 TaskPtr も被ると。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1631 だから、アドレスではなく、TaskGorup が持つ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1632 unsigned int cur_id を使う事にしました。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1633
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1634 なんかここまで自分で書いてて、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1635 なんで出来ないのかまだわからんくなってきた。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1636
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1637 ので試しに戻してみたら * で * き * ま * し * た *
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1638 わけわからん。まあ勘違いだったのか、いろいろ別のところを直してるうちに
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1639 知らず知らずミスってたところも治ってたのか。まあいいか。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1640
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1641 と思っていろいろ試したらまた動かなくなった。。もうだめぽ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1642 とりあえず、また unsigned int に戻しました。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1643 今のところ、0 <= cur_id <= 0xffff (65535) の範囲のキーを使うように。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1644
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1645
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1646 __ 直したいところ (2)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1647 if 文が多い。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1648 今は、「通常の Task」「タスク内で生成されたタスク」で挙動が違います。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1649 例えば
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1650
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1651 - SPE で allocate されたデータを使うので、通常 DMA を使うところは
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1652 アドレス参照や memcpy を使う
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1653 - TaskGroup を、上記の Tc や Tcc へ引き継がせるところ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1654
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1655 なので、flag_renewTask とかいう変数で、ほぼ if 文 で書いてます。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1656 SPE でこの書き方はかなりまずい気がします。良い書き方はないものか。。。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1657 「通常の(ry」「タスク内(ry」で新たにインスタンスを作るってのも
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1658 考えはしましたが (SchedTask = 通常、SchedRenewTask = タスク内(ry とか)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1659 これだと ユーザー側も この二つを選んでやることになります。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1660 「このタスクは SchedRenewTask 、このタスクは通常」とかやるのは
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1661 かなりめんどくさいと思う。だからライブラリ側で分けるべきか。。。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1662 多重継承とかってこんなとき役に立つん?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1663
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1664
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1665 2008-07-03 Wataru MIYAGUNI <gongo@cr.ie.u-ryukyu.ac.jp>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1666
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1667 * TODO:
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1668 - add_param で渡せるパラメータの数を増やす。15もあればいいんじゃね?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1669 - 今の実装では、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1670
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1671 1. PPE でタスク(T1)が生成される
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1672 2. SPE で T1 が実行される
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1673 3. T1 が終わった事を PPE に mailbox で送る
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1674 送る情報は T1 自身。(PPE で生成された時のアドレス)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1675
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1676 なわけです。しかし、もし T1 から新たにタスクが生成された時はどうするか
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1677 仮に T1 から T2, T3, T4 が作られたとする。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1678 このとき、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1679
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1680 1. T1 が終わった時点で、T1 から終了コマンドを送る
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1681 2. T1 だけでなく、T1 内で作られた T2, T3, T4 が終わってから
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1682 終了コマンドを送る
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1683
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1684 の二つが考えられる。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1685 PPE 側では T1 しか認識していないため、この判定は SPE 内でやることになる
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1686 必要な処理かと言われると微妙だが、欲しくなるのは間違いない。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1687 つーことで今これを実装中です。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1688
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1689
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1690 * tag: v20080703
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1691 - タスクに 32 bits パラメータを渡す add_param を実装(現在は3個まで)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1692 - SPE 内部でタスク生成ができるようになった
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1693
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1694 * add (API): SPE内部での create_task
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1695 今まで、SPE ではタスクを生成する事は出来ず、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1696 PPE から送られてくるタスクを実行するだけでした。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1697 それだと不便だってことで SPE 内部でもできるようにしました。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1698 方法はPPEでやるのと同じく
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1699
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1700 task = create_task(TASK_EXEC);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1701 task->add_inData(buff, sizeof(Buff));
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1702 task->add_param(data);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1703
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1704 みたいな感じでいいです。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1705 spawn() や wait_for() は実装していません。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1706 SPE 内部で生成するタスク同士で依存関係作るのが
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1707 結構めんどくさいからです。spawn() も、しなくても勝手に実行します。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1708 PPE とそろえる意味で作ってもいいんだけどね。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1709 そのためには SPE にも TaskManager が必要になってくるなー。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1710
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1711
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1712 2008-06-24 Wataru MIYAGUNI <gongo@cr.ie.u-ryukyu.ac.jp>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1713
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1714 * add (API): add_param, get_param
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1715 DMA で送れないけど、必要になってくる 4 バイトの情報があるとして
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1716 それは今までは
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1717
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1718 add_inData(param, 0);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1719
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1720 とかして、「サイズ == 0 なら 32 bit のデータ」としていたけど
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1721 それは余りにも変なので(関数の意味的にもおかしい)ので、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1722
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1723 add_param(parameter);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1724
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1725 ってのを追加しました。タスク側では
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1726
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1727 get_param(index);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1728
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1729 とかします。index は、add_param を呼び出した順番で決まります
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1730
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1731 add_param(x);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1732 add_param(y);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1733 add_param(z);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1734
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1735 とあるとき、タスク側では
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1736
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1737 int x = get_param(0);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1738 int z = get_param(2);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1739
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1740 とします。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1741 今のところ parameter は 3つしか送れないことになってますが
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1742 後ほど、上限をあげます。15くらいあれば余裕だと思うんだがどうだい?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1743 今は、SPE でのタスクの生成のルーチンを書くために、最低限な部分だけ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1744 ってことで 3 つにしてます。それが出来次第、これもやります。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1745
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1746
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1747 2008-06-12 Wataru MIYAGUNI <gongo@cr.ie.u-ryukyu.ac.jp>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1748
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1749 * Cell/CellTaskManagerImpl.cpp (CellTaskManagerImpl::set_runTaskList):
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1750 アホなミス(ry
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1751
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1752 「list が持つ TASK_MAX_SIZE を超えると、次の list へ next を」っていう
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1753 前回直したところがまたミスっててだな。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1754 簡単に言うと
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1755
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1756 TaskPtr task = &list[list->length++];
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1757 [task の初期化]
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1758
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1759 if (list->length > TASK_MAX_SIZE) {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1760 [newList 生成]
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1761 newList = append(newList, topList[speid]);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1762 topList[speid] = newList;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1763 }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1764
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1765 ってやってたわけ。これだと、toplist[speid] に
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1766 length = 0 の list が来る可能性があると。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1767 で、spe に TaskList を送る条件は
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1768
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1769 1. taskList[speid]->length >= 1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1770 2. speid が次の TaskList を待っている状態
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1771
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1772 で、1 の条件に触れてしまい、TaskList が送られなくなって
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1773 プログラムが終了しないと。アホですね〜
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1774 上の if 文を &list[list->length++]; の前に持って行くだけでおk。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1775
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1776 2008-06-10 Wataru MIYAGUNI <gongo@cr.ie.u-ryukyu.ac.jp>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1777
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1778 * Cell/CellTaskManagerImpl.cpp (CellTaskManagerImpl::set_runTaskList):
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1779 アホなミスしてました。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1780 list が持つ TASK_MAX_SIZE を超えると、次の list へ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1781 next を繋げるはずなんだけど、speTaskList_bg[speid] とか読む時に
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1782 ちゃんと繋げられてなかったというかなんというか。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1783 簡単に言うと、タスク多くなると落ち(ry
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1784
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1785 * add (API): set_post
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1786
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
1787 create_task(id, 0);
276
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1788
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1789 とかわざわざ 0 付けるのもアレなので、もうそれように
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1790
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1791 task->set_post(func)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1792
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1793 を追加しました。func は void (*func)(void) です。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1794 せっかくだから、引数に void* とか付けてもいいんじゃないかと。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1795
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1796
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1797 * fix (API): ListDMA API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1798 タスク側で、ListDMA で指定したデータの取り方
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1799
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1800 run(rbuf, wbuf) として
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1801
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1802 // index は add_inData や add_outData で指定した(順番-1)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1803 get_input(rbuf, index);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1804 get_input(wbuf, index);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1805
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1806 返り値は void* なので、malloc っぽくキャストしてください。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1807 あと、4バイト以下のデータを送りたい場合、main で
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1808
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1809 add_inData(data, 0)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1810
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1811 と、アドレスは送りたいデータを則値で、サイズは 0 で指定するとおk。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1812 get_input で int なりなんなりでキャストすればいいじゃない!
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1813 例題は
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1814
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1815 Game_project/student/master/gongo/arr_cal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1816
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1817 で複数データ扱ってたり4バイト送ってたりしてます。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1818
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1819
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1820 * tag: v20080610
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1821 前回との違いは
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1822
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1823 - ListDMA の導入
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1824 - 凡ミスfix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1825
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1826 とかかな。何気にここには ListDMA の API 書いてなかったな。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1827
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1828 - task->add_inData(addr, size); // input
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1829 - task->add_outData(addr, size); // output
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1830
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1831 これで Input/Output のデータ領域を指定可能。複数できます。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1832 詳しくはいずれドキュメントに書く予定だが、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1833
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1834 - addr は 16 バイトアライメントに取れてないと行けない
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1835 - size は 16 バイト倍数
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1836
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1837 ってのが最低条件。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1838 16 バイト未満のデータを送りたいとき(整数を2,3個とか)は考え中。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1839 addr に直接渡すって手法はできるとわかってるので、それでもいいかな。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1840 まあいろいろ問題はありますが、少しはできたんじゃないかな。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1841
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1842 次からは SPE 内でのタスク生成(再起動?)を書く予定
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1843
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1844 * Cell/CellTaskManagerImpl.cpp (CellTaskManagerImpl::set_runTaskList):
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1845 if (speid > machineNum) {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1846 speid %= MAX_USE_SPE_NUM;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1847 }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1848
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1849 から
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1850
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1851 if (speid >= machineNum) {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1852 speid %= machineNum;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1853 }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1854
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1855 に。なんという凡ミス
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1856
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1857 * Cell/spe/CellDmaManager.cpp (CellDmaManager::dma_loadList): fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1858 ListData が持つ ListElement は
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1859
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1860 class ListElement {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1861 public:
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1862 int size;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1863 unsigned int addr;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1864 };
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1865
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1866 というデータ構造なわけだが、これは、spu_mfcio.h が持っていて
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1867 且つ List DMA で使用される
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1868
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1869 typedef struct mfc_list_element {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1870 uint64_t notify : 1; /** Stall-and-notify bit */
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1871 uint64_t reserved : 16;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1872 uint64_t size : 15; /** Transfer size */
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1873 uint64_t eal : 32; /** Lower word of effective address */
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1874 } mfc_list_element_t;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1875
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1876 と同じである。notify と reserved は 0 となる (ストールは今は
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1877 考えていない)ので、結局は uint が 2 つの 8 バイト のデータ構造であれば
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1878 そのまま mfc_getl とか mfc_putl に遅れるわけである。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1879 今までは mfc_list_element_t 構造体に for 文でいちいち代入してたが
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1880 まあそれはなくなったっつーことで。dma_storeList もね。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1881
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1882
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1883 2008-05-30 Wataru MIYAGUNI <gongo@cr.ie.u-ryukyu.ac.jp>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1884
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1885 * change (API): TaskManager Memory Allocate
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1886 manager->cerium_malloc(&buff, DEFAULT_ALIGNMENT, sizeof(Data))
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1887
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1888 から
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1889
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1890 buff = (Data*)manager->malloc(sizeof(Data));
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1891
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1892 に変更しました。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1893 alignment の指定は全て TaskManager に埋め込んであります。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1894 記述は TaskManager.h に書いてあります。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1895
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1896 void* TaskManager::malloc(int size) {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1897 return m_impl->allocate(DEFAULT_ALIGNMENT, size);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1898 }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1899
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1900 2008-05-29 Wataru MIYAGUNI <gongo@cr.ie.u-ryukyu.ac.jp>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1901
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1902 * thinking: List DMA (4)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1903 Cell 版でも動いたのを確認。今、Cell 版で List DMA が動く条件は
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1904
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1905 1. List の各要素の転送サイズが 16 バイト倍数でなければならない
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1906 2. List の各要素の転送するデータのアドレスのアライメントを保証(16or128
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1907
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1908 2に関しては Cell の仕様なんでまあいいんだけど、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1909 1は、ドキュメント見る分には
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1910
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1911 - Cell Broadband Engine アーキテクチャ version 1.01 より
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1912 - 7.5.3 get list
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1913 > リスト・サイズ・パラメータは、このDMAコマンドの場合は
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1914 > 8バイトの倍数でなければならず、また、リスト・アドレス・パラメータは、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1915 > ローカルストレージの8バイト境界にアラインされなければなりません。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1916
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1917 って書いてるんだよな。int が 10 個の配列(40バイト) を送っても
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1918 見事に弾かれたんだよな。おのれバスエラーめ!
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1919 とりあえず、上の条件を満たせば行けました。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1920 送るデータのアロケートは
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1921
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1922 TaskManager::cerium_allocate(void **buff, int align, int size);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1923
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1924 ってのを作りました。使い方は別項目で。だいたい posix_memalign 準拠。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1925
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1926 動くのはいいんだけど、これだとユーザに全部任せる事になります。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1927 特に、配列をアロケートした後、その途中の部分をリストに入れたい時。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1928 その配列の要素のサイズが16倍数じゃないとそこでエラーがでると。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1929 それをユーザに全部任せるのは、まあいけないこともないけどさ。。。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1930
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1931
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1932 * Cell/CellTaskManagerImpl.cpp (CellTaskManagerImpl::mail_check): fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1933 CellTaskManager は FifoTaskManager のオブジェクトを
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1934 ppeManager という変数で持っていて、作業を別々に行っているわけで。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1935 だけど両方のオブジェクトがもつ waitTaskQueue は同じじゃないと
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1936 ならないので、最初は TaskQueuePtr * とかで渡して
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1937 共有してたわけだけど、よくよく考えると、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1938
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1939 - waitTaskQueue に task が append される時
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1940 CellTaskManager->append_waitTask()
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1941
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1942 - waitTaskQueue から task が remove されるとき(依存満たした時とか)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1943 FifoTaskManagerImpl->mail_check() 及び
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1944 CellTaskManagerImpl->mail_check() です。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1945
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1946 つまり、waitTaskQueue が共有されるのは mail_check だけなので、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1947 CellTaskManagerImpl の mail_check で
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1948
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1949 ppeManager->mail_check(mail_list, &waitTaskQueue)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1950
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1951 として、ここで waitTaskQueue を参照渡ししてます。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1952 ppeManager->mail_check で waitTaskQueue の整理が終わって
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1953 戻ってくる事には waitTaskQueue が更新されていると。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1954
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1955 なんか文章がおかしいですね。気になる人は俺に直でお願いします。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1956 要するに、ppe と spe のそれぞれの TaskManagerImpl で
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1957 waitTaskQueue の共有が上手くいったというわけです。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1958
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1959
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1960 2008-05-24 Wataru MIYAGUNI <gongo@cr.ie.u-ryukyu.ac.jp>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1961
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1962 * thinking: List DMA (3)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1963 現在実装中。Fifo 版では動いている模様。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1964 問題は Cell だよなー。考えないと行けない事がいくつか
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1965
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1966 - Input/Output データはアライメントされている?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1967 アライメントされていなくても、こっちでアドレスずらして
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1968 DMAしてずらして run() に渡して〜とかもできるんだけど
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1969 かなりめんどくさい。それに、In ならともかく、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1970 Out は変な領域に書き込みそうなので無理そう。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1971 これはもうユーザが、送るデータはすべて
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1972 Cerium_malloc 的なものを通したものだけ、っていう
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1973 制約にした方がいいかもしれない。てかそうなんだっけ。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1974
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1975 - 配列中のデータの指定
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1976 上の項目と少し関連があるんだが、例えば
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1977
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1978 int data[100]; // アライメントは取れてるとする
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1979
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1980 ってのがあって、そのなかの data[0]〜data[49]、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1981 data[50] 〜 最後まで送りたいとする。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1982 最初のやつは &data[0] のアドレスは 16 bytes アライメントだけど、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1983 &data[50] では、sizeof(int)*50 = おそらく 200 ずれて
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1984 16 bytes アライメントではなくなると。これだと DMA できない。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1985 ユーザがそこまで考えて、例えば data[32] から送る、とかでもいいけど。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1986 ライブラリ側で、少しは融通効くようにすべきかな。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1987 やるなら、アドレスずらして取って来て、ユーザが見るデータは
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1988 そのずらした分戻してから見せるって感じ。変な説明だが。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1989
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1990 うーん。今はとりあえず全てアライメント大丈夫な方向でやってみるか。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1991
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1992
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1993 2008-05-23 Wataru MIYAGUNI <gongo@cr.ie.u-ryukyu.ac.jp>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1994
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1995 * Cell/SpeThreads.cpp (SpeThreads::init): スレッドの生成
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1996 今まで作られてたスレッドは
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1997
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1998 - spe_context_run を実行するだけのスレッド (spe_thread_run)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1999 - 上のスレッドを呼び出し、終了を待つスレッド (frontend_thread_run)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2000
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2001 2番目に何の意味があるのかということだが、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2002 SPE 毎にスレッドを立ち上げておいて、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2003 それぞれのSPEからのメールは、その担当するスレッドが見る、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2004 って構想で作っていました。だけど、今は mailbox の扱いは
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2005 Cell/CellTaskManagerImpl::mail_check で行っているため
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2006 わざわざ2番目のスレッドを作る必要がなくなりました。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2007 つーことで、frontend_thread_run ではなく、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2008 最初から spe_thread_run を起動すればおkとなりました。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2009
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2010 * Cell/SpeThreads.cpp (SpeThreads::get_mail): if 文排除
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2011 今までは
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2012
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2013 if (spe_out_mbox_read(spe_ctx[speid], &ret, 1) < 0) {
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
2014 return ret;
276
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2015 else
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
2016 return -1;
276
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2017
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2018 とやっていた。これは
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2019
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2020 - データを読めたらそれ(ret)を返す
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2021 - データが無かったら -1 を返す
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2022
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2023 ってことだったんだが、よくよく考えると、spe_out_mbox_read() は
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2024 データがなかった場合 ret の値を変えないので、最初に
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2025
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2026 unsigned int ret = (unsigned int)-1;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2027
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2028 としておけば、最終的に if 文無しの
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2029
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2030 spe_out_mbox_read(spe_ctx[speid], &ret, 1);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2031 return ret;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2032
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2033 だけで済むわけだ。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2034
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2035 2008-05-22 Wataru MIYAGUNI <gongo@cr.ie.u-ryukyu.ac.jp>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2036
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2037 * thinking: List DMA (2)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2038 MFC List DMA read の場合は(少なくともPPEでcreate_taskする時は)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2039 read size が決まっているので無問題。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2040 しかし、MFC List DMA write の場合。同じタスクでも
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2041 違うサイズを出力するということはありえるので問題。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2042 今までも、write の場合は task->run() の返す値が write size として
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2043 使う事にしていた。List DMA write の場合は、おそらく
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2044
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2045 - task->run() 内で write 用の List DMA 構造体を作って Scheduler に
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2046 渡して、task->write() でやってもらう
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2047
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2048 って感じ? でも(上の手法に限らず)、write のサイズが決まってないと
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2049 write 用バッファを生成しておく事ができないので
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2050 書き込めない or あらかじめ多めに取っておくってことが必要になる。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2051 後者は SPE には痛手(昔は強制16KB確保とかやってたな)なので微妙。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2052 前者は論外だろう。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2053
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2054 うーん、どうすっかな。Single DMA write の頃からこれは問題であって。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2055 最悪、ユーザが「write のサイズが変動しないようなタスクにする」とか?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2056
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2057 * thinking: List DMA
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2058
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2059 構想としては以下のような考え。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2060
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2061 class Task {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2062 int cmd;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2063 DataListDMA *rlist;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2064 DataListDMA *wlist;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2065 };
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2066
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2067 class DataListDMA {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2068 int length; // リストの数
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2069 unsigned int addr[128]; // アドレス
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2070 int size[128]; // そのアドレスから取得するデータのサイズ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2071 };
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2072
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2073 128 という数字は、一つのタスクが持てるリストの合計サイズを
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2074 1KB (= 1024B) にしようってことで 4*128+4*128 = 1024 としました。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2075 ListDMA を使う流れとしては
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2076
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2077 1. Scheduler から cmd にそった Task を生成する
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2078 2. Task のコンストラクタ(もしくは Task を生成する implement 内 )で
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2079 task->rlist, task->wlist を DMA read しておく (ここは通常のDMA)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2080 3. task->read() で MFC List DMA で List を読む
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2081
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2082 DataListDMA->length に関しては、Task の中に入れるのも有りかと思う。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2083 その場合は、2 の DMA read で、わざわざ 1KB 全部読む必要は無くなる。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2084
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2085
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2086 * tag: v20080522
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2087 - PPE 側のタスクも SPE と同じく、クラスオブジェクトとして登録
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2088 - PPE、SPE 側の TaskManagerImpl を整理。見やすくなったと思われ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2089
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2090 こんなところかなー。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2091 テストプログラムは
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2092
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2093 Game_project/student/master/gongo/hello
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2094
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2095 にあります。DMA の例題まだだったぜHAHAHA
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2096 ここからは List DMA の処理を入れて行きたいと思います。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2097
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2098 現在の simple_render のバージョンは
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2099 PPE のタスクが関数ベースだった頃のなのでそのままでは動きません。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2100 List DMA ができるか、気晴らしに描き直すと思います。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2101
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2102 * Task 定義について
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2103 PPE も C++ のクラスオブジェクトとしてタスクを定義するようにしました。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2104 ちゃんとした API を考えたら改めて書きます。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2105
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2106 * メールチェックから次のタスクリスト生成までの流れの変更
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2107 今までの FifoTaskManagerImpl の mail_check では
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2108
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2109 1. mail_check
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2110 1.1 check_task_finish
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2111 1.1.1 notify_wait_taskQueue
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2112 1.1.1.1 append_activeTask (依存満たしたタスクを)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2113 1.2 get_runTaskList
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2114
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2115 と、全て mail_check の中で終わってたんですが、これを
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2116
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2117 1. mail_check
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2118 1.1 check_task_finish
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2119 1.1.1 notify_task_finish
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2120 2. wakeup_waitTask (つまり append_activeTask)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2121 3. get_runTaskList
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2122
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2123 というように分割しました。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2124 おかげで CellTaskManagerImpl の mail_check もすっきり。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2125
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2126 2008-05-13 Wataru MIYAGUNI <gongo@cr.ie.u-ryukyu.ac.jp>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2127
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2128 * Cell/CellTaskManagerImpl.cpp (CellTaskManagerImpl::set_task):
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2129 // set_task って名前やめね?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2130
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2131 どの SPE に振るかって判定を少し変更。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2132 cur_anySpeid の宣言場所のコメントにもあるけど、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2133 これはインクリメントじゃなくて乱数の方が
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2134 より SPE_ANY っぽいのか。むしろ「仕事してない方に割り振る」ってのが
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2135 SPE_ANY の役目な気がするな。ウーム。。。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2136
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2137 2008-05-05 Wataru MIYAGUNI <gongo@cr.ie.u-ryukyu.ac.jp>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2138
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2139 * Cell/CellTaskManagerImpl.cpp (CellTaskManagerImpl::mail_check):
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2140 PPE には実行するタスクが一つも無い時の動作がおかしかった。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2141 要するに、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2142
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2143 PPE で実行するタスクは全て SPE で実行中のタスク待ち
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2144
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2145 って時。。。よけいわからなくなったな。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2146 まあなんだ、今まで 必ずタスクが PPE and SPE にあったんだけど
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2147 PPE or SPE ってか、どっちか片方でしか動いてない状況だと
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2148 終了判定というか、それがおかしかったっぽい。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2149
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2150 Hello World でのタスクは
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2151
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2152 1. "Hello World!!" と表示するタスク (2.) を発行するタスク
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2153 2. 表示するタスク
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2154 3. 2 が全て終わったら実行される、最後のタスク(番兵的な
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2155
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2156 この時、(2) が SPE だけで実行されてると、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2157 (2) の終了を待つ (3) の判定?というか、それがおかしい
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2158
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2159
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2160 もう眠くてわけわからん。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2161 一応動いたんだけど、やはり描き直します。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2162 気持ち悪いほどやっつけな書き方してるので。これはきもい。。。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2163
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2164 2008-03-09 Wataru MIYAGUNI <gongo@cr.ie.u-ryukyu.ac.jp>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2165
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2166 * memo: pthread_cond_wait
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2167 この ChangeLog に書くものでもないが、まあメモ。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2168
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2169 セマフォの P 動作は、基本的に
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2170
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2171 ---------------------
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
2172 pthread_mutex_lock(&sem->mutex);
276
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2173
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2174 while(sem->value == 0) { // 資源が無い
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2175 // 条件付き変数に自分を登録して、ロックを解放して、他の
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2176 // プロセスが資源を解放してくれるのを待つ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2177 pthread_cond_wait(&sem->cond,&sem->mutex);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2178 }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2179 // 自分の分の資源があったので、それを確保する */
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2180 sem->value--;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2181 // ロックを解放する
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2182 pthread_mutex_unlock(&sem->mutex);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2183 ----------------------
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2184
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2185 こんな感じ。でコメントにもあるように、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2186 pthread_cond_wait では、wait の前に unlock する。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2187 これがよくわかってなくて、「while の外で lock してるのに
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2188 「なんで他のプロセスが lock できるんだろう。」と。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2189 man 見ろよと思った。てか先生のページのコメントに書いてるよ!
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2190
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2191
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2192 2008-03-08 Wataru MIYAGUNI <gongo@cr.ie.u-ryukyu.ac.jp>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2193
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2194 * memo: mailbox read の blocking/non-blocking
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2195 spe_out_mbox_read は non-blocking API なので、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2196 これをぐるぐる回すと busy-wait になるので、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2197 今の所 ppe 側の Scheduler がトップに戻る?時にメール確認する。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2198 で、spe_out_intr_mbox_read は blocking API 。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2199 spe_out_mbox_read との記述の違いは、予め
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2200 spe_event_handler_register で SPE_EVENT_OUT_INTR_MBOX を
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2201 登録しておく。spe 側では、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2202
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2203 spu_writech(SPU_WrOutMbox, data)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2204
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2205 じゃなくて
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2206
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2207 spu_writech(SPU_WrOutIntrMbox, data)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2208
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2209 を使う必要がある。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2210 両者の mailbox read の速度を調べてみたけど、そんなに違いは感じない。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2211 まあベンチマークの取り方がへぼいせいかもしれないけど。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2212 ってことで、こっちの intr の方がいいんじゃないかと思う。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2213 これと セマフォを組み合わせて mail の処理は簡単になると思う。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2214 セマフォの処理が重いって話もあるが、どうなんだろうね。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2215
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2216 * Test/simple_render/task/create_span.cpp (half_triangle): fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2217 画面外の span を描画しようとして落ちるので、それの修正。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2218 polygon->span の時点で外してるけど、span を外すより
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2219 Polygon の時点で修正するべきかな?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2220
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2221 * kernel/ppe/TaskManagerImpl.cpp (TaskManagerImpl::set_task): fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2222 返す TaskList が、mainTaskList の最後尾になってた。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2223 ってことで、TaskList のトップである bufferManager->mainTaskList を。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2224
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2225 * kernel/ppe/BufferManager.cpp (BufferManager::clear_taskList): fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2226 mainTaskList->length はクリアしてるのに、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2227 mainTaskList->next をクリアし忘れてた。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2228 だから空の TaskList が送られてたのか・・・ちくしょう!
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2229
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2230 2008-03-07 Wataru MIYAGUNI <gongo@cr.ie.u-ryukyu.ac.jp>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2231
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2232 * bug-fix (Test/simple_render): y座標の移動方向
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2233 (1) で、書き込む時に
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2234
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2235 y = height - y
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2236
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2237 としていた。千秋に聞いてみると、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2238
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2239 「ポリゴンの y を増やす(+)と、画面上に進むようにした」
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2240
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2241 だそうです。なるほどねー。ってことで(2)でもやったら上に進んだよ。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2242
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2243 しかし、ゲーム的には上が + の方がわかりやすいかもしれんが、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2244 プログラミング的には、framebuffer ベースでやるので、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2245 下にいくと y++ ってほうが作りやすいかなーと思いつつ。どっちがいいかね
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2246
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2247 * bug (Test/simple_render): y座標の移動方向
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2248 Viewer::run_draw で、従来の、SpanPack をそのまま描画する方法(1)と、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2249 SPE に渡すように、8分割したものとして描画する方法(2)で、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2250 それぞれの y に +0.5 とかしたら、移動する方向が違う。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2251 (1)では上、(2)では下へ行く。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2252 送られてくる span には違いが見られず、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2253 x 方向や 回転は問題ないので、おそらく draw 時の y の計算のバグだろう。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2254
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2255 1: polygon.cpp Polygon::draw(SPANPACK);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2256 2: task/span_pack_draw.cpp run();
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2257
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2258 * Test/simple_render/spe/SpuDraw.cpp: ↓の続きの解決
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2259 render_y &= ~7
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2260
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2261 これでおkでした。先生ありがとうございます。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2262 今はマクロとして
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2263
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2264 #define YTOP(y) (y & ~7)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2265
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2266 ってやってますわ。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2267
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2268 2008-03-05 Wataru MIYAGUNI <gongo@cr.ie.u-ryukyu.ac.jp>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2269
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2270 * memo: MFC List DMA の element の最大値
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2271 「Cell Broadband Engine Architecture Version 1.02」 より
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2272
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2273 P.55
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2274 The maximum number of elements is 2048.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2275 Each element describes a transfer of up to 16 KB.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2276
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2277 ってことらしいです。一度の転送での制限は普通のDMAと変わらず16KB。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2278 mfc_list_element_t は 2048 個まで設定できるってことか。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2279 テクスチャのロードで、分割しないなら MFC List DMA を使うことになるが、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2280 2048 個もあれば充分?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2281
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2282
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2283 * Test/simple_render/spe/SpuDraw.cpp: ↓の続き
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2284 と思ったけど、やっぱりずれるなあ。うーむ。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2285 とりあえず今は
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2286
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2287 if (render_y < 0) {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2288 int tmpy = render_y%8;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2289 render_y -= tmpy + (tmpy != 0)*8;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2290 } else {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2291 render_y -= (render_y%8);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2292 }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2293 render_y += 1080/2;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2294
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2295 で落ち着くことに。うーむ。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2296 もっと良い計算を考えるよりは span の生成時で
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2297 いろいろやるほうがいいのかなー
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2298
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2299 2008-03-04 Wataru MIYAGUNI <gongo@cr.ie.u-ryukyu.ac.jp>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2300
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2301 * Test/simple_render/spe/SpuDraw.cpp: ↓の続き
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2302 よくよく考えてだな。。。マイナスが気になるなら
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2303
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2304 if (render_y < 0) {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2305 int tmpy = render_y%8;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2306 render_y -= tmpy + (tmpy != 0)*8;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2307 } else {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2308 render_y -= (render_y%8);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2309 }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2310 render_y += 1080/2;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2311
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2312 じゃなくて
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2313
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2314 render_y += 1080/2;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2315 render_y -= (render_y%8);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2316
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2317 これでよくね?ってか元々そのための 1080/2 だった気が。。。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2318
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2319 * Test/simple_render/spe/SpuDraw.cpp: render_y の計算の修正
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2320 sp->span[0].y (SpanPack に格納されてる最初の Span の y 座標) から
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2321 この SpanPack が描画する範囲の一番上の y 座標を調べる。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2322
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2323 どういうことかっていうと、例えば SpanPack に入ってる Span が持つ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2324 y 座標が 1 ~ 8 の時
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2325
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2326 1 -----
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2327 --
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2328 --------
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2329 ----
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2330 ---------
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2331 8 --
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2332
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2333 '-' は描画していると思ってください。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2334 この場合は、y = 1 がこの SpanPack の一番上、基準となる 座標ってこと。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2335 framebuffer に書き込むとき、y = 1 から順々に書いて行きます。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2336
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2337 で、sp->span[0].y ってのが、その基準となる y である保証が無いので、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2338 sp->span[i].y 、つまりどの y からでも、基準となる y を求める
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2339 必要がある。その計算をミスってました。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2340
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2341 1 //////////
1052
a0ea7d9b6faf Makefile utf-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 966
diff changeset
2342 <- なぜか書き込まれていない
276
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2343 //////////
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2344 //////////
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2345
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2346 みたいに、歯抜けした部分があったので、いろいろ調べてみたら
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2347 この render_y がずれてるってことが判明しました。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2348 今までは
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2349
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2350 render_y = sp->span[0].y;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2351 render_y += 1080/2;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2352 render_y = (render_y/8)*8;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2353
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2354 ってことしてたんだけど、これだと sp->span[0].y が マイナスのとき
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2355 ずれることが判明。なので
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2356
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2357 if (render_y < 0) {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2358 int tmpy = render_y%8;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2359 render_y -= tmpy + (tmpy != 0)*8;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2360 } else {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2361 render_y -= (render_y%8);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2362 }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2363 render_y += 1080/2;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2364
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2365 こうするとできました。。。が、直したい。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2366 もう少し奇麗に描けると思うんだけどなー。if 文ぐらいは外したい
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2367
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2368 2008-03-03 Wataru MIYAGUNI <gongo@cr.ie.u-ryukyu.ac.jp>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2369
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2370 * memo: 最適化の結果
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2371 ppe/spe ともに最適化なしの場合
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2372 263.444 FPS
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2373
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2374 ppe だけ -O9 で最適化
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2375 317.425 FPS
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2376
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2377 spe だけ -O9 で最適化
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2378 812.539 FPS
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2379
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2380 ppe/spe ともに -O9 で最適化
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2381 1610.58 FPS (吹いた
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2382
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2383
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2384 最初、ダブル最適化の画像を見た時の
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2385 あまりの早さにびびった。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2386 逆に「こ、これはバグか!?」と思った
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2387
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2388
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2389 2008-02-28 Wataru MIYAGUNI <gongo@cr.ie.u-ryukyu.ac.jp>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2390
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2391 * kernel/ppe/BufferManager.cpp: remove_taskQueue_all()
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2392 taskQueue の create と free が釣り合って無くて、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2393 queue が足りなくなる -> extend_pool -> 足りなく(ry
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2394 ってのを繰り返してメモリ的なセグメンテーションフォルとが出て
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2395 なんでかなと思ったら、task->wait_me を消去してなかった。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2396 task->wait_i は notify(ry で削除されるんだけど、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2397 task->wait_me は、notify(ry に渡した後ほったらかしだった。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2398 ってことで、wait_me を全消しする関数を作りましたとさ。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2399 気持ち速度が増した気がする。気ね。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2400
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2401
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2402 2008-02-17 Wataru MIYAGUNI <gongo@cr.ie.u-ryukyu.ac.jp>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2403
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2404 * Todo: 悩んでる所
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2405
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2406
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2407 * fix: kernel/ppe/HTask.cpp
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2408 今まで、manager->create_task で生成したタスクは
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2409
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2410 - dependency の設定
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2411 manager->set_task_depend(master, slave) // slave は master を待つ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2412
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2413 - 実行キューへの追加
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2414 manager->spawn_task(master);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2415 manager->spawn_task(slave);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2416
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2417 と、manager を介してやっていました。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2418 まあそれでもいいんだけど、特に dependency の所は
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2419 どっちがどっちを待つのかってのは、API見るだけじゃわからない。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2420 そこで、Task (HTask のこと) に、上二つに対応するような
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2421
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2422 void set_depend(HTaskPtr) と void spawn(void) を追加しました。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2423
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2424 - Usage
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2425 slave->set_depend(master); // slave は master を待つ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2426 slave->spawn(); // slave をキューへ追加
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2427
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2428 結局は、それぞれの関数の中では、上の set_task_depend とかを
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2429 呼んでるんだけど、ユーザ側からするとこの方がわかりやすいと思います。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2430
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2431 2008-02-16 Wataru MIYAGUNI <gongo@cr.ie.u-ryukyu.ac.jp>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2432
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2433 * tag: beta3
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2434 ダブルバッファリングを追加し、まあなんとか動いてるんじゃない?って
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2435 ところまでですが、所詮 Fifo バージョンなので、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2436 そろそろ Cell を書き上げて、並列にちゃんと動いてるか確かめないとね
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2437
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2438 * add: kernel/ppe/DmaBuffer.cpp
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2439 ダブルバッファリング用に作ったんだけど、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2440 せっかくなので、DMA は、このオブジェクト(が持つ二つの領域)でしか
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2441 行えないようにする。ってのでどうでしょう。って話を先生としました。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2442 並列処理だし、ダブルバッファリングがデフォでいいでしょう。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2443 というか、したくなければ swap_buffer とかしなければおk。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2444
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2445 -Usage
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2446 DmaBuffer *buffer = manager->allocate(sizeof(SceneGraphPack));
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2447
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2448 今までと違い、create_task の in_addr と out_addr には
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2449 DmaBuffer をいれてください。ユーザが自分で malloc/new したやつは
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2450 エラーを出すようにしてる(seg faultだけどね!)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2451 汚いソースだが、実際に使ってる様子は Test/simple_render の
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2452 viewer.cpp で使ってます。sgp_buff と pp_buff ってやつね。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2453
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2454 もうすこしユーザに優しいAPIを作りたい・・・
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2455
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2456 2008-02-11 Wataru MIYAGUNI <gongo@cr.ie.u-ryukyu.ac.jp>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2457
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2458 * add: Test/simple_render
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2459 chiaki の DataPack を使った Cube の表示プログラム。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2460 簡単に DataPack を TaskManager の scheduler (SpeManager) に渡して
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2461 処理してコピーして、を繰り返してるだけなんだけど
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2462 まあ動いてる気がするのでいいんじゃないでしょうか。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2463
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2464
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2465 2008-02-10 Wataru MIYAGUNI <gongo@cr.ie.u-ryukyu.ac.jp>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2466
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2467 * tag: beta1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2468 この状況だと、できることよりもできないことを書くべき?違うか。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2469
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2470 - task (親) 中で task (子) を生成することはできない
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2471 正確には「生成はできる」だけど、その 子task が
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2472 親task に依存している別の task を無視して動くので
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2473 ちゃんとした結果にならないと。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2474 8日の Todo にも書いてあるけど、今の実装では
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2475 task が task を生成することを想定してない感じなので。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2476 完全に spe 用にのみ狙いを絞った実装であって
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2477 OS って言えない実装であるからして、書き直すの?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2478 全ての関数を task しようとするとこうなる訳で、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2479 ある部分だけやるってのはまあできるんだろうけど、うーん。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2480
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2481 - chiaki の simple_render が動かない
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2482 (追記) 解決しました
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2483 単に read/write buffer のサイズが足りないだけだった。アホスwww
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2484 まあ辱めの為の下は残しておこう
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2485
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2486 まだ cvs に commit してないけど、chiaki が書いた、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2487 DataPack 対応の simple_render に TasKManager を組み込んでみた。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2488 といっても、OSっぽく書いたんじゃなく、今は
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2489 update_sgp と create_pp だけを task 化してみた。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2490 でまあ動いてるような気はするけど、ものすっごい malloc 系の warning が。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2491 時々長く動くよねみたいな感じになってしまっている。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2492 TaskManager が悪いのか、simple_render が悪いのか。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2493 この TaskManager、ある部分での malloc 系の問題に敏感だなあ。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2494 まあそうでなかったらバグの探しようも無いし、良いっちゃー良いんだが。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2495
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2496
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2497 2008-02-08 Wataru MIYAGUNI <gongo@cr.ie.u-ryukyu.ac.jp>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2498
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2499 * add: kernel/ppe/SymTable.cpp
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2500 今まで func[] = {add, sum, ...}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2501 とかやってかっこわるい言われまくってたので
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2502 話し合いの通り Symbol Table みたいなものを作ることに
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2503
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2504 // 疑似コードね
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2505 struct sym_table {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2506 char *sym; // シンボル
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2507 void *address; // シンボルが示すアドレス
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2508 } sym_table[] = {{"Sum", &Sum} , {"Draw", &draw}};
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2509
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2510 int fd = get_fd("Sum");
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2511 void *addr = get_address(fd);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2512
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2513 table には "Sum" と "Draw" っていう二つのシンボルが登録されている。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2514 例えば、ユーザ(カーネル?)が "Sum" ってシンボルにアクセスしたい場合、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2515 まずは get_fd で "Sum" に対する、file descripter を返す。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2516 ユーザは、その fd に従って get_address を取得することが出来る。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2517 TaskManager 的な使い方をするなら
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2518
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2519 // 俺は今、Draw 関数を使うタスクを生成したい
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2520 int fd = manager->open("Draw");
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2521 manager->create_task(fd, size, in, out, func);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2522 manager->open では get_fd と同じ使い方です。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2523
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2524 まだ改良の余地ありそうですが、今は動いてるってことで。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2525
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2526
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2527 - 補足
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2528 なぜ file descripter と表すか
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2529
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2530 OS の昨日として、 fopen とかと同じ使い方もできるじゃない!
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2531
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2532
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2533 * Todo: task が task を生成する際の処理
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2534 今まで、 task が行う作業は、演算のみを行うような
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2535 単純な実装に決め打ちされているわけです。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2536 しかし、OS なんかだと、タスク中から別のタスクを生成するとか
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2537 ありありだと思われる。てか今のテストプログラムでなった。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2538
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2539 Test/Sum にあるプログラムで使われるタスク
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2540
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2541 - init2 // 貧相な名前ですまない
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2542 演算する数値とかバッファの初期化
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2543
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2544 - sum1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2545 ある範囲の整数 (i から i+16 とか) の総和
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2546
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2547 - sum2
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2548 sum1 で求められた、複数の範囲の総和を一つにまとめる
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2549 (ex. 複数の sum1 が 1->16, 17->32, 33->48 の総和を計算し、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2550 sum2 で 上の3つの総和を計算する
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2551 要は 1->48 の総和を分割するっていうプログラムね
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2552
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2553 - finish
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2554 sum2 で求まった値を表示
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2555
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2556 この Sum というプログラム、というか OS と言おう。SumOS ね。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2557 SumOS は最初に TaskManager (所謂 kernel) を起動し、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2558 init を起動する。init では、予め決められたタスクである
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2559 init2 と finish の二つのタスクを create して登録する。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2560 init2 と finish には依存関係がある (init2 が終わったら finish)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2561 init2 の中で、sum1 と sum2 というタスクが作られる。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2562 sum1 と sum2 にも依存関係はある (sum1 が終わったら sum2)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2563
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2564 今の実装だと、タスクが終了して初めて次のタスクへ行く。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2565 まあ当たり前なんだけど、例えばそのタスクの中で
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2566 新たにタスクが作られた場合、そのタスクが終了するまでは
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2567 実行されなくなってしまう。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2568 でまあ、今は、manager->create_task される度に
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2569 manager->run とかして、無理やり起動してる訳さ。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2570 何が無理矢理かっていうと、scheduler の役目をしている
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2571 SpeManager (これも名前変えないと) を2度呼び出してる訳。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2572 つまり、タスク中でタスクを作る度に、SpeManager オブジェクトを
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2573 new してるわけさ。いいのか?いや、動いてるけどね?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2574
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2575 ちなみに、Cell version だと spe が勝手に取っていってくれるから
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2576 大丈夫かなと思いつつ、もし spe を1つしか使わない設定だったら微妙。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2577
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2578 要するに、タスク中でタスクが作られる場合の処理を考えないとね。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2579
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2580 2008-02-07 Wataru MIYAGUNI <gongo@cr.ie.u-ryukyu.ac.jp>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2581
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2582 * memo: プログラミングの姿勢
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2583 scheduler とか、task の管理をする部分は
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2584 kernel programing のつもりで、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2585 example とか、task に割り当てる処理を決めたりする部分は
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2586 user programing のつもりで。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2587
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2588 それぞれ違った視点で見る必要がある
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2589
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2590 * memo: OS というもの
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2591 OS 起動の流れ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2592
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2593 - PC の電源を入れる
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2594 - BIOS が立ち上がる (OpenFirmWare, EFI, BIOS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2595 - 起動デバイスをチェック (優先度とか種類とか)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2596 - 起動デバイスから Boot loader を起動
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2597 + BIOS によって、認識できるファイルシステムが違う(だっけ?)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2598 + ファイルシステムのどこに Boot Loader があるか知っている
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2599 + grub, grub2, lilo, kboot などがある
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2600 - Boot Loader が kernel を起動
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2601 + ネットワークブートの場合、TCP/IP や
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2602 ネットワークデバイス(イーサとか?)のドライバを持ってる必要がある
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2603 - kernel は、最初に scheduler を起動する
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2604 - scheduler の初期化 (init を呼ぶ?)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2605 - init では、事前?に設定されているスクリプトとかを呼ぶ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2606 + linux とかだと /etc/rc にあるやつを init が呼ぶ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2607 - login form が起動
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2608
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2609 補足 こっからユーザ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2610 - login する
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2611 - shell を呼ぶ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2612 + login shell かどうか確かめる
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2613 - ユーザに設定されてる起動スクリプト?を実行
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2614 - 晴れてログイン
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2615
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2616 2008-02-06 Wataru MIYAGUNI <gongo@cr.ie.u-ryukyu.ac.jp>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2617
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2618 * kernel/spe/*.cpp: new と placement new
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2619 現在、spe kernel のタスクは、切り替わる毎に
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2620 new/delete を繰り返しています。今はこれでいいんだけど、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2621 速度的にも、いずれは直さないといけないと思うわけで。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2622 で、予め allocate された領域を利用した placement new を使えば
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2623 new よりもそれなりに早くなるっぽい。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2624 例題として、与えられた回数分 new/delete を繰り返すプログラムと、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2625 同じ回数分、placement new したときの速度の比較
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2626
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2627 for (int i = 0; i < num; i++) {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2628
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2629 < task = new Task;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2630 < task->init(i);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2631 < task->printID();
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2632 < delete task;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2633 ---
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2634 > task = new(buff) Task; // buff = malloc(BUFF_SIZE);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2635 > task->init(id);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2636 > task->printID(id);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2637 }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2638
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2639 placement new では、delete の必要は無い。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2640 その中で新たに allocate してるなら必要かもしれないが。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2641 速度比較は以下。no_new が placement new で、ln_new が new/delete 。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2642
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2643 % ./a.out 10 // 10 回
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2644 no_new: time: 0.012135(msec)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2645 ln_new: time: 0.003572(msec)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2646
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2647 % ./a.out 100
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2648 no_new: time: 0.022453(msec)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2649 ln_new: time: 0.018989(msec)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2650
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2651 % ./a.out 1000
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2652 no_new: time: 0.115277(msec)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2653 ln_new: time: 0.136335(msec)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2654
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2655 % ./a.out 10000
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2656 no_new: time: 1.056156(msec)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2657 ln_new: time: 1.322709(msec)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2658
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2659 % ./a.out 100000
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2660 no_new: time: 10.622221(msec)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2661 ln_new: time: 13.362414(msec)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2662
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2663 % ./a.out 1000000
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2664 no_new: time: 109.436496(msec)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2665 ln_new: time: 136.956872(msec)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2666
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2667 10、100 回だと負けてるが、まあ無視しよう(ぇ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2668 回数が多くなるにつれて、ほんの少しだが no_new が勝ってる。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2669 どうなんだろうね。ちなみに printID を無くすと
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2670
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2671 % ./a.out 1000000
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2672 no_new: time: 0.008512(msec)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2673 ln_new: time: 27.100296(msec)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2674
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2675 I/O に左右され過ぎ。まあそんなもんだろうけどさ。