Skip to content

fix: keep empty encoded batches neutral in IsConstant - #10893

Merged
connortsui20 merged 1 commit into
developfrom
ct/empty-encoded-constant
Oct 27, 2026
Merged

connortsui20 merged 1 commit into
developfrom
ct/empty-encoded-constant

Conversation

@connortsui20

@connortsui20 connortsui20 commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

Summary

Keep empty encoded batches neutral in IsConstant accumulators. An empty FoR, Dict or RunEnd batch currently turns an otherwise constant input into a non-constant result.

Changes

  • Return the empty partial before considering the kernel's constancy verdict.
  • Cover empty primitive, Dict, RunEnd and FoR batches before and after constant input, while preserving standalone is_constant(empty) == false.

Related: #2629.

Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
@connortsui20 connortsui20 added the changelog/fix A bug fix label Oct 27, 2026
@connortsui20
connortsui20 enabled auto-merge (squash) October 27, 2026 17:58
@codspeed

codspeed Bot commented Oct 27, 2026

Copy link
Copy Markdown

Merging this PR will regress 3 benchmarks

3 warnings

⚠️ Walltime results may be unreliable

Some benchmarks used the Walltime instrument outside CodSpeed Macro Runners, which can make the results inconsistent.

Learn more about Macro Runners

See affected benchmarks

⚠️ 3 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

⚠️ Base and head ran on different runner types

Some benchmarks with significant performance changes were compared across different runner types, so the changes might not come from the code. Run base and head on the same runner type, or use CodSpeed Macro Runners for more stable results.

Learn more about Macro Runners

Open the report in CodSpeed to investigate

⚡ 4 improved benchmarks
❌ 3 regressed benchmarks
✅ 2197 untouched benchmarks
⏩ 370 skipped benchmarks1
🗄️ 30 archived benchmarks run2

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ CPU Simulation missing_stats[16] 71 µs 88.2 µs -19.49%
❌ Walltime starts_with_avx512[8, VarBin] 39.4 µs 44.9 µs -12.32%
❌ Walltime starts_with_avx512[64, VarBin] 53.8 µs 60.2 µs -10.71%
⚡ CPU Simulation filter_powerlaw_by_random[10000] 995.9 ns 254 ns ×3.9
⚡ CPU Simulation encode_primitives[u8, (2000, 4)] 164.6 µs 136.8 µs +20.38%
⚡ CPU Simulation take_filter_primitive_small_uncached_random_mask_random_indices[4096, 10] 23.6 µs 20.9 µs +13.17%
⚡ Walltime threshold_avx2[80] 3 µs 2.6 µs +12.77%

Tip

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


Comparing ct/empty-encoded-constant (eab5ad8) with develop (088118b)

Open in CodSpeed

Footnotes

  1. 370 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. 30 benchmarks were run, but are now archived. If they were deleted in another branch, consider rebasing to remove them from the report. Instead if they were added back, click here to restore them. ↩

@connortsui20
connortsui20 merged commit 22f0132 into develop Oct 27, 2026
117 of 120 checks passed
@connortsui20
connortsui20 deleted the ct/empty-encoded-constant branch October 27, 2026 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/fix A bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants