annotate TaskManager/ChangeLog @ 1506:a7895ab4d0e3 draft

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