Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions docs/usage/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,10 @@ When omitted, all values default to those recorded during execution.

### Execution Options

| Option | Description |
| --------------------- | --------------------------------------------------------------------- |
| Option | Description |
| -------------- | --------------------------------------------------------------------- |
| `--iterations`, `-it` | Number of iterations to execute the kernel for statistical evaluation |
| `--reset-mode` | Memory reset mode between iterations: `bytes` or `diff` |


### Examples
Expand Down
24 changes: 24 additions & 0 deletions docs/usage/replay.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,27 @@ optimization pipelines or launch configurations.
For a detailed explanation of the annotation API, metadata fields,
threshold semantics, and a complete example, see
**[Usage → Verification](verification.md)**.

## Reset mode

Replay restores the recorded prologue before each measured kernel run.
When the recording has a diff epilogue, Mneme can avoid copying the
entire prologue by restoring only the prologue byte ranges that differ
in the epilogue:

```bash
mneme replay ... --reset-mode diff "default<O3>"
```

Supported modes are:

| Mode | Behavior |
| ---- | -------- |
| `bytes` | Always use the original full prologue reset. |
| `diff` | Require diff reset and fail if the epilogue is not a valid diff snapshot. Diff reset restores ranges with one device scatter kernel per warm reset. |

When no reset mode is supplied, Mneme selects `diff` for diff epilogue
snapshots and `bytes` otherwise. Diff reset uses raw ranges by default;
tune optional coalescing with
`MNEME_REPLAY_DIFF_SCATTER_MAX_GAP_BYTES` and chunk size with
`MNEME_REPLAY_DIFF_SCATTER_TASK_BYTES`.
21 changes: 21 additions & 0 deletions include/mneme/MnemeDeviceKernels.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#pragma once

#include <cstddef>
#include <cstdint>

#include "mneme/DeviceTraits.hpp"

namespace mneme {

struct DiffResetScatterTask {
uint8_t *Dst = nullptr;
const uint8_t *Src = nullptr;
size_t Size = 0;
};

template <DeviceVendors VendorTypes>
typename DeviceTraits<VendorTypes>::DeviceError_t launchDiffResetScatterKernel(
const DiffResetScatterTask *Tasks, size_t NumTasks,
typename DeviceTraits<VendorTypes>::DeviceStream_t Stream);

} // namespace mneme
Loading