Skip to content

[rocjitsu] Classify full Wave32 runs with vector stride checks - #14250

Merged
kuhar merged 2 commits into
developfrom
users/kuhar/rocjitsu-coalescer-stride
Oct 26, 2026
Merged

kuhar merged 2 commits into
developfrom
users/kuhar/rocjitsu-coalescer-stride

Conversation

@kuhar

@kuhar kuhar commented Oct 26, 2026

Copy link
Copy Markdown
Member

Transaction-aware coalescing introduced in #14170, and optimized in
#14215, still scans ordinary contiguous lane addresses one at a time.

Check full Wave32 operands with a private VM stride predicate before
the scalar scan. Select AVX-512 or AVX2 from the compile target
without per-wave CPU queries or dispatch. Reject wrapping sequences
and keep vector loads within the active addresses. Other masks, Wave64
and scalar-only builds retain the existing scan.

Keep the standard address sort in one non-inline function shared by
callback instantiations. Preserve transaction policy, overlap fallback
and callback order without adding a custom sorter or an arith
dependency.

Five paired sweeps of the original stride binaries across seven small
kernels show 0.43% fewer Wave32 instructions per warm launch on
default V3 and 0.46% fewer on V4. Matched V3 builds use 0.43% fewer
cycles; copy and gather use 1.04% and 0.63% fewer cycles. V3 atomic-
add uses 0.12% more cycles.

The measured original V4 binaries show 2.96% fewer Wave32 cycles, but
that observation is sensitive to binary layout and does not isolate an
algorithmic gain of that size. Wave64 cycle changes are likewise
layout-sensitive and are not treated as benefits of this optimization.

Measurements use GCC 16 Release/O3, matched baseline/candidate CPU
targets, fixed 2.5 GHz reserved CPUs, both workload locks and wait
checking enabled. Counters cover checked warm launches and
synchronization, excluding startup and JIT. These are host CPU counts,
not whole-application speedups.

The original stride performance receipts predate the shared host-
target prerequisite. They retain all 280 measured processes and their
numerical, runtime, affinity and nonmultiplexed-counter proofs. No new
performance measurements are attributed to the capability cleanup.

Validate the shared-capability integration with V3/V4 builds, 255 CTests,
15 FP-mode helpers and changed-file hooks. Check 24 native compiler/target
contexts, 212 include-order/override combinations, 25 synthetic probes,
20 property executables including ASan/UBSan, and 5,875,080 stride cases.
All 144 header-only override checks pass; four full-SIMD Clang forced-zero
contexts remain unsupported by the existing toolchain. Compare 18 stride
assembly pairs byte-for-byte against the original. Preserve the lock's
pause instruction and diagnose missing header dependencies in its
header-first unit test.

Run correctness checks under both workload locks outside the expired
reservation, as requested. Two full local Peanut review rounds and
focused follow-ups cover the prerequisite and its consumers.

kuhar added 2 commits October 25, 2026 15:08
SIMD helpers separately combine architecture, compiler, ISA and standard
library checks to select backends and mask fallbacks.

Make util/host_target.h own these decisions, including block conversions,
qualified AVX intrinsic backends, SIMD TS availability and the native
64-bit mask fallback. Include <version> before identifying the standard
library so detection is independent of include order. Preserve existing
command-line mask overrides under the RJ_ prefix and target-selection behavior.

Use RJ_-prefixed capability checks at call sites and remove local detection
macros. Follow the header style with #pragma once. Runtime CPU dispatch
and scalar execution controls stay separate.

Compile the lock's header-first unit test with undefined feature checks
as errors, so missing capability dependencies cannot silently remove
architecture spin hints.
Transaction-aware coalescing introduced in #14170, and optimized in
#14215, still scans ordinary contiguous lane addresses one at a time.

Check full Wave32 operands with a private VM stride predicate before
the scalar scan. Select AVX-512 or AVX2 from the compile target
without per-wave CPU queries or dispatch. Reject wrapping sequences
and keep vector loads within the active addresses. Other masks, Wave64
and scalar-only builds retain the existing scan.

Keep the standard address sort in one non-inline function shared by
callback instantiations. Preserve transaction policy, overlap fallback
and callback order without adding a custom sorter or an arith
dependency.

Five paired sweeps of the original stride binaries across seven small
kernels show 0.43% fewer Wave32 instructions per warm launch on
default V3 and 0.46% fewer on V4. Matched V3 builds use 0.43% fewer
cycles; copy and gather use 1.04% and 0.63% fewer cycles. V3 atomic-
add uses 0.12% more cycles.

The measured original V4 binaries show 2.96% fewer Wave32 cycles, but
that observation is sensitive to binary layout and does not isolate an
algorithmic gain of that size. Wave64 cycle changes are likewise
layout-sensitive and are not treated as benefits of this optimization.

Measurements use GCC 16 Release/O3, matched baseline/candidate CPU
targets, fixed 2.5 GHz reserved CPUs, both workload locks and wait
checking enabled. Counters cover checked warm launches and
synchronization, excluding startup and JIT. These are host CPU counts,
not whole-application speedups.

The original stride performance receipts predate the shared host-
target prerequisite. They retain all 280 measured processes and their
numerical, runtime, affinity and nonmultiplexed-counter proofs. No new
performance measurements are attributed to the capability cleanup.

Validate the shared-capability integration with V3/V4 builds, 255 CTests,
15 FP-mode helpers and changed-file hooks. Check 24 native compiler/target
contexts, 212 include-order/override combinations, 25 synthetic probes,
20 property executables including ASan/UBSan, and 5,875,080 stride cases.
All 144 header-only override checks pass; four full-SIMD Clang forced-zero
contexts remain unsupported by the existing toolchain. Compare 18 stride
assembly pairs byte-for-byte against the original. Preserve the lock's
pause instruction and diagnose missing header dependencies in its
header-first unit test.

Run correctness checks under both workload locks outside the expired
reservation, as requested. Two full local Peanut review rounds and
focused follow-ups cover the prerequisite and its consumers.

@bjacob bjacob left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed the SIMD arithmetic, unsigned wrap guard, load bounds, and full-Wave32 integration. Boundary and randomized checks passed across scalar, AVX2, AVX-512F-only, and Zen 4 builds with GCC and Clang, including sanitizer checks and comparisons with the previous coalescer. Replayed the relevant gist inputs and confirmed matching runs and callback behavior.

Base automatically changed from users/kuhar/rocjitsu-host-target to develop October 26, 2026 14:38
@therock-pr-bot

Copy link
Copy Markdown

✅ All Policy Checks Passed

Check Status Details
📝 PR Description ✅ Pass —
⛔ Forbidden Files ✅ Pass —
🧪 Unit Test ✅ Pass —
🚫 Draft PR 🔜 To Be Enabled —
🚩 Feature Flag 🔜 To Be Enabled —
📊 Code Coverage 🔜 To Be Enabled —

🎉 All policy checks passed!

📖 Need help? See the Policy FAQ for details on every check and how to fix failures.

🙋 Wish to Override Policy?

@kuhar
kuhar merged commit 77796e3 into develop Oct 26, 2026
180 of 186 checks passed
@kuhar
kuhar deleted the users/kuhar/rocjitsu-coalescer-stride branch October 26, 2026 14:45
@systems-assistant

Copy link
Copy Markdown
Contributor

TheRock Submodule Bump Activity

Newest first

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants