annotate TaskManager/ChangeLog @ 1465:fc5b23108608 draft

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