lat_mem_rd: add count override - #61
Open
nicolas-bouton wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new -c <max-count> option to lat_mem_rd to cap the per-iteration work performed in the pointer-chase loop while preserving the default behavior when the option is not provided.
Changes:
- Extend
struct mem_statewith acountfield to carry the computed (and optionally capped) loop count into the benchmark callback. - Add
-cCLI parsing and thread the max-count value throughloads()to cap the benchmark’s inner loop. - Adjust the nanoseconds/load calculation to use the new
state.count-based accounting.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/lib_mem.h | Adds count to mem_state so the benchmark loop can use a precomputed/capped iteration count. |
| src/lat_mem_rd.c | Implements -c option, computes capped count, uses it in the benchmark loop, and updates result scaling. |
Suppressed comments (1)
src/lat_mem_rd.c:71
- The new
-cflag capsstate.count, but eachcountunit executesHUNDRED(100 pointer-chase loads). The help text currently suggests it is a raw instruction/load count; please clarify the unit to avoid misinterpretation.
char *usage = "[-P <parallelism>] [-W <warmup>] [-N <repetitions>] [-s <start>] [-e <end>] [-c <max-count>] [-t [-p <chase-page-size>]] len [stride...]\n";
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
nicolas-bouton
force-pushed
the
nb/lat_mem_rd-add-count-override
branch
from
August 11, 2026 19:23
6315b6c to
0e537e6
Compare
Add a -c <count-limit> option to lat_mem_rd so the user can limit dynamically the number of instructions executed per iteration. Additionaly, this patch keeps the existing default behavior for normal runs. This changes allow to perform the same amount of instruction until the default count (computed with the size of the array currently tested and the stride) reach the count limit given by the user. * src/lat_mem_rd.c, src/lib_mem.h: Here. Signed-off-by: Nicolas Bouton <nicolas.bouton@sipearl.com>
nicolas-bouton
force-pushed
the
nb/lat_mem_rd-add-count-override
branch
from
August 12, 2026 08:06
0e537e6 to
bf37ac7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a -c option to lat_mem_rd so the user can limit dynamically the number of instructions executed per iteration. Additionaly, this patch keeps the existing default behavior for normal runs.
This changes allow to perform the same amount of instruction until the default count, computed with the size of the array currently tested and the stride, reach the maximum count given by the user.
src/lib_mem.h: Here.