Mercurial > hg > Game > Cerium
changeset 1492:73f4bfaeaf99 draft
fix select cpu type
author | Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 14 Aug 2012 16:04:12 +0900 |
parents | fd09cdf2f531 |
children | efced19350f8 |
files | TaskManager/Cell/CellTaskManagerImpl.cc TaskManager/kernel/ppe/CpuThreads.cc TaskManager/kernel/ppe/CpuThreads.h TaskManager/kernel/ppe/TaskManagerImpl.cc TaskManager/kernel/schedule/Scheduler.h example/basic/main.cc |
diffstat | 6 files changed, 34 insertions(+), 32 deletions(-) [+] |
line wrap: on
line diff
--- a/TaskManager/Cell/CellTaskManagerImpl.cc Wed Aug 08 13:45:00 2012 +0900 +++ b/TaskManager/Cell/CellTaskManagerImpl.cc Tue Aug 14 16:04:12 2012 +0900 @@ -89,36 +89,34 @@ int speid; HTaskPtr htask = activeTaskQueue->getFirst(); while (htask != NULL) { - + if (htask->cpu_type == CPU_PPE) { - + htask = activeTaskQueue->getNext(htask); - - } else { + + } else { if (htask->cpu_type == SPE_ANY) { speid = cur_anySpeid++; } else { -#ifdef __CERIUM_GPU__ - speid = htask->cpu_type; -#else - // -1 してるのは - // htask->cpu_type - CPU_SPE で - // SPE0 = 1, SPE1 = 2, ... SPE5 = 6 ってなってるので - // 配列的 (SPE0 = arr[0], SPE1 = arr[1]) にするため - speid = htask->cpu_type - CPU_SPE - 1; -#endif - } -#ifndef __CERIUM_GPU__ - speid %= machineNum; -#endif - set_taskList(htask, taskListInfo[speid]); - - HTaskPtr next = activeTaskQueue->getNext(htask); - activeTaskQueue->remove(htask); - htask = next; - - } - } + // -1 してるのは + // htask->cpu_type - CPU_SPE で + // SPE0 = 1, SPE1 = 2, ... SPE5 = 6 ってなってるので + // 配列的 (SPE0 = arr[0], SPE1 = arr[1]) にするため + speid = htask->cpu_type - CPU_SPE - 1; + } + speid %= machineNum; + + set_taskList(htask, taskListInfo[speid]); + + + + + HTaskPtr next = activeTaskQueue->getNext(htask); + activeTaskQueue->remove(htask); + htask = next; + + } + } } void CellTaskManagerImpl::sendTaskList() {
--- a/TaskManager/kernel/ppe/CpuThreads.cc Wed Aug 08 13:45:00 2012 +0900 +++ b/TaskManager/kernel/ppe/CpuThreads.cc Tue Aug 14 16:04:12 2012 +0900 @@ -112,7 +112,7 @@ CpuThreads::get_mail(int cpuid, int count, memaddr *ret) { #ifdef __CERIUM_GPU__ - if (is_gpu(cpuid)) return gpu->get_mail(cpuid, count, ret); + if (is_gpu()) return gpu->get_mail(cpuid, count, ret); #endif *ret = args[cpuid-id_offset].scheduler->mail_read_from_host(); return 1; @@ -122,7 +122,7 @@ CpuThreads::has_mail(int cpuid, int count, memaddr *ret) { #ifdef __CERIUM_GPU__ - if (is_gpu(cpuid)) return gpu->has_mail(cpuid, count, ret); + if (is_gpu()) return gpu->has_mail(cpuid, count, ret); #endif if (args[cpuid-id_offset].scheduler->has_mail_from_host() != 0) { return get_mail(cpuid,count,ret); @@ -149,7 +149,7 @@ CpuThreads::send_mail(int cpuid, int num, memaddr *data) { #ifdef __CERIUM_GPU__ - if (is_gpu(cpuid)){ + if (is_gpu()){ gpu->send_mail(cpuid, num, data); return; } @@ -171,8 +171,9 @@ int -CpuThreads::is_gpu(int cpuid) +CpuThreads::is_gpu() { + CPU_TYPE cpuid = task_list->cpu_type; if ( (cpuid < GPU_0)||(cpuid > GPU_3) ) { return 0; // cpuidがGPU以外なら0を返す
--- a/TaskManager/kernel/ppe/CpuThreads.h Wed Aug 08 13:45:00 2012 +0900 +++ b/TaskManager/kernel/ppe/CpuThreads.h Tue Aug 14 16:04:12 2012 +0900 @@ -31,7 +31,7 @@ virtual int has_mail(int speid, int count, memaddr *ret); // NONBLOCK virtual void send_mail(int speid, int num, memaddr *data); // BLOCKING virtual void add_output_tasklist(int command, memaddr buff, int alloc_size); - virtual int is_gpu(int sepid); + virtual int is_gpu(); private: /* variables */
--- a/TaskManager/kernel/ppe/TaskManagerImpl.cc Wed Aug 08 13:45:00 2012 +0900 +++ b/TaskManager/kernel/ppe/TaskManagerImpl.cc Tue Aug 14 16:04:12 2012 +0900 @@ -271,6 +271,7 @@ void TaskManagerImpl::set_task_cpu(HTaskPtr task, CPU_TYPE type) { + task_list->cpu_type = type; if (machineNum==0) task->cpu_type = CPU_PPE ; else
--- a/TaskManager/kernel/schedule/Scheduler.h Wed Aug 08 13:45:00 2012 +0900 +++ b/TaskManager/kernel/schedule/Scheduler.h Tue Aug 14 16:04:12 2012 +0900 @@ -9,7 +9,8 @@ #include "DmaManager.h" #include "SchedTaskBase.h" #include "MemList.h" -#include "MemHash.h" +#include "MemHash.h" +#include "types.h" #ifdef __CERIUM_GPU__ #ifdef __APPLE__ @@ -39,6 +40,7 @@ // 大きいので、SPEには置かない方が本当は良い... // get_segment で取って来るのが、おそらくは正しい。 typedef struct task_object { + CPU_TYPE cpu_type; TaskObjectRun run; memaddr location; // location address in a.out memaddr end;