18/07/30 07:06:07.72 wOzVCFyH.net BE:138871639-2BP(0)
URLリンク(img.5ch.net)
Page 29
スレッドの切り替え (3/3)
? 以下のようにa, bの読み込み後にchgthreadを入れる事で改善される。
void pzc_Add(float* a, float* b, float* c, int count)
{
int tid = get_tid(); // thread ID (0 - 7)
int pid = get_pid(); // PE ID
int offset = pid * get_maxtid() + tid;
int step = get_maxtid() * get_maxpid();
for(int pos = offset; pos < count; pos += step) {
float a_ = a[pos];
float b_ = b[pos];
chgthread();
c[pos] = a_ + b_;
}
flush();
}
memory
↑ request ↓
t0 stall flush
↓ chgthread
t4