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
MnemeRecordingBackend.hpp
Go to the documentation of this file.
1#pragma once
2
13
14#include <cstddef>
15#include <cstdint>
16#include <cstdlib>
17#include <memory>
18#include <optional>
19#include <utility>
20
21#include <llvm/ADT/DenseMap.h>
22#include <llvm/ADT/DenseSet.h>
23
24namespace mneme {
25
26template <DeviceVendors VendorTypes>
27class RecordingBackend final : public RecorderBackend<VendorTypes> {
29 using MnemeDeviceRT = typename Base::MnemeDeviceRT;
30 using DeviceError_t = typename Base::DeviceError_t;
31 using DeviceStream_t = typename Base::DeviceStream_t;
32 using StartedTiming = typename LaunchTimer<VendorTypes>::StartedTiming;
33
35 std::unique_ptr<LaunchTimer<VendorTypes>> Timer;
37 BlobsByAddress<VendorTypes> AllocatedBlobs;
38 // Allocations served by the vendor runtime (pinned, pitched, stream-ordered,
39 // managed where Mneme cannot place it, ...). They are not captured, but the
40 // application may release them with the device free, which must then be
41 // forwarded.
42 llvm::DenseSet<void *> PassthroughAllocs;
43 // Managed allocations that the vendor runtime made at an address Mneme
44 // chose, with the mapping the runtime made for each. They are captured like
45 // Mneme's own blobs, but the runtime keeps owning and releasing their memory.
46 llvm::DenseMap<void *, ManagedMapping> ManagedBlobs;
47 std::unique_ptr<PageManager<VendorTypes>> PM;
48 std::unique_ptr<DeviceChunkSource<VendorTypes>> DeviceChunks;
49 std::unique_ptr<ChunkAllocator> DevicePacker;
50 // Address space for the mappings behind managed allocations; null unless
51 // managed allocations can be placed.
52 std::unique_ptr<ReservedChunkSource<VendorTypes>> ReservedChunks;
53 std::unique_ptr<ChunkAllocator> ReservedPacker;
54 bool WarnedUnpacked = false;
55
56 // The exit handler that drains the timer is registered on the first timed
57 // launch, after the device runtime has initialized, so it runs before the
58 // runtime's own exit handlers tear it down.
59 inline static RecordingBackend *TimedBackend = nullptr;
60
61 // NOTE: We only keep track of the first time we set the device id. Once we
62 // create the allocator we assume that the allocations go to the same device.
63 int DeviceID = -1;
64
65 PageManager<VendorTypes> &getOrCreatePageManager() {
66 if (PM)
67 return *PM;
68
69 // NOTE: We need this arch cause internally we initialize the device.
70 // FIXME: We need to have a DeviceTrait function to initialize the GPU
71 // and call it separately here. Let's do this on a separate PR.
72 auto arch = MnemeDeviceRT::GetDeviceArch();
73 LOG_DEBUG("Initializing system {}", arch);
74 if (DeviceID == -1)
75 Runtime.origGetDeviceID(&DeviceID);
76 PM = std::make_unique<PageManager<VendorTypes>>();
77 DeviceChunks =
78 std::make_unique<DeviceChunkSource<VendorTypes>>(*PM, DeviceID);
79 DevicePacker = std::make_unique<ChunkAllocator>(*DeviceChunks,
80 Config::get().ChunkSize);
81 if (MnemeDeviceRT::PlacesManagedMemory) {
82 ReservedChunks = std::make_unique<ReservedChunkSource<VendorTypes>>(*PM);
83 ReservedPacker = std::make_unique<ChunkAllocator>(
84 *ReservedChunks, Config::get().ChunkSize);
85 }
86 return *PM;
87 }
88
89 // Captures the memory at Ptr from now on. Managed is the runtime's mapping
90 // when Ptr is a managed allocation.
91 void addBlob(void *Ptr, uint64_t ActualSize, uint64_t Size,
92 std::optional<ManagedMapping> Managed = std::nullopt) {
93 MnemeMemoryBlob<VendorTypes> Blob(ActualSize, nullptr, Size);
94 Blob.mapInto(Ptr);
95 AllocatedBlobs.insert({Ptr, std::move(Blob)});
96 if (Managed)
97 ManagedBlobs.insert({Ptr, *Managed});
98 }
99
100 // Releases the blob at Ptr and stops capturing its memory.
101 DeviceError_t dropBlob(void *Ptr) {
102 auto It = AllocatedBlobs.find(Ptr);
103 auto ret = It->second.release();
104 AllocatedBlobs.erase(It);
105 ManagedBlobs.erase(Ptr);
106 return ret;
107 }
108
109 struct OwningBlob {
111 uint64_t Offset;
112 };
113
114 // The blob that holds the byte at ptr, and ptr's offset in it.
115 std::optional<OwningBlob> findOwningBlob(const void *ptr) {
116 auto It = AllocatedBlobs.upper_bound(const_cast<void *>(ptr));
117 if (It == AllocatedBlobs.begin())
118 return std::nullopt;
119
120 --It;
121 uint64_t Offset = reinterpret_cast<std::uintptr_t>(ptr) -
122 reinterpret_cast<std::uintptr_t>(It->first);
123 if (Offset >= It->second.getSize())
124 return std::nullopt;
125 return OwningBlob{It, Offset};
126 }
127
128 // The caller must first wait for work that may still use the memory.
129 DeviceError_t releaseBlob(void *ptr) {
130 const auto &Blob = AllocatedBlobs.find(ptr)->second;
131 uint64_t ActualSize = Blob.getActualSize();
132 LOG_DEBUG("Intercepted device Free PTR:{} SIZE:{} ACTUALSIZE:{}", ptr,
133 Blob.getSize(), ActualSize);
134 auto ret = dropBlob(ptr);
135 DevicePacker->release(ptr, ActualSize);
136 return ret;
137 }
138
139 void registerExitDrain() {
140 if (TimedBackend)
141 return;
142 TimedBackend = this;
143 std::atexit([] {
144 if (TimedBackend)
145 TimedBackend->drainTimer();
146 });
147 }
148
149 // Launches after the drain are still counted but no longer timed.
150 void drainTimer() {
151 if (!Timer)
152 return;
153 Timer->drain(DB);
154 Timer.reset();
155 }
156
157 DeviceError_t launchKernel(const void *func, dim3 &GridDim, dim3 &BlockDim,
158 void **Args, size_t SharedMem,
159 DeviceStream_t Stream) {
160 return Runtime.origLaunchKernel(func, GridDim, BlockDim, Args, SharedMem,
161 Stream);
162 }
163
164 // Requires Timer; Launch names the record the duration is added to.
165 DeviceError_t timeLaunchKernel(const void *func, dim3 &GridDim,
166 dim3 &BlockDim, void **Args, size_t SharedMem,
167 DeviceStream_t Stream,
168 const LaunchHandle &Launch) {
169 registerExitDrain();
170 Timer->collect(DB);
171 std::optional<StartedTiming> Started = Timer->begin(Launch, Stream);
172 auto ret = launchKernel(func, GridDim, BlockDim, Args, SharedMem, Stream);
173 if (Started)
174 Timer->end(*Started, ret);
175 return ret;
176 }
177
178 // Makes a managed allocation of size bytes at *ptr with the runtime's own
179 // managed malloc, with its mapping placed where replay can map it again, and
180 // captures it.
181 DeviceError_t captureManagedAlloc(void **ptr, size_t size,
182 unsigned int flags) {
183 const char *api = MnemeDeviceRT::getManagedMallocFnName();
184 getOrCreatePageManager();
185 DeviceError_t ret;
186 ManagedMapping Placed;
187 {
188 PlaceManagedMmap Placement(*ReservedPacker, size);
189 ret = Runtime.origMallocManaged(ptr, size, flags);
190 Placed = Placement.placed();
191 }
192 if (ret != MnemeDeviceRT::DeviceSuccess)
193 return ret;
194 if (!Placed.contains(*ptr, size))
195 LOG_FATAL("{} returned PTR:{} SIZE:{} outside the mapping Mneme placed "
196 "at {} SIZE:{}; this runtime does not map the allocation with "
197 "its own anonymous mmap, so Mneme cannot record it",
198 api, *ptr, size, reinterpret_cast<void *>(Placed.Start),
199 Placed.Size);
200
201 addBlob(*ptr, DevicePacker->actualSize(size), size, Placed);
202 LOG_DEBUG("Intercepted {} PTR:{} SIZE:{} MAPPING:{} MAPPINGSIZE:{}", api,
203 *ptr, size, reinterpret_cast<void *>(Placed.Start), Placed.Size);
204 return ret;
205 }
206
207 // Frees a captured managed allocation with Free, the runtime's own free
208 // named api, which must unmap its mapping before returning so that Mneme can
209 // keep the addresses reserved and reuse them.
210 template <typename FreeFn>
211 DeviceError_t releaseManagedBlob(void *ptr, const char *api, FreeFn Free) {
212 ManagedMapping Mapping = ManagedBlobs.lookup(ptr);
213 DeviceError_t ret;
214 bool WasUnmapped;
215 {
216 ReserveOnManagedMunmap Reserve(Mapping);
217 ret = Free();
218 WasUnmapped = Reserve.wasUnmapped();
219 }
220 if (ret != MnemeDeviceRT::DeviceSuccess) {
221 if (WasUnmapped)
222 LOG_FATAL("{} failed after unmapping PTR:{} MAPPING:{} SIZE:{}, so "
223 "Mneme can no longer record it",
224 api, ptr, reinterpret_cast<void *>(Mapping.Start),
225 Mapping.Size);
226 return ret;
227 }
228 if (!WasUnmapped)
229 LOG_FATAL("{} did not unmap the mapping at {} SIZE:{} of PTR:{} before "
230 "returning, so Mneme cannot keep its addresses reserved and "
231 "cannot record managed memory with this runtime",
232 api, reinterpret_cast<void *>(Mapping.Start), Mapping.Size,
233 ptr);
234 LOG_DEBUG("Forwarded free of captured managed allocation PTR:{}", ptr);
235 dropBlob(ptr);
236 ReservedPacker->release(reinterpret_cast<void *>(Mapping.Start),
237 ReservedPacker->actualSize(Mapping.Size));
238 return ret;
239 }
240
241public:
243 : Timer(createLaunchTimer<VendorTypes>(Config::get().KernelTiming)),
244 DB(Config::get().getDataDirectory(), Config::get().EpilogueType,
245 Config::get().CopySource, Config::get().KernelTiming) {}
246
247 bool setMetadataForPointer(const void *ptr, Metadata md) override {
248 auto It = AllocatedBlobs.find(const_cast<void *>(ptr));
249 if (It == AllocatedBlobs.end())
250 LOG_FATAL("annotation ptr={} tag={} is not the start of a recorded "
251 "allocation; annotate a pointer inside one with its size in "
252 "bytes",
253 ptr, md.tag.value_or("no_tag"));
254
255 auto &Blob = It->second;
256 auto Status = Blob.setAnnotation({0, Blob.getSize()}, md);
257 if (Status != AnnotationStatus::Ok)
258 LOG_FATAL("annotation {} ptr={} size={} builtin={} tag={}",
259 describeAnnotationStatus(Status), ptr, Blob.getSize(),
260 static_cast<unsigned>(md.builtin), md.tag.value_or("no_tag"));
261 return true;
262 }
263
264 bool setMetadataForRegion(const void *ptr, size_t bytes,
265 Metadata md) override {
266 auto Owner = findOwningBlob(ptr);
267 if (!Owner)
268 LOG_FATAL("region annotation ptr={} bytes={} tag={} is not inside a "
269 "recorded allocation",
270 ptr, bytes, md.tag.value_or("no_tag"));
271
272 auto &[BasePtr, Blob] = *Owner->It;
273 auto Status = Blob.setAnnotation({Owner->Offset, bytes}, md);
274 if (Status != AnnotationStatus::Ok)
275 LOG_FATAL("region annotation {} ptr={} base_ptr={} offset={} bytes={} "
276 "blob_size={} builtin={} elem_size={} tag={}",
277 describeAnnotationStatus(Status), ptr, BasePtr, Owner->Offset,
278 bytes, Blob.getSize(), static_cast<unsigned>(md.builtin),
279 builtinByteWidth(md.builtin), md.tag.value_or("no_tag"));
280 return true;
281 }
282
283 bool getMetadataForPointer(const void *ptr, Metadata &md) const override {
284 if (!ptr)
285 return false;
286
287 auto It = AllocatedBlobs.find(const_cast<void *>(ptr));
288 if (It == AllocatedBlobs.end())
289 return false;
290
291 md = It->second.annotationAt(0).MD;
292 return true;
293 }
294
295 bool eraseMetadataForPointer(const void *ptr) override {
296 if (!ptr)
297 return false;
298
299 auto It = AllocatedBlobs.find(const_cast<void *>(ptr));
300 if (It == AllocatedBlobs.end())
301 return false;
302
303 It->second.resetAnnotations();
304 return true;
305 }
306
307 DeviceError_t rtMalloc(void **ptr, size_t size) override {
308 // The runtime still initializes the device for an empty allocation.
309 if (size == 0) {
310 auto ret = Runtime.origMallocDevice(ptr, 0);
311 if (ret == MnemeDeviceRT::DeviceSuccess)
312 trackPassthroughAlloc(*ptr, 0, MnemeDeviceRT::getDeviceMallocFnName());
313 return ret;
314 }
315
316 getOrCreatePageManager();
317
318 uint64_t ActualSize = DevicePacker->actualSize(size);
319 if (!DevicePacker->packs(ActualSize) && !WarnedUnpacked) {
320 LOG_WARN("Mapping {}-byte allocation separately; raise "
321 "MNEME_CHUNK_SIZE to pack it",
322 size);
323 WarnedUnpacked = true;
324 }
325 *ptr = DevicePacker->allocate(ActualSize);
326 if (!*ptr)
327 return MnemeDeviceRT::DeviceOutOfMemory;
328 addBlob(*ptr, ActualSize, size);
329 LOG_DEBUG("Intercepted Device Malloc PTR:{} SIZE:{} ACTUALSIZE:{}", *ptr,
330 size, ActualSize);
331 return MnemeDeviceRT::DeviceSuccess;
332 }
333
334 DeviceError_t rtManagedMalloc(void **ptr, size_t size,
335 unsigned int flags) override {
336 if (MnemeDeviceRT::PlacesManagedMemory && size != 0)
337 return captureManagedAlloc(ptr, size, flags);
338
339 auto ret = Runtime.origMallocManaged(ptr, size, flags);
340 if (ret == MnemeDeviceRT::DeviceSuccess)
341 trackPassthroughAlloc(*ptr, size,
342 MnemeDeviceRT::getManagedMallocFnName());
343 return ret;
344 }
345
346 DeviceError_t rtHostMalloc(void **ptr, size_t size,
347 unsigned int flags) override {
348 auto ret = Runtime.origMallocPinned(ptr, size, flags);
349 if (ret == MnemeDeviceRT::DeviceSuccess)
350 trackPassthroughAlloc(*ptr, size, MnemeDeviceRT::getPinnedMallocFnName());
351 return ret;
352 }
353
354 void trackPassthroughAlloc(void *ptr, size_t size, const char *api) override {
355 if (!ptr)
356 return;
357 PassthroughAllocs.insert(ptr);
358 LOG_DEBUG("Intercepted {} PTR:{} SIZE:{}; will not be able to replay "
359 "Kernels accessing it",
360 api, ptr, size);
361 }
362
363 DeviceError_t rtFree(void *ptr) override {
364 if (ptr == nullptr) {
365 LOG_WARN("Mneme was instructed to de-allocate nullptr..., skipping");
366 return MnemeDeviceRT::DeviceSuccess;
367 }
368 if (ManagedBlobs.contains(ptr))
369 return releaseManagedBlob(ptr, MnemeDeviceRT::getDeviceFreeFnName(),
370 [&] { return Runtime.origFreeDevice(ptr); });
371 if (!AllocatedBlobs.count(ptr)) {
372 if (PassthroughAllocs.erase(ptr)) {
373 LOG_DEBUG("Forwarding free of vendor runtime allocation PTR:{}", ptr);
374 return Runtime.origFreeDevice(ptr);
375 }
376 LOG_CRITICAL("Free address that is not being allocated through Mneme {}",
377 ptr);
378 LOG_FATAL("Free address that is not being allocated through Mneme\n");
379 }
380 // Like hipFree, wait for kernels that may still use the memory, and report
381 // their errors.
382 auto ret = MnemeDeviceRT::DeviceSynchronize();
383 if (ret != MnemeDeviceRT::DeviceSuccess) {
384 LOG_WARN("Not freeing PTR:{}: device synchronize failed", ptr);
385 return ret;
386 }
387 return releaseBlob(ptr);
388 }
389
390 DeviceError_t rtFreeAsync(void *ptr, DeviceStream_t stream) override {
391 if (ManagedBlobs.contains(ptr))
392 return releaseManagedBlob(ptr, MnemeDeviceRT::getAsyncFreeFnName(), [&] {
393 return Runtime.origFreeAsync(ptr, stream);
394 });
395 if (AllocatedBlobs.count(ptr)) {
396 // Mneme releases its memory right away, so first wait for the work
397 // queued on the stream that may still use it. The sync fails during
398 // stream capture; keep the memory then.
399 auto ret = MnemeDeviceRT::DeviceStreamSynchronize(stream);
400 if (ret != MnemeDeviceRT::DeviceSuccess) {
401 LOG_WARN("Not freeing PTR:{}: stream synchronize failed", ptr);
402 return ret;
403 }
404 return releaseBlob(ptr);
405 }
406 if (ptr == nullptr || PassthroughAllocs.erase(ptr))
407 LOG_DEBUG("Forwarding async free of vendor runtime allocation PTR:{}",
408 ptr);
409 else
410 // Allocated by a function Mneme does not hook; let the runtime decide.
411 LOG_WARN("Forwarding async free of unknown address PTR:{}", ptr);
412 return Runtime.origFreeAsync(ptr, stream);
413 }
414
415 DeviceError_t rtHostFree(void *ptr) override {
416 if (ManagedBlobs.contains(ptr))
417 return releaseManagedBlob(ptr, MnemeDeviceRT::getPinnedFreeFnName(),
418 [&] { return Runtime.origFreeHost(ptr); });
419 PassthroughAllocs.erase(ptr);
420 auto ret = Runtime.origFreeHost(ptr);
421 LOG_DEBUG("Free pinned address:{}", ptr);
422 return ret;
423 }
424
425 DeviceError_t rtLaunchKernel(const void *func, dim3 &GridDim, dim3 &BlockDim,
426 void **Args, size_t SharedMem,
427 DeviceStream_t Stream) override {
428 getOrCreatePageManager();
429
430 auto Launch = DB.registerLaunch(func, GridDim, BlockDim, SharedMem);
431 if (!Launch) {
432 LOG_DEBUG("Kernel {} has no record", func);
433 return launchKernel(func, GridDim, BlockDim, Args, SharedMem, Stream);
434 }
435 const std::string &KernelName = DB.kernelName(Launch->StaticHash);
436
437 bool InRecordingScope =
440 auto CaptureEpilogue =
441 InRecordingScope ? DB.takeSnapshot<VendorTypes>(
442 func, *Launch, AllocatedBlobs, Args, Stream)
443 : std::nullopt;
444 if (CaptureEpilogue)
445 LOG_INFO("Successfully Recorded Prologue of Kernel {} NAME:{} GRID:({}, "
446 "{}, {}) "
447 "BLOCK:({}, {}, "
448 "{}) SHM_SIZE:{}",
449 func, KernelName, GridDim.x, GridDim.y, GridDim.z, BlockDim.x,
450 BlockDim.y, BlockDim.z, SharedMem);
451 auto ret =
452 Timer ? timeLaunchKernel(func, GridDim, BlockDim, Args, SharedMem,
453 Stream, *Launch)
454 : launchKernel(func, GridDim, BlockDim, Args, SharedMem, Stream);
455 if (CaptureEpilogue) {
456 (*CaptureEpilogue)();
457 LOG_INFO("Successfully Recorded Epilogue of Kernel {} NAME:{} GRID:({}, "
458 "{}, {}) "
459 "BLOCK:({}, {}, "
460 "{}) SHM_SIZE:{}",
461 func, KernelName, GridDim.x, GridDim.y, GridDim.z, BlockDim.x,
462 BlockDim.y, BlockDim.z, SharedMem);
463 // write kernel record incrementally after epilogue is recorded
464 DB.writeKernelJSON(Launch->StaticHash);
465 }
466 return ret;
467 }
468
469 DeviceError_t rtSetDevice(int deviceID) override {
470 auto ret = Runtime.origSetDeviceID(deviceID);
471 if (DeviceID == -1) {
472 DeviceID = deviceID;
473 } else if (PM == nullptr) {
474 DeviceID = deviceID;
475 } else if (deviceID == DeviceID) {
476 // no change; ignore
477 } else if (DeviceID != -1 && PM != nullptr) {
478 LOG_CRITICAL("Setting Device ID although it already "
479 "set and memory is "
480 "allocated");
481 }
482 return ret;
483 }
484
485 DeviceError_t rtGetDevice(int *deviceID) override {
486 return Runtime.origGetDeviceID(deviceID);
487 }
488
490 if (TimedBackend == this)
491 TimedBackend = nullptr;
492 DB.flush();
493
494 LOG_DEBUG("RecordingBackend destructor: releasing {} blobs",
495 AllocatedBlobs.size());
496
497 // Release all unreleased blobs before the map destructs
498 for (auto &Entry : AllocatedBlobs) {
499 auto &Blob = Entry.second;
500 if (Blob.getBlobAddr() != nullptr) {
501 LOG_DEBUG("Releasing blob at addr={} during recorder cleanup",
502 Blob.getBlobAddr());
503 Blob.release();
504 }
505 }
506
507 DevicePacker.reset();
508 DeviceChunks.reset();
509 // The runtime still owns these allocations and may touch or unmap them
510 // after Mneme is gone, so their reserved chunks must stay mapped.
511 if (!ManagedBlobs.empty()) {
512 (void)ReservedPacker.release();
513 (void)ReservedChunks.release();
514 }
515 ReservedPacker.reset();
516 ReservedChunks.reset();
517 PM.reset();
518
519 LOG_DEBUG("RecordingBackend destructor complete");
520 }
521};
522
523} // namespace mneme
#define LOG_INFO(...)
Definition MnemeLogger.hpp:110
#define LOG_CRITICAL(...)
Definition MnemeLogger.hpp:112
#define LOG_DEBUG(...)
Definition MnemeLogger.hpp:109
#define LOG_FATAL(...)
Definition MnemeLogger.hpp:113
#define LOG_WARN(...)
Definition MnemeLogger.hpp:111
Definition MnemePageManager.hpp:81
Definition MnemeConfig.hpp:288
const FilterMode RecordingFilterMode
Definition MnemeConfig.hpp:297
static Config & get()
Definition MnemeConfig.hpp:290
Definition MnemeMemory.hpp:227
void mapInto(void *VA)
Definition MnemeMemory.hpp:415
Definition MnemeManagedPlacement.hpp:55
const ManagedMapping & placed() const
Definition MnemeManagedPlacement.hpp:76
Definition MnemeSnapshot.hpp:479
Definition MnemeRecorderBackend.hpp:48
DeviceTraits< VendorTypes > MnemeDeviceRT
Definition MnemeRecorderBackend.hpp:50
typename MnemeDeviceRT::DeviceError_t DeviceError_t
Definition MnemeRecorderBackend.hpp:51
typename MnemeDeviceRT::DeviceStream_t DeviceStream_t
Definition MnemeRecorderBackend.hpp:52
DeviceError_t rtGetDevice(int *deviceID) override
Definition MnemeRecordingBackend.hpp:485
DeviceError_t rtFree(void *ptr) override
Definition MnemeRecordingBackend.hpp:363
DeviceError_t rtFreeAsync(void *ptr, DeviceStream_t stream) override
Definition MnemeRecordingBackend.hpp:390
DeviceError_t rtLaunchKernel(const void *func, dim3 &GridDim, dim3 &BlockDim, void **Args, size_t SharedMem, DeviceStream_t Stream) override
Definition MnemeRecordingBackend.hpp:425
bool getMetadataForPointer(const void *ptr, Metadata &md) const override
Definition MnemeRecordingBackend.hpp:283
DeviceError_t rtHostMalloc(void **ptr, size_t size, unsigned int flags) override
Definition MnemeRecordingBackend.hpp:346
~RecordingBackend()
Definition MnemeRecordingBackend.hpp:489
DeviceError_t rtHostFree(void *ptr) override
Definition MnemeRecordingBackend.hpp:415
DeviceError_t rtManagedMalloc(void **ptr, size_t size, unsigned int flags) override
Definition MnemeRecordingBackend.hpp:334
bool eraseMetadataForPointer(const void *ptr) override
Definition MnemeRecordingBackend.hpp:295
RecordingBackend()
Definition MnemeRecordingBackend.hpp:242
bool setMetadataForPointer(const void *ptr, Metadata md) override
Definition MnemeRecordingBackend.hpp:247
void trackPassthroughAlloc(void *ptr, size_t size, const char *api) override
Definition MnemeRecordingBackend.hpp:354
bool setMetadataForRegion(const void *ptr, size_t bytes, Metadata md) override
Definition MnemeRecordingBackend.hpp:264
DeviceError_t rtMalloc(void **ptr, size_t size) override
Definition MnemeRecordingBackend.hpp:307
DeviceError_t rtSetDevice(int deviceID) override
Definition MnemeRecordingBackend.hpp:469
Definition MnemeManagedPlacement.hpp:84
bool wasUnmapped() const
Definition MnemeManagedPlacement.hpp:101
int64_t u64 Size
Definition cupti_profile.cpp:179
bool scopeAllowsRecording(const void *Kernel) noexcept
Definition MnemeRecordScope.cpp:28
Definition MnemeAnnotation.cpp:3
const char * describeAnnotationStatus(AnnotationStatus Status)
Definition MnemeMemory.hpp:105
@ Scoped
Definition MnemeConfig.hpp:25
constexpr std::size_t builtinByteWidth(BuiltinDType builtin)
Definition MnemeAnnotation.hpp:54
std::unique_ptr< LaunchTimer< VendorTypes > > createLaunchTimer(KernelTimingType Type)
Definition MnemeLaunchTimer.hpp:100
@ Ok
Definition MnemeMemory.hpp:97
std::map< void *, MnemeMemoryBlob< VendorTypes > > BlobsByAddress
Definition MnemeMemory.hpp:605
Definition MnemeSnapshot.hpp:50
uint64_t StaticHash
Definition MnemeSnapshot.hpp:51
Definition MnemeLaunchTimer.hpp:24
Definition MnemeManagedPlacement.hpp:15
uint64_t Size
Definition MnemeManagedPlacement.hpp:17
bool contains(const void *Ptr, uint64_t Bytes) const
Definition MnemeManagedPlacement.hpp:19
uintptr_t Start
Definition MnemeManagedPlacement.hpp:16
Definition MnemeAnnotation.hpp:90
BuiltinDType builtin
Definition MnemeAnnotation.hpp:92
std::optional< std::string > tag
Definition MnemeAnnotation.hpp:102
Definition MnemeRecorderBackend.hpp:10