Talvos
0.1
SPIR-V interpreter and dynamic analysis framework
|
An internal class that handles pipeline execution, including the interactive debugger. More...
#include </home/travis/build/talvos/talvos/lib/talvos/PipelineExecutor.h>
Classes | |
struct | Fragment |
Internal structure to hold fragment data. More... | |
struct | PointPrimitive |
Point primitive data, used for rasterization. More... | |
struct | RenderPipelineState |
State to be carried through the execution of a render pipeline. More... | |
struct | TrianglePrimitive |
Triangle primitive data, used for rasterization. More... | |
struct | VertexOutput |
Outputs from a vertex shading stage. More... | |
Public Member Functions | |
PipelineExecutor (PipelineExecutorKey Key, Device &Dev) | |
Create a pipeline executor on Dev . More... | |
~PipelineExecutor () | |
Destroy a pipeline executor. More... | |
const Invocation * | getCurrentInvocation () const |
Returns the current invocation being executed. More... | |
const Workgroup * | getCurrentWorkgroup () const |
Returns the current workgroup being executed. More... | |
const PipelineStage & | getCurrentStage () const |
Returns the pipeline stage that is currently being executed. More... | |
bool | isWorkerThread () const |
Returns true if the calling thread is a PipelineExecutor worker thread. More... | |
void | run (const DispatchCommand &Cmd) |
Run a compute dispatch command to completion. More... | |
void | run (const DrawCommandBase &Cmd) |
Run a draw command to completion. More... | |
void | signalError () |
Signal that an error has occurred, breaking the interactive debugger. More... | |
PipelineExecutor (const PipelineExecutor &)=delete | |
PipelineExecutor & | operator= (const PipelineExecutor &)=delete |
Private Member Functions | |
void | doWork (std::function< void()> Task) |
Execute a function on every worker thread. More... | |
void | runWorker () |
Worker thread entry point. More... | |
void | runComputeWorker () |
Worker thread entry point for compute shaders. More... | |
void | runTriangleFragmentWorker (TrianglePrimitive Primitive, const PipelineContext &PC, const RenderPassInstance &RPI, const VkViewport &Viewport) |
Worker thread entry point for triangle rasterization. More... | |
void | runPointFragmentWorker (PointPrimitive Primitive, const RenderPassInstance &RPI) |
Worker thread entry point for point rasterization. More... | |
void | runVertexWorker (RenderPipelineState *State, uint32_t InstanceIndex) |
Worker thread entry point for vertex shaders. More... | |
void | finalizeVariables (const DescriptorSetMap &DSM) |
Finalize variables. More... | |
void | initializeVariables (const DescriptorSetMap &DSM, uint64_t PushConstantAddress) |
Initialize variables. More... | |
void | buildPendingFragments (const DrawCommandBase &Cmd, int XMinFB, int XMaxFB, int YMinFB, int YMaxFB) |
Helper function to build list of pending fragments in a bounding box. More... | |
void | processFragment (const Fragment &Frag, const RenderPassInstance &RPI, std::function< void(uint32_t, uint32_t, const Variable *, const Type *, Memory *, uint64_t)> GenLocData) |
Helper function to process a fragment. More... | |
void | rasterizePoint (const DrawCommandBase &Cmd, const VkViewport &Viewport, const VertexOutput &Vertex) |
Helper function to rasterize a point primitive. More... | |
void | rasterizeTriangle (const DrawCommandBase &Cmd, const VkViewport &Viewport, const VertexOutput &VA, const VertexOutput &VB, const VertexOutput &VC) |
Helper function to rasterize a triangle primitive. More... | |
void | loadVertexInput (const PipelineContext &PC, Memory *PipelineMemory, uint64_t Address, uint32_t VertexIndex, uint32_t InstanceIndex, uint32_t Location, uint32_t Component, const Type *ElemTy) const |
Helper function to copy vertex input data to pipeline memory. More... | |
Workgroup * | createWorkgroup (Dim3 GroupId) const |
Create a compute shader workgroup and its work-item invocations. More... | |
void | interact () |
Trigger interaction with the user (if necessary). More... | |
void | printContext () const |
Print the context for the current invocation. More... | |
Interactive command handlers. | |
Return true when the interpreter should resume executing instructions. | |
bool | brk (const std::vector< std::string > &Args) |
bool | breakpoint (const std::vector< std::string > &Args) |
bool | cont (const std::vector< std::string > &Args) |
bool | help (const std::vector< std::string > &Args) |
bool | print (const std::vector< std::string > &Args) |
bool | quit (const std::vector< std::string > &Args) |
bool | step (const std::vector< std::string > &Args) |
bool | swtch (const std::vector< std::string > &Args) |
Static Private Member Functions | |
static Vec4 | getPosition (const VertexOutput &Out) |
Helper function to get the position from vertex output builtin data. More... | |
Private Attributes | |
Device & | Dev |
The device this shader is executing on. More... | |
const Command * | CurrentCommand |
The command currently being executed. More... | |
const PipelineStage * | CurrentStage |
The pipeline stage currently being executed. More... | |
std::vector< Object > | Objects |
The initial object values for each invocation. More... | |
unsigned | NumThreads |
The number of worker threads currently executing. More... | |
std::vector< std::thread > | WorkerThreads |
List of worker threads. More... | |
bool | ShutDownWorkers |
Signal to shut down worker threads. More... | |
std::function< void()> | CurrentTask |
The function that worker threads should execute. More... | |
uint32_t | CurrentTaskID = 0 |
ID used to identify the current task. More... | |
std::mutex | WorkerMutex |
Mutex used to synchronize with worker threads. More... | |
std::condition_variable | WorkerSignal |
Condition variable used to wake worker threads. More... | |
std::condition_variable | MasterSignal |
Condition variable used to notify master thread that work is complete. More... | |
std::atomic< uint32_t > | NumWorkersFinished |
Tally of the number of workers that have finished the current task. More... | |
std::atomic< size_t > | NextWorkIndex |
Index of next item of work to execute in the current task. More... | |
std::vector< Dim3 > | PendingGroups |
Pool of group IDs pending creation and execution. More... | |
std::vector< Workgroup * > | RunningGroups |
Pool of groups that have begun execution and been suspended. More... | |
std::vector< Dim3 > | PendingFragments |
Pool of framebuffer coordinates pending fragment processing. More... | |
bool | Continue |
True when the user has used continue command. More... | |
bool | Interactive |
True when interactive mode is enabled. More... | |
std::vector< std::string > | LastLine |
Tokens for the most recent interactive command entered. More... | |
Static Private Attributes | |
static uint32_t | NextBreakpoint = 1 |
Index of the next breakpoint to create. More... | |
static std::map< uint32_t, uint32_t > | Breakpoints |
Map from breakpoint ID to instruction result ID. More... | |
An internal class that handles pipeline execution, including the interactive debugger.
Definition at line 54 of file PipelineExecutor.h.
talvos::PipelineExecutor::PipelineExecutor | ( | PipelineExecutorKey | Key, |
Device & | Dev | ||
) |
Create a pipeline executor on Dev
.
Definition at line 109 of file PipelineExecutor.cpp.
talvos::PipelineExecutor::~PipelineExecutor | ( | ) |
Destroy a pipeline executor.
Definition at line 123 of file PipelineExecutor.cpp.
|
delete |
|
private |
Definition at line 1915 of file PipelineExecutor.cpp.
|
private |
Definition at line 1889 of file PipelineExecutor.cpp.
|
private |
Helper function to build list of pending fragments in a bounding box.
Definition at line 475 of file PipelineExecutor.cpp.
|
private |
Definition at line 1965 of file PipelineExecutor.cpp.
Create a compute shader workgroup and its work-item invocations.
Definition at line 136 of file PipelineExecutor.cpp.
|
private |
Execute a function on every worker thread.
Definition at line 985 of file PipelineExecutor.cpp.
|
private |
Finalize variables.
Definition at line 1382 of file PipelineExecutor.cpp.
const Invocation * talvos::PipelineExecutor::getCurrentInvocation | ( | ) | const |
Returns the current invocation being executed.
Definition at line 206 of file PipelineExecutor.cpp.
|
inline |
Returns the pipeline stage that is currently being executed.
Definition at line 76 of file PipelineExecutor.h.
const Workgroup * talvos::PipelineExecutor::getCurrentWorkgroup | ( | ) | const |
Returns the current workgroup being executed.
Definition at line 211 of file PipelineExecutor.cpp.
|
staticprivate |
Helper function to get the position from vertex output builtin data.
Definition at line 1589 of file PipelineExecutor.cpp.
|
private |
Definition at line 1971 of file PipelineExecutor.cpp.
|
private |
Initialize variables.
Definition at line 1423 of file PipelineExecutor.cpp.
|
private |
Trigger interaction with the user (if necessary).
Map a command with a long and short name to a handler function.
Definition at line 1742 of file PipelineExecutor.cpp.
bool talvos::PipelineExecutor::isWorkerThread | ( | ) | const |
Returns true if the calling thread is a PipelineExecutor worker thread.
Definition at line 216 of file PipelineExecutor.cpp.
|
private |
Helper function to copy vertex input data to pipeline memory.
Definition at line 1614 of file PipelineExecutor.cpp.
|
delete |
|
private |
Definition at line 1988 of file PipelineExecutor.cpp.
|
private |
Print the context for the current invocation.
Definition at line 1849 of file PipelineExecutor.cpp.
|
private |
Helper function to process a fragment.
Definition at line 776 of file PipelineExecutor.cpp.
|
private |
Definition at line 2020 of file PipelineExecutor.cpp.
|
private |
Helper function to rasterize a point primitive.
Definition at line 1498 of file PipelineExecutor.cpp.
|
private |
Helper function to rasterize a triangle primitive.
Definition at line 1532 of file PipelineExecutor.cpp.
void talvos::PipelineExecutor::run | ( | const DispatchCommand & | Cmd | ) |
Run a compute dispatch command to completion.
Definition at line 218 of file PipelineExecutor.cpp.
void talvos::PipelineExecutor::run | ( | const DrawCommandBase & | Cmd | ) |
Run a draw command to completion.
Definition at line 263 of file PipelineExecutor.cpp.
|
private |
Worker thread entry point for compute shaders.
Definition at line 378 of file PipelineExecutor.cpp.
|
private |
Worker thread entry point for point rasterization.
Definition at line 1011 of file PipelineExecutor.cpp.
|
private |
Worker thread entry point for triangle rasterization.
Definition at line 1051 of file PipelineExecutor.cpp.
|
private |
Worker thread entry point for vertex shaders.
Definition at line 1187 of file PipelineExecutor.cpp.
|
private |
Worker thread entry point.
Definition at line 951 of file PipelineExecutor.cpp.
void talvos::PipelineExecutor::signalError | ( | ) |
Signal that an error has occurred, breaking the interactive debugger.
Definition at line 1579 of file PipelineExecutor.cpp.
|
private |
Definition at line 2022 of file PipelineExecutor.cpp.
|
private |
Definition at line 2038 of file PipelineExecutor.cpp.
|
staticprivate |
Map from breakpoint ID to instruction result ID.
Definition at line 240 of file PipelineExecutor.h.
|
private |
True when the user has used continue
command.
Definition at line 224 of file PipelineExecutor.h.
|
private |
The command currently being executed.
Definition at line 173 of file PipelineExecutor.h.
|
private |
The pipeline stage currently being executed.
Definition at line 176 of file PipelineExecutor.h.
|
private |
The function that worker threads should execute.
Definition at line 191 of file PipelineExecutor.h.
|
private |
ID used to identify the current task.
Definition at line 194 of file PipelineExecutor.h.
|
private |
The device this shader is executing on.
Definition at line 170 of file PipelineExecutor.h.
|
private |
True when interactive mode is enabled.
Definition at line 225 of file PipelineExecutor.h.
|
private |
Tokens for the most recent interactive command entered.
Definition at line 234 of file PipelineExecutor.h.
|
private |
Condition variable used to notify master thread that work is complete.
Definition at line 203 of file PipelineExecutor.h.
|
staticprivate |
Index of the next breakpoint to create.
Definition at line 237 of file PipelineExecutor.h.
|
private |
Index of next item of work to execute in the current task.
Definition at line 209 of file PipelineExecutor.h.
|
private |
The number of worker threads currently executing.
Definition at line 182 of file PipelineExecutor.h.
|
private |
Tally of the number of workers that have finished the current task.
Definition at line 206 of file PipelineExecutor.h.
|
private |
The initial object values for each invocation.
Definition at line 179 of file PipelineExecutor.h.
|
private |
Pool of framebuffer coordinates pending fragment processing.
Definition at line 218 of file PipelineExecutor.h.
|
private |
Pool of group IDs pending creation and execution.
Definition at line 212 of file PipelineExecutor.h.
|
private |
Pool of groups that have begun execution and been suspended.
Definition at line 215 of file PipelineExecutor.h.
|
private |
Signal to shut down worker threads.
Definition at line 188 of file PipelineExecutor.h.
|
private |
Mutex used to synchronize with worker threads.
Definition at line 197 of file PipelineExecutor.h.
|
private |
Condition variable used to wake worker threads.
Definition at line 200 of file PipelineExecutor.h.
|
private |
List of worker threads.
Definition at line 185 of file PipelineExecutor.h.