Skip to content

Add regression test for #613#727

Merged
vchuravy merged 1 commit into
mainfrom
vc/regression-613
Jul 6, 2026
Merged

Add regression test for #613#727
vchuravy merged 1 commit into
mainfrom
vc/regression-613

Conversation

@vchuravy

@vchuravy vchuravy commented Jul 5, 2026

Copy link
Copy Markdown
Member

Adds a regression test for #613: launching a kernel with a scalar workgroupsize over a 2D ndrange pads the first dimension of the iteration space to a multiple of the workgroupsize. On the POCL backend the padded work items were not masked, so a linear @index(Global) reached past prod(ndrange) and @inbounds writes stochastically segfaulted.

The original MWE only fails intermittently, so the test detects the failure mode deterministically instead: it writes linear indices into a flat array with room for the overshoot and checks that the tail stays untouched. Running the same kernel with unsafe_indices=true (masking skipped) trips the check, confirming it catches unmasked padded work items.

The reproducer no longer fails on current main with the vendored POCL (both at the test shape and the original 300×5000 / workgroupsize 256 shape from the issue), so this guards against regressions; #613 can likely be closed.

🤖 Generated with Claude Code

Launching a kernel with a scalar workgroupsize over a 2D ndrange pads
the first dimension of the iteration space to a multiple of the
workgroupsize. On the POCL backend the padded work items were not
masked, so a linear @index(Global) reached past prod(ndrange) and
out-of-bounds writes segfaulted.

Detect this deterministically by writing linear indices into a flat
array with room for the overshoot and checking the tail stays untouched.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Benchmark Results

