Talvos
0.1
SPIR-V interpreter and dynamic analysis framework
|
A Device instance encapsulates properties and state for the virtual device. More...
#include <talvos/Device.h>
Public Member Functions | |
Device () | |
~Device () | |
Memory & | getGlobalMemory () |
Get the global memory instance associated with this device. More... | |
PipelineExecutor & | getPipelineExecutor () |
Returns the PipelineExecutor for this device. More... | |
bool | isThreadSafe () const |
Returns true if all of the loaded plugins are thread-safe. More... | |
void | notifyFenceSignaled () |
Notify the device that a fence was signaled. More... | |
void | reportError (const std::string &Error, bool Fatal=false) |
Report an error that has occurred during emulation. More... | |
bool | waitForFences (const std::vector< const bool * > &Fences, bool WaitAll, uint64_t Timeout) const |
Wait for fences to signal. More... | |
Device (const Device &)=delete | |
Device & | operator= (const Device &)=delete |
Plugin notification functions. | |
void | reportAtomicAccess (const Memory *Mem, uint64_t Address, uint64_t NumBytes, uint32_t Opcode, uint32_t Scope, uint32_t Semantics) |
void | reportCommandBegin (const Command *Cmd) |
void | reportCommandComplete (const Command *Cmd) |
void | reportInstructionExecuted (const Invocation *Invoc, const Instruction *Inst) |
void | reportInvocationBegin (const Invocation *Invoc) |
void | reportInvocationComplete (const Invocation *Invoc) |
void | reportMemoryLoad (const Memory *Mem, uint64_t Address, uint64_t NumBytes) |
void | reportMemoryMap (const Memory *Mem, uint64_t Base, uint64_t Offset, uint64_t NumBytes) |
void | reportMemoryStore (const Memory *Mem, uint64_t Address, uint64_t NumBytes, const uint8_t *Data) |
void | reportMemoryUnmap (const Memory *Mem, uint64_t Base) |
void | reportWorkgroupBegin (const Workgroup *Group) |
void | reportWorkgroupBarrier (const Workgroup *Group) |
void | reportWorkgroupComplete (const Workgroup *Group) |
Private Attributes | |
Memory * | GlobalMemory |
The global memory of this device. More... | |
std::vector< std::pair< void *, Plugin * > > | Plugins |
List of plugins that are currently loaded. More... | |
PipelineExecutor * | Executor |
The pipeline executor instance. More... | |
size_t | MaxErrors |
The maximum number of errors to report. More... | |
std::mutex | FenceMutex |
A mutex for synchronizing threads waiting on fence signals. More... | |
std::condition_variable | FenceSignaled |
Condition variable to notify threads waiting on fence signals. More... | |
A Device instance encapsulates properties and state for the virtual device.
talvos::Device::Device | ( | ) |
Definition at line 48 of file Device.cpp.
talvos::Device::~Device | ( | ) |
Definition at line 110 of file Device.cpp.
|
delete |
|
inline |
|
inline |
Returns the PipelineExecutor for this device.
bool talvos::Device::isThreadSafe | ( | ) | const |
Returns true if all of the loaded plugins are thread-safe.
Definition at line 132 of file Device.cpp.
void talvos::Device::notifyFenceSignaled | ( | ) |
Notify the device that a fence was signaled.
Definition at line 140 of file Device.cpp.
void talvos::Device::reportAtomicAccess | ( | const Memory * | Mem, |
uint64_t | Address, | ||
uint64_t | NumBytes, | ||
uint32_t | Opcode, | ||
uint32_t | Scope, | ||
uint32_t | Semantics | ||
) |
Definition at line 234 of file Device.cpp.
void talvos::Device::reportCommandBegin | ( | const Command * | Cmd | ) |
Definition at line 243 of file Device.cpp.
void talvos::Device::reportCommandComplete | ( | const Command * | Cmd | ) |
Definition at line 248 of file Device.cpp.
void talvos::Device::reportError | ( | const std::string & | Error, |
bool | Fatal = false |
||
) |
Report an error that has occurred during emulation.
This prints Error
to stderr along with the current execution context. If Fatal
is true, abort() will be called after handling the error.
Definition at line 146 of file Device.cpp.
void talvos::Device::reportInstructionExecuted | ( | const Invocation * | Invoc, |
const Instruction * | Inst | ||
) |
Definition at line 253 of file Device.cpp.
void talvos::Device::reportInvocationBegin | ( | const Invocation * | Invoc | ) |
Definition at line 259 of file Device.cpp.
void talvos::Device::reportInvocationComplete | ( | const Invocation * | Invoc | ) |
Definition at line 264 of file Device.cpp.
void talvos::Device::reportMemoryLoad | ( | const Memory * | Mem, |
uint64_t | Address, | ||
uint64_t | NumBytes | ||
) |
Definition at line 269 of file Device.cpp.
void talvos::Device::reportMemoryMap | ( | const Memory * | Mem, |
uint64_t | Base, | ||
uint64_t | Offset, | ||
uint64_t | NumBytes | ||
) |
Definition at line 285 of file Device.cpp.
void talvos::Device::reportMemoryStore | ( | const Memory * | Mem, |
uint64_t | Address, | ||
uint64_t | NumBytes, | ||
const uint8_t * | Data | ||
) |
Definition at line 291 of file Device.cpp.
void talvos::Device::reportMemoryUnmap | ( | const Memory * | Mem, |
uint64_t | Base | ||
) |
Definition at line 307 of file Device.cpp.
void talvos::Device::reportWorkgroupBarrier | ( | const Workgroup * | Group | ) |
Definition at line 317 of file Device.cpp.
void talvos::Device::reportWorkgroupBegin | ( | const Workgroup * | Group | ) |
Definition at line 312 of file Device.cpp.
void talvos::Device::reportWorkgroupComplete | ( | const Workgroup * | Group | ) |
Definition at line 322 of file Device.cpp.
bool talvos::Device::waitForFences | ( | const std::vector< const bool * > & | Fences, |
bool | WaitAll, | ||
uint64_t | Timeout | ||
) | const |
Wait for fences to signal.
If WaitAll
is true
, waits for all fences to signal, otherwise waits for any single fence to signal. Returns true
on success, or false
if Timeout
nanoseconds elapsed before the fences signaled.
Definition at line 329 of file Device.cpp.
|
private |
|
mutableprivate |
|
mutableprivate |
|
private |
|
private |