PxGpuDispatcher.h
Go to the documentation of this file.
1 //
2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions
4 // are met:
5 // * Redistributions of source code must retain the above copyright
6 // notice, this list of conditions and the following disclaimer.
7 // * Redistributions in binary form must reproduce the above copyright
8 // notice, this list of conditions and the following disclaimer in the
9 // documentation and/or other materials provided with the distribution.
10 // * Neither the name of NVIDIA CORPORATION nor the names of its
11 // contributors may be used to endorse or promote products derived
12 // from this software without specific prior written permission.
13 //
14 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
15 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
18 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
22 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 //
26 // Copyright (c) 2008-2018 NVIDIA Corporation. All rights reserved.
27 
28 #ifndef PXTASK_PXGPUDISPATCHER_H
29 #define PXTASK_PXGPUDISPATCHER_H
30 
31 #include "task/PxTaskDefine.h"
32 #include "task/PxTask.h"
33 
34 /* forward decl to avoid including <cuda.h> */
35 typedef struct CUstream_st* CUstream;
36 
37 namespace physx
38 {
39 
40 struct PxGpuCopyDesc;
41 class PxCudaContextManager;
42 
44 
45 class PxTaskManager;
46 
72 {
73 public:
80  virtual void startSimulation() = 0;
81 
91  virtual void startGroup() = 0;
92 
100  virtual void submitTask(PxTask& task) = 0;
101 
110  virtual void finishGroup() = 0;
111 
135  virtual void addCompletionPrereq(PxBaseTask& task) = 0;
136 
143  virtual PxCudaContextManager* getCudaContextManager() = 0;
144 
151  virtual void stopSimulation() = 0;
152 
172  virtual bool failureDetected() const = 0;
173 
180  virtual void forceFailureMode() = 0;
181 
201  virtual void launchCopyKernel(PxGpuCopyDesc* desc, uint32_t count, CUstream stream) = 0;
202 
209  virtual PxBaseTask& getPreLaunchTask() = 0;
210 
217  virtual void addPreLaunchDependent(PxBaseTask& dependent) = 0;
218 
225  virtual PxBaseTask& getPostLaunchTask() = 0;
226 
233  virtual void addPostLaunchDependent(PxBaseTask& dependent) = 0;
234 
235 protected:
240  virtual ~PxGpuDispatcher() {}
241 };
242 
244 
245 } // end physx namespace
246 
247 
248 #endif // PXTASK_PXGPUDISPATCHER_H
Definition: GuContactBuffer.h:37
Base class of all task types.
Definition: PxTask.h:45
virtual void stopSimulation()=0
Record the end of a simulation frame.
virtual void forceFailureMode()=0
Force the PxGpuDispatcher into failure mode.
A GpuTask dispatcher.
Definition: PxGpuDispatcher.h:71
virtual void submitTask(PxTask &task)=0
Submit a GpuTask for execution.
struct CUstream_st * CUstream
Definition: PxGpuDispatcher.h:35
virtual void startGroup()=0
Record the start of a GpuTask batch submission.
virtual PxCudaContextManager * getCudaContextManager()=0
Retrieve the PxCudaContextManager associated with this PxGpuDispatcher.
#define PX_POP_PACK
Definition: PxPreprocessor.h:343
virtual void launchCopyKernel(PxGpuCopyDesc *desc, uint32_t count, CUstream stream)=0
Launch a copy kernel with arbitrary number of copy commands.
virtual ~PxGpuDispatcher()
protected destructor
Definition: PxGpuDispatcher.h:240
virtual void addCompletionPrereq(PxBaseTask &task)=0
Add a CUDA completion prerequisite dependency to a task.
virtual PxBaseTask & getPreLaunchTask()=0
Query pre launch task that runs before launching gpu kernels.
virtual void addPostLaunchDependent(PxBaseTask &dependent)=0
Adds a task that gets executed after the post launch task.
virtual void startSimulation()=0
Record the start of a simulation step.
virtual PxBaseTask & getPostLaunchTask()=0
Query post launch task that runs after the gpu is done.
virtual void addPreLaunchDependent(PxBaseTask &dependent)=0
Adds a gpu launch task that gets executed after the pre launch task.
virtual void finishGroup()=0
Record the end of a GpuTask batch submission.
virtual bool failureDetected() const =0
Returns true if a CUDA call has returned a non-recoverable error.
#define PX_PUSH_PACK_DEFAULT
Definition: PxPreprocessor.h:342
A PxBaseTask implementation with deferred execution and full dependencies.
Definition: PxTask.h:111