Skip to content

KernelInterface: check a work-group's total size first, and without division - #938

Merged
maleadt merged 3 commits into
mainfrom
tb/ki-work-group-checks
Nov 5, 2026
Merged

maleadt merged 3 commits into
mainfrom
tb/ki-work-group-checks

Conversation

@maleadt

@maleadt maleadt commented Oct 28, 2026

Copy link
Copy Markdown
Member

Split out of #906; neither change needs PoCL host kernels.

  • Total size first. Linearized launches put all work-items in the first dimension, so an oversized (96, 48) work-group was reported as Work-group size (4608, 1, 1) exceeds the maximum of (4096, 4096, 4096) per dimension. The total is now checked first: ... has more than 4096 work-items, the maximum for this kernel.
  • No division. prod_exceeds, which runs on every launch, uses checked multiplication instead of a 64-bit division per dimension (tens of cycles on CPUs such as Skylake). Not measurable on PoCL's queue (~20k instructions per launch); it is part of POCL: run kernels on Julia's threads with PoCL host kernels #906's launch-cost work, where a launch takes ~70 ns.
  • Bumps KernelInterface to 0.4.4.

@github-actions

github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Benchmark results

Compared with c42b1f458, the merge base.
The environment differs from the baseline's: KernelInterface 0.4.3 → 0.4.4.

Times are the minimum time of every benchmark. A change is unusual when it exceeds both three times the benchmark's typical change between consecutive runs on the default branch and a minimum per category (performance 3%, latency 5%, applications 3%, other 3%). A benchmark that starts or stops allocating is listed however few the allocations. A single run can still be a fluke, so rerun before drawing conclusions.

Geometric mean Unusual: slower Unusual: faster Compared
Performance −0.0% 0 0 32
Latency +1.7% 0 0 13
Applications +10.6% 0 0 5

No unusual changes.

