18 #ifndef MINICL_TASK_SCHEDULER_H
19 #define MINICL_TASK_SCHEDULER_H
34 #define CMD_SAMPLE_TASK_COMMAND 10
117 #if defined(USE_LIBSPE2) && defined(__SPU__)
118 #include "../SpuLibspe2Support.h"
120 #include <spu_intrinsics.h>
121 #include <spu_mfcio.h>
124 void * SamplelsMemoryFunc();
125 void SampleThreadFunc(
void* userPtr,
void* lsMemory);
129 int main(
unsigned long long speid,
addr64 argp,
addr64 envp)
131 printf(
"SPU is up \n");
135 unsigned int received_message = Spu_Mailbox_Event_Nothing;
136 bool shutdown =
false;
141 status.m_status = Spu_Status_Free;
142 status.m_lsMemory.p = SamplelsMemoryFunc();
150 received_message = spu_read_in_mbox();
154 switch(received_message)
156 case Spu_Mailbox_Event_Shutdown:
159 case Spu_Mailbox_Event_Task:
161 #ifdef DEBUG_LIBSPE2_MAINLOOP
162 printf(
"SPU recieved Task \n");
163 #endif //DEBUG_LIBSPE2_MAINLOOP
167 btAssert(status.m_status==Spu_Status_Occupied);
172 SampleThreadFunc((
void*)&taskDesc, reinterpret_cast<void*> (taskDesc.m_mainMemoryPtr) );
174 case Spu_Mailbox_Event_Nothing:
180 status.m_status = Spu_Status_Free;
193 #endif // MINICL_TASK_SCHEDULER_H
int m_argSizes[MINI_CL_MAX_ARG]
void push_back(const T &_Val)
char m_name[MINI_CL_MAX_KERNEL_NAME]
int m_maxNumOutstandingTasks
int cellDmaGet(void *ls, uint64_t ea, uint32_t size, uint32_t tag, uint32_t tid, uint32_t rid)
#define ATTRIBUTE_ALIGNED128(a)
class btThreadSupportInterface * m_threadInterface
int cellDmaLargePut(const void *ls, uint64_t ea, uint32_t size, uint32_t tag, uint32_t tid, uint32_t rid)
cellDmaLargePut Win32 replacements for Cell DMA to allow simulating most of the SPU code (just memcpy...
MiniCLTaskScheduler handles SPU processing of collision pairs.
btAlignedObjectArray< bool > m_taskBusy
int getMaxNumOutstandingTasks() const
void registerKernel(MiniCLKernel *kernel)
void postProcess(int taskId, int outputSize)
Optional PPU-size post processing for each task.
void cellDmaWaitTagStatusAll(int ignore)
cellDmaWaitTagStatusAll Win32 replacements for Cell DMA to allow simulating most of the SPU code (jus...
#define ATTRIBUTE_ALIGNED16(a)
void issueTask(int firstWorkUnit, int lastWorkUnit, MiniCLKernel *kernel)
btAlignedObjectArray< MiniCLTaskDesc > m_spuSampleTaskDesc
This file provides some platform/compiler checks for common definitions.
class btThreadSupportInterface * getThreadSupportInterface()
MiniCLTaskScheduler * m_scheduler
int findProgramCommandIdByName(const char *programName) const
void flush()
call flush to submit potential outstanding work to SPUs and wait for all involved SPUs to be finished...
void(* kernelLauncherCB)(MiniCLTaskDesc *taskDesc, int guid)
void * m_argData[MINI_CL_MAX_ARG]
void initialize()
call initialize in the beginning of the frame, before addCollisionPairToTask
#define MINI_CL_MAX_KERNEL_NAME
MiniCLKernel * registerSelf()
btAlignedObjectArray< const MiniCLKernel * > m_kernels
MiniCLTaskScheduler(btThreadSupportInterface *threadInterface, int maxNumOutstandingTasks)
kernelLauncherCB m_launcher