Skip to content

OpenCL: gate single-group launches by per-kernel work-group limit - #247

Open
Redkin-Aleksey wants to merge 2 commits into
SparseLinearAlgebra:mainfrom
Redkin-Aleksey:fix/single-group-kernel-limit
Open

Redkin-Aleksey wants to merge 2 commits into
SparseLinearAlgebra:mainfrom
Redkin-Aleksey:fix/single-group-kernel-limit

Conversation

@Redkin-Aleksey

@Redkin-Aleksey Redkin-Aleksey commented Oct 7, 2026 •

Copy link
Copy Markdown

Fixes #246.

Short description
On PowerVR B-Series BXE-2-32, single-group launches sized using CL_DEVICE_MAX_WORK_GROUP_SIZE (512) exceed the per-kernel limit reported by the driver (480, "the maximum work-group size that can be used to execute the kernel") and fail with CL_OUT_OF_RESOURCES; the ignored launch status turns the failure into silent data corruption.

List of changes
Added kernel_group_limit (declaration + definition) to query CL_KERNEL_WORK_GROUP_SIZE and capped_group_size to compute a work-group size aligned down to the wave size in src/opencl/cl_program_builder.hpp/.cpp. Gated single-group launches by these limits in src/opencl/cl_reduce_by_key.hpp:cl_reduce_by_key (small path) and src/opencl/cl_sort_by_key.hpp:cl_sort_by_key_bitonic (local, pre-sort and global launches). Bitonic groups are cut into smaller groups when the requested size exceeds the per-kernel limit. Oversized requests fall back to the existing slow paths.

Type of changes

Testing strategy (all runs on the PowerVR board; mechanism and numbers detailed in #246)
Standalone reproducer (gist): ./test_reduce_small returns CL_OUT_OF_RESOURCES for groups of 512, success up to the reported limit of 480. In-tree sssp: ./sssp --mtxpath=belgium_osm.mtx --niters=1 yields CHECK acc with zero VERIFY lines; same for roadNet-CA. amazon-2008 (control graph that did not trigger the failure) converges identically. No new in-tree tests: the failure needs PowerVR BXE-2-32 hardware absent from CI.

Background

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.

OpenCL: single-group launches exceeding per-kernel work-group limit fail silently on PowerVR

1 participant