Skip to content

perf(function): use decimal precision proofs in multiplication dispatch - #30885

Merged
mergify[bot] merged 5 commits into
matrixorigin:mainfrom
aunjgr:perf/decimal-multiply-range-proofs
Oct 22, 2026
Merged

mergify[bot] merged 5 commits into
matrixorigin:mainfrom
aunjgr:perf/decimal-multiply-range-proofs

Conversation

@aunjgr

@aunjgr aunjgr commented Oct 22, 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 #30840; umbrella #30838.

Approved versioned design.

What this PR does / why we need it:

Use valid Decimal256 operand precision to skip redundant range scans in multiplication dispatch. Precision up to 9 proves an int32 coefficient; precision up to 18 proves int64. Compute proofs once per batch, preserve the int32-before-int64 tier order, and retain dynamic checks for unknown or invalid metadata. Existing multiply, scaling, rounding and result-precision enforcement remain responsible for results and errors. Metadata-free callers retain the original unknown-proof path.

Validation: full function package tests including the newly merged decimal-cast changes, an independent math/big oracle across precision 9/10/18/19, signed values, constants, NULLs, selection and scale rounding, plus existing overflow/wide-path coverage. Public-dispatch 256-row microbenchmarks improve ~1.39x for proven int32 and ~1.20x for proven int64, with zero allocations; wide fallback is unchanged. Query timing is reported separately from kernel gains.

Comparison protocol: optimized SIMD builds, eight physical CPUs, a private retained SF10 native image, 32 GiB application limit including the image, no swap, and a 16 GiB CN SHARED memory cache verified from running-process metrics. Query cold warmups are excluded; CPU profiling is separate from latency. All query evidence uses main with #30880 merged. No dataset or query-result verification runs in benchmark scripts.

Paired SF10 replay on merged main (six balanced process generations, three scored calls per query per arm):

Query Main median Candidate median Speedup Paired 95% interval
Q1 1.596845 s 1.601109 s 0.9973x 0.9728–1.0219x
Q15 0.464836 s 0.457631 s 1.0157x 1.0060–1.0249x

Q1 shows no demonstrated whole-query gain; Q15 shows a modest ~1.6% gain in this replay. All measured windows pass the zero physical I/O, spill, swap, OOM and sustained-memory-pressure gates. These are selected-query results, not a whole-suite or SF100 speedup claim.

Separate CPU/PMU diagnostic (one process generation per variant, two warm query calls, excluded from the latency comparison): user instructions per call 211.846G → 215.195G, user cycles 48.694G → 49.829G. The recordings have no lost samples. This single diagnostic pair is not a significance test or a query speedup claim.

Isolated kernel microbenchmarks used the pre-#30880 main snapshot; that cast-only merge does not change the timed constructor, multiplication or SUM kernel closures. The retained-image query comparisons and profiles were rebuilt and rerun with #30880 included.

@aunjgr aunjgr added the severity/s0 Active / top priority for current sprint. Owner has committed to working on it now. label Oct 22, 2026
@aunjgr aunjgr self-assigned this Oct 22, 2026
@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 22, 2026 •

Copy link
Copy Markdown
Contributor

mo-bot review · mo-bot-xupeng · done

Commit: d8938d60dc96e808cfe132aaf9837ce603412864

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-xupeng · review

Commit: d8938d60dc96e808cfe132aaf9837ce603412864

Assessment: approve

Reviewed the complete four-file delta, linked requirements, supplied comments, and arithmetic callers. Precision proofs conservatively remove redundant scans while retaining existing kernels, fallback, rounding, masking and precision enforcement. No actionable correctness, design or coverage defects remain.

Model: gpt-6-astra / xhigh

Session: 01a15209-2c6d-71e2-b8f3-aa17387fa283 · slot 2 · generation 0

Validation:

  • Isolation preflight passed. Built native prerequisites through the repository owner and verified their provenance against the assessed revision.

  • Focused tests passed: 23 top-level tests, including committed range-proof tests and 14 supplemental dispatcher scenarios covering mixed domains, constants, NULLs, selection, empty batches and overflow. Receipt: checks/1792703573363450322-3.json; log: focused-tests.log.

  • Static checks confirmed clean source, valid precision bounds and unchanged multiplication computation after reducing the proof predicates.

  • Sequential baseline/candidate microbenchmarks measured approximately 1.52x and 1.25x improvement for proven int32/int64 256-row inputs, zero allocations, and essentially unchanged wide fallback. Reverse-order controls did not reproduce the initial one-row slowdown.

  • Audited commands, source fingerprints, exits, logs and overlay contents. Evidence index: /home/xupeng/.local/state/mo-bot/jobs/26f7a4ce6d0968c3ad9deba3/attempt-1/validation-index.json. Final audit receipt: checks/1792703897828868158-3.json.

  • Frozen CI evidence reports successful x86 unit tests/coverage, arm64 static analysis, shared build and compose BVT checks.

Limitations:

  • No independent SF10/SF100 query replay or PMU reproduction; author query-performance claims were not independently verified.

  • Local benchmarks used Go 1.27.1, GOAMD64=v1 and no GOEXPERIMENT. Short microbenchmarks, including run-order-sensitive one-row controls, do not establish whole-query performance.

  • Raw author and CI logs were unavailable. Local validation exercised the package dispatcher rather than a live SQL service.

  • The initial native-prerequisite probe failed before tests ran; setup was recovered and subsequent validation passed.

@mergify mergify Bot added the queued label Oct 22, 2026
@mergify
mergify Bot merged commit 7ed8502 into matrixorigin:main Oct 22, 2026
29 of 30 checks passed
@mergify

mergify Bot commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-10-22 21:19 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • ✅ Checks skipped · PR is already up-to-date
  • ✅ Merged — 2026-10-22 21:19 UTC · at 7ed8502d7ccc233ae231a120da752da4d0155c98 · squash

This pull request spent 9 seconds in the queue, with no time running CI.

Required conditions to merge

This branch was previously deployed

1 inactive deployment
ci — d8938d60 Deployed Oct 22, 2026 by aunjgr via Matrixone Coverage execution / Coverage #60550
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/enhancement severity/s0 Active / top priority for current sprint. Owner has committed to working on it now. 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