Fix the OpenCL CPU compiler crash in the one-work-group radix sort #3191
All Vouch review confidence checks passed
Residual risk 0.22 = Change Risk (0.42) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.42 · 327 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.347
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #3191"
general
weight: 0.35
antonwolfy
This PR fixes a crash of the OpenCL CPU compiler in the one-work-group radix sort, which
dpnp.sort,dpnp.argsortand theirdpnp.tensorcounterparts take for rows of 2049 to 16384 elements. Radix sort is the default forbool,int8,uint8,int16anduint16, so a plaindpnp.sortof such rows can segfault on a CPU device, for exampledpt.sort(dpt.zeros((1, 4096), dtype="i1", device="opencl:cpu")).On a CPU device whose kernel gets sub-groups shorter than 16 (8 for the
int8kernels on an AVX2 CPU), the kernel puts agroup_barrierafter every unrolled counter update. That is the work-around for CMPLRLLVM-64592, added in IntelPython/dpctl@5125e11eb4. With 16 or more elements per work-item, those barriers crash the compiler in itssycl-kernel-reduce-cross-barrier-valuespass (copyAndReplaceUses). Which data types crash depends on the compiler's heap state; once,int64hung instead. The crash shows up with every OpenCL CPU runtime from 2024.18 (intel-opencl-rt2025.0.4) to 2026.22 (2026.2.0).The work-around is still needed: without it, the
int8radix argsort is unstable on the same runtimes. This PR replaces the barrier with a work-groupatomic_fence. That keeps theint8argsort stable, adds no barrier region, and so no longer crashes the compiler.With a standalone SYCL reproducer, sort and stable argsort of
bool,int8,uint8,int16,uint16,int32,int64,float32andfloat64matchstd::sort/std::stable_sortin both orders. That covers 1, 37 and 300 rows of every one-work-group size class, with full-range and low-cardinality data, on seven OpenCL CPU runtimes from 2025.0.4 to 2026.2.0.test_radix_sort_one_work_groupcovers rows of 257 to 16384 elements. Without the fix it segfaults onopencl:cpuforint8,uint8andint32, andint64times out; with it, it passes onopencl:cpuandlevel_zero:gpu, as do the sorting,top_kanduniquetests.GPUs don't take the work-around. Sort and argsort timings alternated between the two builds show no difference beyond noise on the iGPU (
level_zero:gpu) or onopencl:cpu, at sizes the old build compiles.