Show table
main c54509b... main / c54509b...
saxpy/default/Float32/1024 0.086 ± 0.0084 ms 0.0864 ± 0.01 ms 0.996 ± 0.15
saxpy/default/Float32/1048576 0.472 ± 0.026 ms 0.485 ± 0.026 ms 0.974 ± 0.076
saxpy/default/Float32/16384 0.0676 ± 0.035 ms 0.0702 ± 0.034 ms 0.963 ± 0.68
saxpy/default/Float32/2048 0.0834 ± 0.029 ms 0.0838 ± 0.03 ms 0.994 ± 0.5
saxpy/default/Float32/256 0.0867 ± 0.0098 ms 0.0867 ± 0.012 ms 1 ± 0.18
saxpy/default/Float32/262144 0.17 ± 0.032 ms 0.176 ± 0.032 ms 0.965 ± 0.25
saxpy/default/Float32/32768 0.0722 ± 0.032 ms 0.0746 ± 0.032 ms 0.968 ± 0.59
saxpy/default/Float32/4096 0.0784 ± 0.031 ms 0.0821 ± 0.031 ms 0.954 ± 0.52
saxpy/default/Float32/512 0.0857 ± 0.0094 ms 0.0867 ± 0.01 ms 0.989 ± 0.16
saxpy/default/Float32/64 0.0867 ± 0.0096 ms 0.0869 ± 0.011 ms 0.997 ± 0.17
saxpy/default/Float32/65536 0.0869 ± 0.031 ms 0.0911 ± 0.032 ms 0.954 ± 0.48
saxpy/default/Float64/1024 0.0855 ± 0.018 ms 0.0862 ± 0.02 ms 0.992 ± 0.31
saxpy/default/Float64/1048576 0.581 ± 0.074 ms 0.572 ± 0.072 ms 1.01 ± 0.18
saxpy/default/Float64/16384 0.0683 ± 0.031 ms 0.0674 ± 0.03 ms 1.01 ± 0.64
saxpy/default/Float64/2048 0.0824 ± 0.032 ms 0.0821 ± 0.032 ms 1 ± 0.55
saxpy/default/Float64/256 0.0858 ± 0.011 ms 0.0862 ± 0.012 ms 0.995 ± 0.19
saxpy/default/Float64/262144 0.197 ± 0.036 ms 0.195 ± 0.038 ms 1.01 ± 0.27
saxpy/default/Float64/32768 0.0774 ± 0.03 ms 0.0795 ± 0.03 ms 0.973 ± 0.52
saxpy/default/Float64/4096 0.0798 ± 0.03 ms 0.0808 ± 0.029 ms 0.988 ± 0.52
saxpy/default/Float64/512 0.0857 ± 0.01 ms 0.0861 ± 0.011 ms 0.995 ± 0.17
saxpy/default/Float64/64 0.0871 ± 0.012 ms 0.0864 ± 0.013 ms 1.01 ± 0.21
saxpy/default/Float64/65536 0.0943 ± 0.031 ms 0.0993 ± 0.031 ms 0.95 ± 0.43
saxpy/static workgroup=(1024,)/Float32/1024 0.0836 ± 0.0093 ms 0.0839 ± 0.01 ms 0.997 ± 0.16
saxpy/static workgroup=(1024,)/Float32/1048576 0.427 ± 0.033 ms 0.434 ± 0.031 ms 0.982 ± 0.1
saxpy/static workgroup=(1024,)/Float32/16384 0.0637 ± 0.032 ms 0.0659 ± 0.031 ms 0.967 ± 0.67
saxpy/static workgroup=(1024,)/Float32/2048 0.0811 ± 0.029 ms 0.082 ± 0.03 ms 0.989 ± 0.51
saxpy/static workgroup=(1024,)/Float32/256 0.084 ± 0.012 ms 0.0843 ± 0.012 ms 0.996 ± 0.2
saxpy/static workgroup=(1024,)/Float32/262144 0.152 ± 0.031 ms 0.157 ± 0.031 ms 0.965 ± 0.27
saxpy/static workgroup=(1024,)/Float32/32768 0.0679 ± 0.029 ms 0.0703 ± 0.03 ms 0.966 ± 0.59
saxpy/static workgroup=(1024,)/Float32/4096 0.0798 ± 0.03 ms 0.0793 ± 0.03 ms 1.01 ± 0.54
saxpy/static workgroup=(1024,)/Float32/512 0.0835 ± 0.011 ms 0.0844 ± 0.0099 ms 0.989 ± 0.17
saxpy/static workgroup=(1024,)/Float32/64 0.084 ± 0.015 ms 0.0843 ± 0.014 ms 0.996 ± 0.24
saxpy/static workgroup=(1024,)/Float32/65536 0.0799 ± 0.031 ms 0.0837 ± 0.032 ms 0.955 ± 0.51
saxpy/static workgroup=(1024,)/Float64/1024 0.0833 ± 0.012 ms 0.0834 ± 0.018 ms 0.999 ± 0.26
saxpy/static workgroup=(1024,)/Float64/1048576 0.531 ± 0.089 ms 0.499 ± 0.064 ms 1.06 ± 0.22
saxpy/static workgroup=(1024,)/Float64/16384 0.0654 ± 0.029 ms 0.0642 ± 0.028 ms 1.02 ± 0.63
saxpy/static workgroup=(1024,)/Float64/2048 0.0804 ± 0.031 ms 0.08 ± 0.032 ms 1 ± 0.56
saxpy/static workgroup=(1024,)/Float64/256 0.0835 ± 0.011 ms 0.0839 ± 0.012 ms 0.995 ± 0.19
saxpy/static workgroup=(1024,)/Float64/262144 0.192 ± 0.034 ms 0.182 ± 0.038 ms 1.05 ± 0.29
saxpy/static workgroup=(1024,)/Float64/32768 0.0745 ± 0.027 ms 0.0756 ± 0.027 ms 0.985 ± 0.5
saxpy/static workgroup=(1024,)/Float64/4096 0.0776 ± 0.03 ms 0.0765 ± 0.029 ms 1.01 ± 0.55
saxpy/static workgroup=(1024,)/Float64/512 0.0836 ± 0.011 ms 0.0837 ± 0.012 ms 0.999 ± 0.19
saxpy/static workgroup=(1024,)/Float64/64 0.0842 ± 0.014 ms 0.084 ± 0.013 ms 1 ± 0.23
saxpy/static workgroup=(1024,)/Float64/65536 0.0938 ± 0.028 ms 0.0931 ± 0.028 ms 1.01 ± 0.43
time_to_load 1.05 ± 0.01 s 1.12 ± 0.022 s 0.936 ± 0.021

Benchmark Plots

A plot of the benchmark results have been uploaded as an artifact to the workflow run for this PR.
Go to "Actions"->"Benchmark a pull request"->[the most recent run]->"Artifacts" (at the bottom).

@vchuravy vchuravy merged commit 8795f6c into main Jul 6, 2026
50 of 59 checks passed
@vchuravy vchuravy deleted the vc/regression-613 branch July 6, 2026 08:16
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.

Segfault on #main branch with the PoCL backend when using CartesianIndexing

1 participant