Skip to content

perf(aggexec): fill Decimal64 combiner slots with word stores - #31482

Merged
XuPeng-SH merged 5 commits into
matrixorigin:mainfrom
aunjgr:perf/decimal64-slot-store
Oct 27, 2026
Merged

XuPeng-SH merged 5 commits into
matrixorigin:mainfrom
aunjgr:perf/decimal64-slot-store

Conversation

@aunjgr

@aunjgr aunjgr commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

Related to #30847. This scopes the work to slot initialization; local SF10 validation does not close the broader SF100 and mixed-I/O acceptance requirements.

What this PR does / why we need it:

The Decimal64 grouped SUM/AVG combiner initializes its 256-byte local slot table with one byte store per loop iteration. Fill the same table with 32 bounds-safe eight-byte stores through encoding/binary.LittleEndian.PutUint64. The all-one word preserves the existing 0xff byte sentinel on every architecture and reduces initialization work without a source-copy operation or new allocation.

The existing hash, 255-entry capacity, wraparound, full-table fallback, per-row accumulation and final scatter keep their algorithm and indexing. Add SUM/AVG regressions for colliding hashes that wrap from bucket 255 to 0, the final local slot and repeated-group fallback, offsets and multiple state chunks. Retain a caller-shaped benchmark matrix for reproducing the complete update cost.

Design

Reviewed design revision: Decimal64 grouped-combiner slot stores.

Validation

  • The focused SUM/AVG regressions pass on clean main and the candidate.
  • The complete aggregate suite passes: 615 test roots, no skips. The group consumer suite passes.
  • Scoped static analysis passes with zero issues.
  • The final mandatory full repository pre-push gate passes, including custom vet, license/dependency checks and golangci-lint (zero issues). Final complete-diff self-review passes. Main was freshly merged and the branch was zero commits behind before push.
  • All three committed benchmark fixtures exactly match the sources compiled into the measured control binaries; the later documentation/fixture-publication commits leave runtime source unchanged.

Performance

Clean main c4946bb74d versus runtime candidate 5c816098da (published head ef57b7215a; later commits contain documentation and the identical measured fixtures only), local SF10 on eight dedicated physical cores of an AMD Ryzen 9 7950X3D, 16 GiB CN cache and a 32 GiB whole-application budget. Ordinary Go 1.27.1 SIMD/v3 builds use identical verified native libraries; no production overlays, PGO or alignment overrides. Native preparation uses the recorded C-only jemalloc configure profile for this host compiler.

Full Q1-Q22 context: six balanced independent process pairs, one scored warm call per query per arm; each query's first cold call is excluded. Q1 and Q18 have lower observed paired medians, but neither interval excludes no change. No query has a slower interval in this screen; several higher point estimates remain inconclusive. This is limited local evidence, not proof of zero possible regressions or a statistically established query speedup.

Query Main median (s) Candidate median (s) Median paired change Bootstrap 95% interval
Q1 1.4315 1.4202 -1.24% -2.98% to +2.10%
Q2 0.0490 0.0482 -2.28% -13.00% to +13.91%
Q3 0.3777 0.3769 -0.36% -3.16% to +5.01%
Q4 0.2884 0.2952 +0.66% -1.18% to +4.86%
Q5 0.3715 0.3730 +0.11% -3.37% to +7.76%
Q6 0.2207 0.2135 -1.29% -6.77% to +1.92%
Q7 0.3511 0.3469 -1.27% -5.47% to +1.96%
Q8 0.3481 0.3529 +1.20% -2.32% to +4.58%
Q9 0.6879 0.6869 +0.31% -2.61% to +4.74%
Q10 0.5618 0.5616 -0.54% -2.21% to +4.25%
Q11 0.0895 0.0883 +1.93% -4.26% to +6.86%
Q12 0.4281 0.4391 +3.36% -4.24% to +8.26%
Q13 0.3259 0.3208 -1.60% -3.30% to +0.47%
Q14 0.2273 0.2310 +2.21% -2.18% to +11.30%
Q15 0.4076 0.4052 -1.25% -2.03% to +4.06%
Q16 0.1033 0.1037 +0.93% -0.92% to +2.04%
Q17 0.2494 0.2416 -2.32% -5.44% to -0.19%
Q18 1.0218 1.0088 -1.72% -4.74% to +4.16%
Q19 0.5930 0.5967 -0.50% -3.11% to +5.76%
Q20 0.3326 0.3332 +1.25% -0.99% to +5.35%
Q21 1.3569 1.3664 +1.29% -0.92% to +2.82%
Q22 0.1099 0.1109 +1.19% -2.10% to +3.92%

Separate Q1/Q18 context: six balanced process pairs with three scored warm calls per query measured Q1 +0.76% (95% interval -3.13% to +2.75%) and Q18 +0.84% (-4.32% to +5.26%). These inconclusive higher estimates are retained separately from the full-suite observations. No profile timings enter either latency comparison.

