Talvos  0.1
SPIR-V interpreter and dynamic analysis framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | Private Attributes | List of all members
talvos::Device Class Reference

A Device instance encapsulates properties and state for the virtual device. More...

#include <talvos/Device.h>

Public Member Functions

 Device ()
 
 ~Device ()
 
MemorygetGlobalMemory ()
 Get the global memory instance associated with this device. More...
 
PipelineExecutorgetPipelineExecutor ()
 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
 
Deviceoperator= (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

MemoryGlobalMemory
 The global memory of this device. More...
 
std::vector< std::pair< void
*, Plugin * > > 
Plugins
 List of plugins that are currently loaded. More...
 
PipelineExecutorExecutor
 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...
 

Detailed Description

A Device instance encapsulates properties and state for the virtual device.

Definition at line 29 of file Device.h.

Constructor & Destructor Documentation

talvos::Device::Device ( )

Definition at line 48 of file Device.cpp.

talvos::Device::~Device ( )

Definition at line 110 of file Device.cpp.

talvos::Device::Device ( const Device )
delete

Member Function Documentation

Memory& talvos::Device::getGlobalMemory ( )
inline

Get the global memory instance associated with this device.

Definition at line 42 of file Device.h.

PipelineExecutor& talvos::Device::getPipelineExecutor ( )
inline

Returns the PipelineExecutor for this device.

Definition at line 45 of file Device.h.

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.

Device& talvos::Device::operator= ( const Device )
delete
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.

Member Data Documentation

PipelineExecutor* talvos::Device::Executor
private

The pipeline executor instance.

Definition at line 95 of file Device.h.

std::mutex talvos::Device::FenceMutex
mutableprivate

A mutex for synchronizing threads waiting on fence signals.

Definition at line 101 of file Device.h.

std::condition_variable talvos::Device::FenceSignaled
mutableprivate

Condition variable to notify threads waiting on fence signals.

Definition at line 104 of file Device.h.

Memory* talvos::Device::GlobalMemory
private

The global memory of this device.

Definition at line 89 of file Device.h.

size_t talvos::Device::MaxErrors
private

The maximum number of errors to report.

Definition at line 98 of file Device.h.

std::vector<std::pair<void *, Plugin *> > talvos::Device::Plugins
private

List of plugins that are currently loaded.

Definition at line 92 of file Device.h.