Repository navigation
Conversation
The Makefile builds with -fno-unroll-loops. In clang this also disables
loop-vectorizer interleaving, so the stream-sum reduction is vectorized
with a single accumulator. Every iteration then waits on the previous
vector add, which caps one thread at one 16-byte add per add latency
(8 B/cycle on Neoverse N4, 16 B/cycle with 128-bit vpaddq on x86).
Below DRAM sizes stream-sum was measuring this add chain, not the memory
hierarchy.
Request an interleave count of 4 on the stream-sum loop so clang keeps
four independent accumulators. Explicit loop hints are honored even
with -fno-unroll-loops. The pragma is guarded by __clang__ because GCC
warns about unknown pragmas and the Makefile uses -Werror. GCC builds
are unchanged.
Single-thread stream-sum, MiB/s, median of 3 runs (pinned, -H):
Neoverse N4 (3.6 GHz) 32k 27343 -> 91700 1m 27070 -> 74800
64m 27340 -> 52600 1g 24030 -> 25040
Xeon 6985P-C (GNR) 32k 62780 -> 124270 1m 63900 -> 93640
64m 28770 -> 28770 4g 21950 -> 21960
There was a problem hiding this comment.
Code Review
This pull request modifies multiload.c to add a Clang-specific loop pragma (#pragma clang loop interleave_count(4)) inside the load_stream_sum function. This change requests independent accumulators to ensure the loop remains load-bound, bypassing the limitation where -fno-unroll-loops disables Clang vectorizer interleaving. The pragma is guarded with a preprocessor check for Clang to prevent GCC compiler warnings. There are no review comments, and we have no feedback to provide.
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.
The Makefile builds with -fno-unroll-loops. In clang this also disables loop-vectorizer interleaving, so the stream-sum reduction is vectorized with a single accumulator. Every iteration then waits on the previous vector add, which caps one thread at one 16-byte add per add latency (8 B/cycle on Neoverse N4, 16 B/cycle with 128-bit vpaddq on x86). Below DRAM sizes stream-sum was measuring this add chain, not the memory hierarchy.
Request an interleave count of 4 on the stream-sum loop so clang keeps four independent accumulators. Explicit loop hints are honored even with -fno-unroll-loops. The pragma is guarded by clang because GCC warns about unknown pragmas and the Makefile uses -Werror. GCC builds are unchanged.
Single-thread stream-sum, MiB/s, median of 3 runs (pinned, -H):
Neoverse N4 (3.6 GHz) 32k 27343 -> 91700 1m 27070 -> 74800
64m 27340 -> 52600 1g 24030 -> 25040
Xeon 6985P-C (GNR) 32k 62780 -> 124270 1m 63900 -> 93640
64m 28770 -> 28770 4g 21950 -> 21960