Skip to content

Fix 32-bit count wrap in chase counter#55

Open
Alexandre425 wants to merge 1 commit into
google:masterfrom
Alexandre425:fix-32bit-count-wrap
Open

Fix 32-bit count wrap in chase counter#55
Alexandre425 wants to merge 1 commit into
google:masterfrom
Alexandre425:fix-32bit-count-wrap

Conversation

@Alexandre425

Copy link
Copy Markdown

The per-thread chase counter was (32-bit), which wraps at 2^32 iterations. At high throughputs (>69 GB/s in a 500 ms sample) the counter wraps once or more, making the fastest pointer-chase runs report inflated latency.

Change the field to uint64_t, eliminating wrap on any realistic measurement window. multiload.c already had this fix (volatile uint64_t count).


Results (Ryzen 7 7735HS, 1 thread, parallel10)

Below is the effective, core-centric bandwidth for a sweep across memory sizes, assuming bandwidth = 8 bytes / average latency (the value reported by multichase)

Before

Note the low reported performance in the L1, where the bandwidth is the highest, and where the counter overflows. The reported performance immediately shoots up when bandwidth drops below the overflow threshold.

image

After:

image

The per-thread chase counter was (32-bit), which wraps at 2^32
iterations. At high throughputs (>69 GB/s in a 500 ms sample) the
counter wraps once or more, making the fastest pointer-chase runs report
inflated latency.

Change the field to 'uint64_t', eliminating wrap on any realistic
measurement window. multiload.c already had this fix (volatile uint64_t
count).
@google-cla

google-cla Bot commented Jul 7, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

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.

1 participant