Mneme
Mneme a tool allowing recording the execution of a GPU (CUDA/HIP) kernel and replaying that kernel as an independent executable.
Loading...
Searching...
No Matches
mneme Namespace Reference

Namespaces

namespace  detail
namespace  dev
namespace  trace
namespace  config_detail
namespace  util
namespace  python
namespace  rank_detail
namespace  snapshot_detail

Classes

class  MnemeCuptiProfiler
class  MnemeRocProfiler
struct  DeviceTraits
struct  builtin_dtype_of
struct  builtin_dtype_of< float >
struct  builtin_dtype_of< double >
struct  builtin_dtype_of< std::int8_t >
struct  builtin_dtype_of< std::uint8_t >
struct  builtin_dtype_of< std::int16_t >
struct  builtin_dtype_of< std::uint16_t >
struct  builtin_dtype_of< std::int32_t >
struct  builtin_dtype_of< std::uint32_t >
struct  builtin_dtype_of< std::int64_t >
struct  builtin_dtype_of< std::uint64_t >
struct  has_builtin_dtype
class  Span
struct  CompareResult
class  Config
struct  DispatchRecord
class  DispatchTracer
struct  KernelInfo
class  KernelTimer
class  LaunchTimer
class  ProfilerLaunchTimer
struct  ManagedMapping
class  PlaceManagedMmap
class  ReserveOnManagedMunmap
struct  ByteSpan
struct  MemoryAnnotation
class  MnemeBuffer
class  MnemeMemoryBlob
class  NullRecorder
class  MnemeRecorder
struct  RecorderRuntimeFunctions
class  RecorderBackend
class  RecordingBackend
struct  KernelRecordingPolicy
class  RecordingPolicy
class  record_scope
class  PrologueState
class  EpilogueState
class  ReplayMemState
struct  LaunchHandle
struct  LaunchTimes
struct  KernelInstance
class  SourceFileInfo
class  KernelInstancesCollection
class  RecordDatabase
struct  ReplayGlobalVar
struct  Snapshot
struct  SnapshotHeader
class  BaseSnapshotSource
class  SnapshotReader
class  BytesReaderV0
class  BytesReaderV1
class  DiffReaderV1
class  DiffReaderV2
class  SnapshotFormatRegistry
struct  SnapshotInput
class  SnapshotWriter
class  FormatWriter
class  BytesWriter
class  DiffWriter
class  BestWriter
struct  GlobalVarHeader
struct  BlobHeader

Typedefs

using DispatchSink = void (*)(void *Data, const DispatchRecord &Record)
using ToolCallback = void (*)()
template<DeviceVendors VendorTypes>
using BlobsByAddress = std::map<void *, MnemeMemoryBlob<VendorTypes>>
using GlobalSnapshotData

Enumerations

enum  DeviceVendors { HIP , CUDA }
enum  FuncAttributes { REGISTER_USAGE , LOCALMEM_USAGE , CONSTMEM_USAGE }
enum class  MapStatus { Mapped , Occupied , OutOfMemory }
enum class  BuiltinDType : std::uint8_t {
  U8 = 0 , I8 , U16 , I16 ,
  U32 , I32 , U64 , I64 ,
  F16 , F32 , F64
}
enum class  ThresholdKind : std::uint8_t { Absolute = 0 , Relative = 1 }
enum class  Norm : std::uint8_t { None = 0 , L1 , L2 , Linf }
enum class  LogLevel {
  Trace , Debug , Info , Warn ,
  Error , Critical , Off
}
enum class  EpilogueSnapshotType { Bytes , Diff , Best }
enum class  FilterMode { Default , Scoped , Config }
enum class  KernelTimingType { Off , Profiler }
enum class  AnnotationStatus {
  Ok , OutOfBounds , Empty , UnknownElementType ,
  StartsInsideElement , EndsInsideElement
}
enum class  MemoryLocation { Host , Device }
enum class  SnapshotKind : uint32_t { Bytes = 1 , Diff = 2 }

Functions

void annotate (const void *ptr, Metadata md)
void annotate (const void *ptr, std::size_t bytes, Metadata md)
void installCrashHandler ()
CompareResult compareDeviceBlobs (const char *Blob1, const char *Blob2, uint64_t NumBytes, Metadata Md)
DispatchTracer * mnemeCreateDispatchTracer ()
void mnemeConfigureDispatchTool (ToolCallback Initialize, ToolCallback)
bool hasAutoInitAnnotation (const llvm::Instruction &I)
bool purgeAutoInit (llvm::Module &M)
void * loadRTLib (const char *Name)
template<DeviceVendors Vendor, typename FnT>
FnT getRuntimeFn (const char *Name)
constexpr std::size_t builtinByteWidth (BuiltinDType builtin)
bool operator== (const Metadata &LHS, const Metadata &RHS)
bool operator!= (const Metadata &LHS, const Metadata &RHS)
template<class Container>
 Span (Container &) -> Span< std::remove_pointer_t< decltype(std::declval< Container & >().data())> >
template<class T, std::enable_if_t<!std::is_void_v< std::remove_cv_t< T > >, int > = 0>
void annotate (T *ptr, Metadata md={})
template<class T>
void annotate (Span< T > Region, Metadata Md)
std::optional< KernelTimingType > parseKernelTiming (std::string_view Value)
const char * getKernelTimingName (KernelTimingType Type)
template<typename DoneFn>
void waitForRecords (std::unique_lock< std::mutex > &Lock, std::condition_variable &Arrived, DispatchTracer &Tracer, DoneFn Done, std::chrono::steady_clock::duration Timeout)
void pruneMnemeGlobals (llvm::Module &M)
template<DeviceVendors VendorTypes>
std::unique_ptr< LaunchTimer< VendorTypes > > createLaunchTimer (KernelTimingType Type)
template<typename MmapFn>
void * placeOrForwardMmap (MmapFn Mmap, void *Addr, size_t Len, int Prot, int Flags, int Fd, off_t Off)
template<typename MunmapFn>
int reserveOrForwardMunmap (MunmapFn Munmap, void *Addr, size_t Len)
bool operator== (const ByteSpan &LHS, const ByteSpan &RHS)
bool operator!= (const ByteSpan &LHS, const ByteSpan &RHS)
bool operator== (const MemoryAnnotation &LHS, const MemoryAnnotation &RHS)
bool operator!= (const MemoryAnnotation &LHS, const MemoryAnnotation &RHS)
std::vector< MemoryAnnotation > readAnnotationsFromBuffer (const char *&Buffer)
void writeAnnotationsToStream (llvm::raw_ostream &OS, const std::vector< MemoryAnnotation > &Annotations)
size_t annotationsSerializedSize (const std::vector< MemoryAnnotation > &Annotations)
const char * describeAnnotationStatus (AnnotationStatus Status)
std::optional< int > detectDistributedRank ()
template<typename RecorderT, typename AllocatedFn, typename... ArgTs>
auto forwardAlloc (const char *Name, AllocatedFn Allocated, ArgTs... Args)
template<DeviceVendors VendorTypes>
std::unique_ptr< ReplayMemState< VendorTypes > > makeReplayPrologueState (const std::string &KernelName, const std::string &SnapshotFile)
template<DeviceVendors VendorTypes>
std::unique_ptr< ReplayMemState< VendorTypes > > makeReplayEpilogueState (const std::string &KernelName, const std::string &SnapshotFile, const std::string &BasePrologueFile)
std::pair< std::string, ReplayGlobalVar > readGlobalVarRecord (const char *&Buffer)
GlobalVarHeader globalVarHeader (const std::string &Name, const proteus::runtime::GlobalMetadata &GV)
template<DeviceVendors VendorTypes>
std::vector< uint8_t > readGlobalFromDevice (const proteus::runtime::GlobalMetadata &GV)
template<DeviceVendors VendorTypes>
std::unique_ptr< SnapshotWriter< VendorTypes > > makeEpilogueWriter (EpilogueSnapshotType Type, std::shared_ptr< const GlobalSnapshotData > PrologueGlobals)

Variables

template<class T>
constexpr bool has_builtin_dtype_v = has_builtin_dtype<T>::value
constexpr auto RecordWaitTimeout = std::chrono::seconds(10)
constexpr const char * DispatchTracerLibrary
constexpr int ReserveFlags = MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE

Typedef Documentation

◆ BlobsByAddress

template<DeviceVendors VendorTypes>
using mneme::BlobsByAddress = std::map<void *, MnemeMemoryBlob<VendorTypes>>

◆ DispatchSink

using mneme::DispatchSink = void (*)(void *Data, const DispatchRecord &Record)

◆ GlobalSnapshotData

Initial value:
std::unordered_map<std::string, std::vector<uint8_t>>

◆ ToolCallback

using mneme::ToolCallback = void (*)()

Enumeration Type Documentation

◆ AnnotationStatus

enum class mneme::AnnotationStatus
strong
Enumerator
Ok 
OutOfBounds 
Empty 
UnknownElementType 
StartsInsideElement 
EndsInsideElement 

◆ BuiltinDType

enum class mneme::BuiltinDType : std::uint8_t
strong
Enumerator
U8 
I8 
U16 
I16 
U32 
I32 
U64 
I64 
F16 
F32 
F64 

◆ DeviceVendors

Enumerator
HIP 
CUDA 

◆ EpilogueSnapshotType

enum class mneme::EpilogueSnapshotType
strong
Enumerator
Bytes 
Diff 
Best 

◆ FilterMode

enum class mneme::FilterMode
strong
Enumerator
Default 
Scoped 
Config 

◆ FuncAttributes

Enumerator
REGISTER_USAGE 
LOCALMEM_USAGE 
CONSTMEM_USAGE 

◆ KernelTimingType

enum class mneme::KernelTimingType
strong
Enumerator
Off 
Profiler 

◆ LogLevel

enum class mneme::LogLevel
strong
Enumerator
Trace 
Debug 
Info 
Warn 
Error 
Critical 
Off 

◆ MapStatus

enum class mneme::MapStatus
strong
Enumerator
Mapped 
Occupied 
OutOfMemory 

◆ MemoryLocation

enum class mneme::MemoryLocation
strong
Enumerator
Host 
Device 

◆ Norm

enum class mneme::Norm : std::uint8_t
strong
Enumerator
None 
L1 
L2 
Linf 

◆ SnapshotKind

enum class mneme::SnapshotKind : uint32_t
strong
Enumerator
Bytes 
Diff 

◆ ThresholdKind

enum class mneme::ThresholdKind : std::uint8_t
strong
Enumerator
Absolute 
Relative 

Function Documentation

◆ annotate() [1/4]

void mneme::annotate ( const void * ptr,
Metadata md )

◆ annotate() [2/4]

void mneme::annotate ( const void * ptr,
std::size_t bytes,
Metadata md )

◆ annotate() [3/4]

template<class T>
void mneme::annotate ( Span< T > Region,
Metadata Md )
inline

◆ annotate() [4/4]

template<class T, std::enable_if_t<!std::is_void_v< std::remove_cv_t< T > >, int > = 0>
void mneme::annotate ( T * ptr,
Metadata md = {} )
inline

◆ annotationsSerializedSize()

size_t mneme::annotationsSerializedSize ( const std::vector< MemoryAnnotation > & Annotations)
inline

◆ builtinByteWidth()

std::size_t mneme::builtinByteWidth ( BuiltinDType builtin)
constexpr

◆ compareDeviceBlobs()

CompareResult mneme::compareDeviceBlobs ( const char * Blob1,
const char * Blob2,
uint64_t NumBytes,
Metadata Md )

◆ createLaunchTimer()

template<DeviceVendors VendorTypes>
std::unique_ptr< LaunchTimer< VendorTypes > > mneme::createLaunchTimer ( KernelTimingType Type)

◆ describeAnnotationStatus()

const char * mneme::describeAnnotationStatus ( AnnotationStatus Status)
inline

◆ detectDistributedRank()

std::optional< int > mneme::detectDistributedRank ( )
inline

◆ forwardAlloc()

template<typename RecorderT, typename AllocatedFn, typename... ArgTs>
auto mneme::forwardAlloc ( const char * Name,
AllocatedFn Allocated,
ArgTs... Args )

◆ getKernelTimingName()

const char * mneme::getKernelTimingName ( KernelTimingType Type)
inline

◆ getRuntimeFn()

template<DeviceVendors Vendor, typename FnT>
FnT mneme::getRuntimeFn ( const char * Name)

◆ globalVarHeader()

GlobalVarHeader mneme::globalVarHeader ( const std::string & Name,
const proteus::runtime::GlobalMetadata & GV )
inline

◆ hasAutoInitAnnotation()

bool mneme::hasAutoInitAnnotation ( const llvm::Instruction & I)
inline

◆ installCrashHandler()

void mneme::installCrashHandler ( )

◆ loadRTLib()

void * mneme::loadRTLib ( const char * Name)
inline

◆ makeEpilogueWriter()

template<DeviceVendors VendorTypes>
std::unique_ptr< SnapshotWriter< VendorTypes > > mneme::makeEpilogueWriter ( EpilogueSnapshotType Type,
std::shared_ptr< const GlobalSnapshotData > PrologueGlobals )

◆ makeReplayEpilogueState()

template<DeviceVendors VendorTypes>
std::unique_ptr< ReplayMemState< VendorTypes > > mneme::makeReplayEpilogueState ( const std::string & KernelName,
const std::string & SnapshotFile,
const std::string & BasePrologueFile )

◆ makeReplayPrologueState()

template<DeviceVendors VendorTypes>
std::unique_ptr< ReplayMemState< VendorTypes > > mneme::makeReplayPrologueState ( const std::string & KernelName,
const std::string & SnapshotFile )

◆ mnemeConfigureDispatchTool()

void mneme::mnemeConfigureDispatchTool ( ToolCallback Initialize,
ToolCallback  )

◆ mnemeCreateDispatchTracer()

DispatchTracer * mneme::mnemeCreateDispatchTracer ( )

◆ operator!=() [1/3]

bool mneme::operator!= ( const ByteSpan & LHS,
const ByteSpan & RHS )
inline

◆ operator!=() [2/3]

bool mneme::operator!= ( const MemoryAnnotation & LHS,
const MemoryAnnotation & RHS )
inline

◆ operator!=() [3/3]

bool mneme::operator!= ( const Metadata & LHS,
const Metadata & RHS )
inline

◆ operator==() [1/3]

bool mneme::operator== ( const ByteSpan & LHS,
const ByteSpan & RHS )
inline

◆ operator==() [2/3]

bool mneme::operator== ( const MemoryAnnotation & LHS,
const MemoryAnnotation & RHS )
inline

◆ operator==() [3/3]

bool mneme::operator== ( const Metadata & LHS,
const Metadata & RHS )
inline

◆ parseKernelTiming()

std::optional< KernelTimingType > mneme::parseKernelTiming ( std::string_view Value)
inline

◆ placeOrForwardMmap()

template<typename MmapFn>
void * mneme::placeOrForwardMmap ( MmapFn Mmap,
void * Addr,
size_t Len,
int Prot,
int Flags,
int Fd,
off_t Off )

◆ pruneMnemeGlobals()

void mneme::pruneMnemeGlobals ( llvm::Module & M)

◆ purgeAutoInit()

bool mneme::purgeAutoInit ( llvm::Module & M)
inline

◆ readAnnotationsFromBuffer()

std::vector< MemoryAnnotation > mneme::readAnnotationsFromBuffer ( const char *& Buffer)
inline

◆ readGlobalFromDevice()

template<DeviceVendors VendorTypes>
std::vector< uint8_t > mneme::readGlobalFromDevice ( const proteus::runtime::GlobalMetadata & GV)

◆ readGlobalVarRecord()

std::pair< std::string, ReplayGlobalVar > mneme::readGlobalVarRecord ( const char *& Buffer)
inline

◆ reserveOrForwardMunmap()

template<typename MunmapFn>
int mneme::reserveOrForwardMunmap ( MunmapFn Munmap,
void * Addr,
size_t Len )

◆ Span()

template<class Container>
mneme::Span ( Container & ) ->Span< std::remove_pointer_t< decltype(std::declval< Container & >().data())> >

◆ waitForRecords()

template<typename DoneFn>
void mneme::waitForRecords ( std::unique_lock< std::mutex > & Lock,
std::condition_variable & Arrived,
DispatchTracer & Tracer,
DoneFn Done,
std::chrono::steady_clock::duration Timeout )

◆ writeAnnotationsToStream()

void mneme::writeAnnotationsToStream ( llvm::raw_ostream & OS,
const std::vector< MemoryAnnotation > & Annotations )
inline

Variable Documentation

◆ DispatchTracerLibrary

const char* mneme::DispatchTracerLibrary
inlineconstexpr
Initial value:
=
"libmneme_dispatch_tracer.so"

◆ has_builtin_dtype_v

template<class T>
bool mneme::has_builtin_dtype_v = has_builtin_dtype<T>::value
inlineconstexpr

◆ RecordWaitTimeout

auto mneme::RecordWaitTimeout = std::chrono::seconds(10)
inlineconstexpr

◆ ReserveFlags

int mneme::ReserveFlags = MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE
inlineconstexpr