pxtask::SpuTask Class Reference
A task to be executed on one or more SPUs. More...
#include <PxSpuTask.h>
![Inheritance graph](classpxtask_1_1SpuTask__inherit__graph.png)
![Collaboration graph](classpxtask_1_1SpuTask__coll__graph.png)
Public Member Functions | |
SpuTask (const void *elfStart, PxU32 elfSize, PxU32 numSpus=1, const PxU32 *args=NULL) | |
Construct a new SpuTask object. | |
virtual | ~SpuTask () |
PX_INLINE PxU32 | getSpuCount () const |
Return the number of SPUs used to run this task. | |
PX_INLINE void | setSpuCount (PxU32 numSpusToRun) |
Set the number of SPUs to be used when running this task. | |
PX_INLINE const PxU32 * | getArgs (PxU32 spuIndex) const |
Retrieve the per-SPU argument. | |
PX_INLINE void | setArgs (PxU32 spuIndex, PxU32 arg1, PxU32 arg2) |
Set the arguments for a given SPU worker. | |
PX_INLINE const void * | getElfStart () const |
Return the address to the start of the embedded elf binary for this task. | |
PX_INLINE PxU32 | getElfSize () const |
Return the size of the embedded elf binary for this task. | |
PX_INLINE void | notifySpuFinish () |
Called by the SpuDispatcher when a SPU worker has completed, when all workers have completed the task is considered finished and the continuation will have it's ref count decremented. | |
virtual void | removeReference () |
Modifies LightCpuTask's behavior by submitting to the SpuDispatcher. | |
virtual void | run () |
Allow the task to perform PPU side intialization before the task is scheduled to the SPUs. | |
virtual void | runAfterDispatch () |
Called by the SpuDispatcher after scheduling a task to the SPUs. | |
Static Public Attributes | |
static const PxU32 | kMaxSpus = 6 |
The maximum number of SPUs. | |
static const PxU32 | kArgsPerSpu = 2 |
Arguments per SPU. | |
Protected Attributes | |
const void * | mElfStart |
A pointer to the start of the ELF image. | |
PxU32 | mElfSize |
The size of the ELF image. | |
PxU32 | mNumSpusToRun |
The number of SPUs to run. | |
PxU32 | mNumSpusFinished |
The number of SPUs finished. | |
PxU32 | mArgs [kMaxSpus][kArgsPerSpu] |
The arguments for the SPUs. |
Detailed Description
A task to be executed on one or more SPUs.Each SpuTask can run in a data parallel fashion on up to 6 SPUs. To coordinate the workers, each SPU will be passed it's own set of arguments.
When all SPU workers have completed their work, the task is considered complete and the SpuDispatcher will call release on the task, this in turn will call removeReference() on the task's continuation.
In this way LightCpuTasks may be launched automatically at SpuTask completion and vice versa.
Users should not need to implement or create SpuTasks directly. The SDK creates the tasks internally and will submit them to the TaskManager's SpuDispatcher for execution. The SpuDispatcher that will be used is configured on a per-scene basis through the PxSceneDesc.
- See also:
- SpuDispatcher
Constructor & Destructor Documentation
pxtask::SpuTask::SpuTask | ( | const void * | elfStart, | |
PxU32 | elfSize, | |||
PxU32 | numSpus = 1 , |
|||
const PxU32 * | args = NULL | |||
) | [inline] |
Construct a new SpuTask object.
- Parameters:
-
[in] elfStart The starting address of the embedded SPU binary [in] elfSize The size in bytes of the embedded SPU binary [in] numSpus The number of SPU workers this task will run across [in] args A pointer to an array of arguments, must be at least kArgsPerSpu*numSpus big
virtual pxtask::SpuTask::~SpuTask | ( | ) | [inline, virtual] |
Member Function Documentation
Retrieve the per-SPU argument.
- Parameters:
-
[in] spuIndex The SPU that we want to retrieve the argument for
- Returns:
- A pointer to the parameters for the given SPU index
References PX_ASSERT.
PX_INLINE PxU32 pxtask::SpuTask::getElfSize | ( | ) | const [inline] |
Return the size of the embedded elf binary for this task.
PX_INLINE const void* pxtask::SpuTask::getElfStart | ( | ) | const [inline] |
Return the address to the start of the embedded elf binary for this task.
PX_INLINE PxU32 pxtask::SpuTask::getSpuCount | ( | ) | const [inline] |
Return the number of SPUs used to run this task.
PX_INLINE void pxtask::SpuTask::notifySpuFinish | ( | ) | [inline] |
Called by the SpuDispatcher when a SPU worker has completed, when all workers have completed the task is considered finished and the continuation will have it's ref count decremented.
virtual void pxtask::SpuTask::removeReference | ( | ) | [inline, virtual] |
Modifies LightCpuTask's behavior by submitting to the SpuDispatcher.
Reimplemented from pxtask::LightCpuTask.
References PX_ASSERT.
virtual void pxtask::SpuTask::run | ( | ) | [inline, virtual] |
Allow the task to perform PPU side intialization before the task is scheduled to the SPUs.
This should be called by the SpuDispatcher from whichever thread calls submitTask(); the task should be scheduled to the SPUs immediately following this function returning.
Implements pxtask::BaseTask.
virtual void pxtask::SpuTask::runAfterDispatch | ( | ) | [inline, virtual] |
Called by the SpuDispatcher after scheduling a task to the SPUs.
This virtual method allows the task to perform PPU side work while the SPU task is running, for example using the PPU as a producer and the SPUs as a consumer.
Set the arguments for a given SPU worker.
- Parameters:
-
[in] spuIndex The index of the SPU worker whose arguments are to be set [in] arg1 The first argument to be passed to this worker [in] arg2 The second argument to be passed to this worker
References PX_ASSERT.
PX_INLINE void pxtask::SpuTask::setSpuCount | ( | PxU32 | numSpusToRun | ) | [inline] |
Member Data Documentation
const PxU32 pxtask::SpuTask::kArgsPerSpu = 2 [static] |
Arguments per SPU.
const PxU32 pxtask::SpuTask::kMaxSpus = 6 [static] |
The maximum number of SPUs.
PxU32 pxtask::SpuTask::mArgs[kMaxSpus][kArgsPerSpu] [protected] |
The arguments for the SPUs.
PxU32 pxtask::SpuTask::mElfSize [protected] |
The size of the ELF image.
const void* pxtask::SpuTask::mElfStart [protected] |
A pointer to the start of the ELF image.
PxU32 pxtask::SpuTask::mNumSpusFinished [protected] |
The number of SPUs finished.
PxU32 pxtask::SpuTask::mNumSpusToRun [protected] |
The number of SPUs to run.
The documentation for this class was generated from the following file:
Copyright © 2008-2012 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com