All benchmarks
Benchmark Baseline This PR Change
Performance
julia/serial/arithmetic/muladd-reference 655 µs 655 µs −0.0% noise unknown
julia/serial/math/exp-f64-reference 292 µs 284 µs −2.7% noise unknown
julia/serial/narrow/masked-reference 714 µs 745 µs +4.2% noise unknown
pocl/parallel/atomics/histogram 5.14 ms 5.14 ms −0.1% noise unknown
pocl/parallel/groupreduce/add-f64 1.65 ms 1.65 ms +0.1% noise unknown
pocl/parallel/groupreduce/fallback 19.0 ms 18.1 ms −4.6% noise unknown
pocl/parallel/groupscan/add-i32 2.52 ms 2.52 ms −0.0% noise unknown
pocl/parallel/indexing/cartesian3d 78.5 µs 80.7 µs +2.8% noise unknown
pocl/parallel/indexing/linear3d 80.3 µs 83.1 µs +3.5% noise unknown
pocl/parallel/indexing/ntuple3d 78.7 µs 64.9 µs −17.5% noise unknown
pocl/parallel/indexing/ntuple4d 157 µs 161 µs +2.8% noise unknown
pocl/parallel/localmem/transpose-naive 456 µs 459 µs +0.6% noise unknown
pocl/parallel/localmem/transpose-tiled 92.9 µs 123 µs +31.9% noise unknown
pocl/parallel/private/across-barrier 165 µs 160 µs −3.2% noise unknown
pocl/parallel/scheduling/default 182 µs 182 µs −0.1% noise unknown
pocl/parallel/scheduling/explicit 182 µs 181 µs −0.1% noise unknown
pocl/parallel/stream/copy/cache 781 ns 643 ns −17.7% noise unknown
pocl/parallel/stream/copy/dram 6.41 ms 6.29 ms −1.9% noise unknown
pocl/parallel/stream/triad/cache 7.17 µs 7.53 µs +5.0% noise unknown
pocl/parallel/stream/triad/dram 9.42 ms 9.50 ms +0.8% noise unknown
pocl/parallel/util/copyto-small 24.0 ns 24.0 ns +0.0% noise unknown
pocl/parallel/util/zeros-large 1.01 ms 953 µs −5.2% noise unknown
pocl/parallel/util/zeros-small 619 ns 625 ns +1.0% noise unknown
pocl/serial/arithmetic/contract 1.91 ms 1.90 ms −0.5% noise unknown
pocl/serial/arithmetic/muladd 756 µs 769 µs +1.7% noise unknown
pocl/serial/const/marked 728 µs 711 µs −2.3% noise unknown
pocl/serial/const/unmarked 910 µs 902 µs −0.9% noise unknown
pocl/serial/math/exp-f64 154 µs 147 µs −4.6% noise unknown
pocl/serial/math/sin-f64 194 µs 209 µs +7.4% noise unknown
pocl/serial/narrow/masked 807 µs 829 µs +2.7% noise unknown
pocl/serial/narrow/unmasked 766 µs 809 µs +5.6% noise unknown
pocl/serial/stream/triad/dram 8.62 ms 8.56 ms −0.7% noise unknown
Latency
host/import/ka 501 ms 507 ms +1.1% noise unknown
host/precompile/ka 44.4 s 44.4 s −0.0% noise unknown
host/startup 128 ms 129 ms +0.1% noise unknown
pocl/parallel/launch/dynamic-default 4.37 µs 4.45 µs +1.9% noise unknown
pocl/parallel/launch/groupreduce-f64 6.59 µs 6.64 µs +0.8% noise unknown
pocl/parallel/launch/many-args 11.2 µs 12.4 µs +10.6% noise unknown
pocl/parallel/launch/partial-workgroup 4.25 µs 4.29 µs +0.8% noise unknown
pocl/serial/compile/groupreduce 1.39 s 1.42 s +2.1% noise unknown
pocl/serial/compile/localmem-barrier 697 ms 694 ms −0.4% noise unknown
pocl/serial/compile/new-kernel 117 ms 126 ms +7.8% noise unknown
pocl/serial/compile/new-workgroupsize 14.1 ms 13.8 ms −2.5% noise unknown
pocl/serial/first-kernel/cold-cache 1.95 s 1.94 s −0.2% noise unknown
pocl/serial/first-kernel/warm-cache 279 ms 280 ms +0.3% noise unknown
Applications
pocl/parallel/dgsem/fluxdiff-node 291 µs 289 µs −0.6% noise unknown
pocl/parallel/dgsem/weak-element 159 µs 209 µs +31.2% noise unknown
pocl/parallel/dgsem/weak-node-localmem 119 µs 146 µs +22.9% noise unknown
pocl/parallel/stencil/timestep 7.75 ms 7.97 ms +2.8% noise unknown
pocl/serial/stencil/timestep 11.3 ms 11.3 ms +0.2% noise unknown

History: https://juliagpu.org/perf/?pkg=kernelabstractions

@codecov

codecov Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.99%. Comparing base (c42b1f4) to head (81fe6df).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #938      +/-   ##
==========================================
- Coverage   84.80%   83.99%   -0.81%     
==========================================
  Files          31       31              
  Lines        2593     2543      -50     
==========================================
- Hits         2199     2136      -63     
- Misses        394      407      +13     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Linearized launches put all work-items in the first dimension, so an
oversized (96, 48) work-group was reported as a per-dimension error for
(4608, 1, 1). Check the total first, which reports the kernel's limit
of 4096 work-items instead.
`prod_exceeds` runs on every launch. Checked multiplication avoids a 64-bit
division per dimension, which costs tens of cycles on CPUs such as Skylake.
@maleadt
maleadt force-pushed the tb/ki-work-group-checks branch from 02c474e to 81fe6df Compare November 4, 2026 09:12
@maleadt
maleadt merged commit 7894293 into main Nov 5, 2026
29 of 30 checks passed
@maleadt
maleadt deleted the tb/ki-work-group-checks branch November 5, 2026 08:27
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