All 24 retained timing arms passed the recorded all-memory and sampled-background gates, with zero measured physical reads/writes, spill or application swap. The maximum conservative whole-application footprint was 22.86 GiB. Benchmark workers execute/drain queries without input, table, schema, row, reference, result-value or checksum verification. No SF100 run was made locally.

Complete component costs: the 30-case, six-pair screen includes real 256-row calls, separate 8192-row API controls, sparse/permuted and many-chunk states, NULL/constants, tiny/empty, growth and DISTINCT. It has no slower interval and unchanged allocation counts/bytes. An independent one-second-per-result, six-pair check of the eight inconclusive large-batch/NULL/DISTINCT cases also has no slower interval; those cases remain inconclusive.

Two balanced warm-only fixed-work counter pairs, each with 200,000 iterations after excluding the first 200,000-iteration run, measured:

Component (8192 rows/op in 256-row calls) User cycles change, pair 1 / pair 2 Retired instructions change, pair 1 / pair 2
Four groups -13.02% / -12.61% -7.28% / -7.28%
Sequential groups -10.50% / -10.24% -4.92% / -4.92%

Separate six-warm-call query profiles measured Q18 instructions -0.71% and user cycles -0.23%, while Q1 instructions were +0.12% and cycles +0.62% in that single profile pair. The query-wide effect is much smaller than the component control gains; these sampled runs do not establish a latency change or a unique cause.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@XuPeng-SH

XuPeng-SH commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

mo-bot review · mo-bot-local · done

Commit: ef57b7215a197526a5a31309b89587e1f0cdb3aa

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH 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.

mo-bot review · mo-bot-local · review

Commit: ef57b7215a197526a5a31309b89587e1f0cdb3aa

Assessment: approve

Reviewed the complete six-file delta and discussion. The bounded word stores preserve sentinel initialization, probing, fallback and ownership. Historical regressions concern rejected alternatives; the accepted issue contract permits uncertain target-query gains. No actionable findings remain.

Model: gpt-6-astra / xhigh

Session: 01a13dcf-1517-7f90-b3f9-c5f9f9e7031b · slot 0 · generation 1

Validation:

  • Isolation preflight and native provenance checks passed. Current-head aggexec and group suites passed 615 and 219 root tests respectively, with no skips or failures. Both new regressions also passed against the frozen baseline.

  • Compared baseline and candidate across 30 component cases using six balanced process pairs, then nine cases with longer measurements. Neither comparison produced a slower confidence interval; several results remained inconclusive. Verified generated word-store instructions.

  • Read all PR discussion entries and linked issue30847's body and six comments. Saved discussion-assessment.json and review-notes.json.

  • Commands, source fingerprints, exits and retained logs are reconciled in /home/xupeng/.local/state/mo-bot/jobs/733abef229c2a9877d88574f/attempt-1/validation-audit.json. Final audit receipt checks/1793128551606651087-3.json records exit 0 and an unchanged frozen head.

Limitations:

  • Author SF10 and hardware-counter results remain attributed reports: raw execution artifacts were unavailable. No independently established query-level speedup is claimed.

  • Local component measurements were noisy and do not establish performance equivalence across platforms.

  • SF100 and mixed-I/O validation remain outside this PR's accepted scope. Frozen CI statuses were inspected without individual case logs.

@mergify mergify Bot added the queued label Oct 27, 2026
@mergify

mergify Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

🚫 Left the queue

3 h in the queue, with no time running CI.

So far

  • ✅ Entered the queue Tue 27 Oct, 19:17 · rule main · triggered by rule Automatic queue on approval for main
  • ⏹️ Testing stopped · in place
  • 🚫 Left the queue 22:17 · 048f0ec

Reason

Pull request #31482 has been dequeued

Pull request from fork cannot be queued. This pull request comes from a fork, and Mergify needs the author's permission to update its branch.

The author needs to enable "Allow edits from maintainers" on this pull request.

Hint

You should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it.
If you do update this pull request, it will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue instead, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

Merge conditions: 2 of 3 met

This pull request

Condition Required by
✅ #review-threads-unresolved = 0 GitHub branch protection
✅ github-review-approved GitHub branch protection

The batch, tested in place

Condition Required by
❌ any of: check-neutral = CI Required, check-skipped = CI Required, check-success = CI Required GitHub branch protection

Tick the box to put this pull request back in the merge queue (same as @mergifyio queue).

  • Requeue this pull request

Times in UTC · dashboard · how the merge queue works

@XuPeng-SH
XuPeng-SH merged commit 8d63bb7 into matrixorigin:main Oct 27, 2026
21 of 22 checks passed
@mergify mergify Bot removed the queued label Oct 27, 2026

This branch was previously deployed

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

Labels

dequeued kind/enhancement size/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants