Skip to content

Add bounded decimal dispatch macros and migrate kernels - #10314

Draft
joseph-isaacs wants to merge 1 commit into
ji/decimal-storage-contractfrom
ji/decimal-dispatch-macros
Draft

joseph-isaacs wants to merge 1 commit into
ji/decimal-storage-contractfrom
ji/decimal-dispatch-macros

Conversation

@joseph-isaacs

Copy link
Copy Markdown
Contributor

Decimal kernels can rely on the storage-width contract from #10305 to dispatch only input types no wider than their output or working type. Add bounded unary and binary dispatch macros and migrate decimal SUM, equality, and storage upcasts.

  • match_decimal_unary!(input, output, |In, Out| { ... }) instantiates 21 widening/equal-width combinations instead of 36.
  • match_decimal_binary!(left, right, output, |Left, Right, Out| { ... }) instantiates 91 combinations instead of 216.
  • Type expressions are evaluated once, from left to right; unsupported narrowing combinations panic.
  • Tests cover all combinations and expression evaluation. A test-only widening trait prevents narrowing combinations from compiling in macro bodies.

Stack 2/2: based on #10305 (ji/decimal-storage-contract). This PR contains the macros and kernel migrations; the storage semantics are in the parent PR.

Validation: manually reviewed the split and updated all macro bindings, examples, and call sites to comma-separated syntax. Tests, builds, formatting, and linting were not run, per AGENTS.md's opt-in verification policy.

@codspeed

codspeed Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Merging this PR will degrade performance by 46.67%

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 1 improved benchmark
❌ 9 regressed benchmarks
✅ 2085 untouched benchmarks
⏩ 524 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ WallTime dict_canonicalize_gt_u8_neon[1000000] 51.3 µs 488.2 µs -89.5%
❌ WallTime dict_canonicalize_gt_u8_avx512[1000000] 55.9 µs 422.2 µs -86.76%
❌ WallTime dict_canonicalize_gt_u8_avx2[1000000] 56.5 µs 422.2 µs -86.62%
❌ Simulation decode_primitives[u8, (2000, 8)] 33.9 µs 43.7 µs -22.56%
❌ Simulation decode_primitives[u8, (2000, 4)] 33.9 µs 43.7 µs -22.56%
❌ Simulation decode_primitives[u8, (2000, 2)] 33.9 µs 43.7 µs -22.56%
❌ Simulation decode_primitives[u8, (1000, 2)] 32.3 µs 36.8 µs -12.19%
❌ Simulation decode_primitives[u8, (1000, 8)] 31.9 µs 36.3 µs -12.06%
❌ Simulation decode_primitives[u8, (1000, 4)] 31.9 µs 36.3 µs -12.06%
⚡ Simulation density_sweep_dense_runs[0.9] 55.4 µs 17.4 µs ×3.2

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing ji/decimal-dispatch-macros (4eab00a) with ji/decimal-storage-contract (ec2b1b5)2

Open in CodSpeed

Footnotes

  1. 524 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

  2. No successful run was found on ji/decimal-storage-contract (51de229) during the generation of this report, so 353400a was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk>
@joseph-isaacs
joseph-isaacs force-pushed the ji/decimal-dispatch-macros branch from e4cea19 to 4eab00a Compare October 6, 2026 16:02

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant