Skip to content

fix(function): remove Decimal256 multiplication dispatch overhead - #30983

Merged
XuPeng-SH merged 9 commits into
matrixorigin:mainfrom
aunjgr:fix/decimal-multiply-dispatch
Oct 23, 2026
Merged

XuPeng-SH merged 9 commits into
matrixorigin:mainfrom
aunjgr:fix/decimal-multiply-dispatch

Conversation

@aunjgr

@aunjgr aunjgr commented Oct 23, 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 and #30838. This focused correction does not complete the broader optimization issue.

What this PR does / why we need it:

Route Decimal256 multiplication through a typed batch driver that reads resolved vector storage directly, classifies physical multi-value operands once and calls the existing kernel with explicit range proofs. Handle NULLs and selection masks before evaluation; broadcast constant results and ignore unused constant bitmap bits. Retain the existing multiplication tiers, scaling and overflow behavior. Share declared-result precision validation with ADD/SUB/DIV and cover their controls.

Validation: owning-package tests, full pre-push static checks, isolated local TPC-H SF10 Q1–Q22 and separate CPU profiles pass. The baseline is a real clean-main checkout; the candidate contains only this fix, with no source overlays. Six balanced process pairs use three scored calls per query after excluded cold warmups. The local performance gate passed; the detailed measurements below identify any independent confirmation used for initial slower-query signals. Detailed measurements are recorded in the PR comment.

@aunjgr aunjgr added the severity/s0 Active / top priority for current sprint. Owner has committed to working on it now. label Oct 23, 2026
@aunjgr aunjgr self-assigned this Oct 23, 2026
@aunjgr

aunjgr commented Oct 23, 2026

Copy link
Copy Markdown
Contributor Author

Local verification uses only clean main and this candidate, built normally in separate checkouts. No combined candidate or source overlays.

Comparison base: 5fb586e1429386260b900171f65ffa844f49c981. Tested candidate: cf40ea68e28023ad3d3a1040ea2b644fe1c18ebe. PR head after the required main merge: 6e1ac645a49c45bc7d5c0909cff1b16fcf3bac3f. GOAMD64=v3, GOEXPERIMENT=simd; matching stamped native generation.

SF10: eight physical CPUs, 16 GiB CN SHARED cache, 32 GiB whole application including the private RAM image, no swap. Existing loaded image reused. Cold selected-query warmups excluded; profiles collected separately. No input/table/schema/row-count/reference/result verification.

Query Baseline median (s) Candidate median (s) Paired change 95% time-ratio interval
Q1 1.6012 1.5834 -1.27% 0.9703–1.0011
Q2 0.0484 0.0509 +3.10% 0.9745–1.0671
Q3 0.4024 0.4009 +0.46% 0.9714–1.0200
Q4 0.3181 0.3195 +0.41% 0.9791–1.0169
Q5 0.3728 0.3774 -0.29% 0.9883–1.0324
Q6 0.2419 0.2449 +0.81% 0.9419–1.0579
Q7 0.3619 0.3703 +2.00% 0.9822–1.0555
Q8 0.3472 0.3505 +0.52% 0.9775–1.0346
Q9 0.7024 0.7053 +0.84% 0.9836–1.0204
Q10 0.5923 0.5885 -0.80% 0.9809–1.0109
Q11 0.0926 0.0911 +0.23% 0.9252–1.0221
Q12 0.4643 0.4618 -0.04% 0.9745–1.0033
Q13 0.3452 0.3457 +0.60% 0.9775–1.0307
Q14 0.2539 0.2525 -1.26% 0.9512–1.0354
Q15 0.4579 0.4531 -1.47% 0.9661–1.0152
Q16 0.1341 0.1338 -0.12% 0.9782–1.0125
Q17 0.3110 0.2986 -3.23% 0.9349–0.9894
Q18 1.1518 1.1518 -0.03% 0.9820–1.0076
Q19 0.6057 0.5966 -0.92% 0.9582–1.0203
Q20 0.3726 0.3691 -0.04% 0.9637–1.0055
Q21 1.3989 1.3933 -0.68% 0.9834–1.0056
Q22 0.1141 0.1112 -3.19% 0.9514–1.0007

Changes use the median of paired process ratios; columns show medians over six process generations. No aggregate gain overrides an individual regression.

Main advanced after timing collection. The intervening commits change Python SDK/tests, CSV test fixtures, UNIX_TIMESTAMP(DATETIME) selection and persisted DDL validation, detached background table-statistics stock, cancelled keepalive handling and GC Bloom sizing. Decimal casts/arithmetic, vector/null/bitmap/type/memory-pool primitives and native build inputs are unchanged. TPC-H does not invoke UNIX_TIMESTAMP or persisted-expression DUMP/LOAD; its arithmetic argument types and query expressions are unchanged. Statistics/GC changes may affect background activity, so the published performance numbers remain explicitly attributed to the tested snapshot pair, not presented as a fresh measurement of the merged head. Reuse the unchanged decimal functional and performance evidence; rerun owning-package and full static validation on the merged head.

Package/static checks and separate profile/resource gates passed. Software/source identities, raw timing records and profiles are retained locally; broader optimization issues stay open.

@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 23, 2026 •

Copy link
Copy Markdown
Contributor

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

Commit: 6e1ac645a49c45bc7d5c0909cff1b16fcf3bac3f

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: 6e1ac645a49c45bc7d5c0909cff1b16fcf3bac3f

Assessment: approve

Reviewed all six changed files and affected callers. The typed driver removes dispatch overhead while retaining one arithmetic kernel and shared precision validation. NULL/mask handling, constant broadcasting, error propagation and result ownership remain coherent. No actionable correctness, design or performance defect remains.

Model: gpt-6-astra / xhigh

Session: 01a13dcf-1586-7a01-9000-d45e20995cf8 · slot 1 · generation 1

Validation:

  • Isolation preflight passed. Repository-owned provenance verification confirmed compatible native artifacts and matching native build inputs.

  • 28 focused tests passed, covering broadcasting, reuse, NULL/masks, precision overflow, wide signed operands and type resolution.

  • Four alternating base/candidate benchmark pairs covered 69 cells. Single-row multiplication cost decreased approximately 33–35%; constant forms removed temporary allocations. Small initial DIV slowdowns did not reproduce in six independent, longer comparison pairs.

  • Frozen exact-head CI reports successful build, Ubuntu/x86 UT, coverage, Linux/arm64 SCA, PROXY BVT and PESSIMISTIC BVT. Skipped checks were not counted as passes.

  • Reconciled 28 command/source/exit receipts with retained logs. Evidence index: /home/xupeng/.local/state/mo-bot/jobs/f902077f7b59d10b7544b0c6/attempt-1/validation-index.json. Detailed scope and conclusions: review-notes.json in the same directory. Source remains unchanged.

Limitations:

  • No fresh end-to-end SF10/SF100 replay was run. Author-reported SF10 measurements concern the earlier cf40ea6 snapshot; scoped arithmetic dependencies match, but those figures are not presented as measurements of the current head.

  • Linked issue bodies and author raw timing/profile artifacts were absent from the frozen bundle. Approval covers this focused dispatch correction, not completion of the broader optimization issues.

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

mergify Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-10-23 17:11 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • 🟠 Checks running · in-place
  • 🚫 Left the queue — 2026-10-23 18:34 UTC · at 3d8d5d0e32c8941dcda0237df2b00977db87ba3c

This pull request spent 1 hour 23 minutes 11 seconds in the queue, with no time running CI.

Reason

Pull request #30983 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.

Waiting for any of
  • check-neutral = CI Required
  • check-skipped = CI Required
  • check-success = CI Required
All conditions

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

  • Requeue this pull request

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/bug Something isn't working 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