Skip to content

lat_mem_rd: add count override - #61

Open
nicolas-bouton wants to merge 1 commit into
intel:masterfrom
SiPearl:nb/lat_mem_rd-add-count-override
Open

lat_mem_rd: add count override#61
nicolas-bouton wants to merge 1 commit into
intel:masterfrom
SiPearl:nb/lat_mem_rd-add-count-override

Conversation

@nicolas-bouton

Copy link
Copy Markdown

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/lat_mem_rd.c,
    src/lib_mem.h: Here.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_state with a count field to carry the computed (and optionally capped) loop count into the benchmark callback.
  • Add -c CLI parsing and thread the max-count value through loads() 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 -c flag caps state.count, but each count unit executes HUNDRED (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.

Comment thread src/lat_mem_rd.c Outdated
Comment thread src/lat_mem_rd.c Outdated
Comment thread src/lat_mem_rd.c
Comment thread src/lat_mem_rd.c
@nicolas-bouton
nicolas-bouton force-pushed the nb/lat_mem_rd-add-count-override branch from 6315b6c to 0e537e6 Compare August 11, 2026 19:23
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
nicolas-bouton force-pushed the nb/lat_mem_rd-add-count-override branch from 0e537e6 to bf37ac7 Compare August 12, 2026 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants