Repository navigation
Fix the OpenCL CPU compiler crash in the complex dpnp.minmax kernel - #3192
Open
antonwolfy wants to merge 1 commit into
Open
antonwolfy wants to merge 1 commit into
antonwolfy wants to merge 1 commit into
Conversation
The complex `dpnp.minmax` kernel reduced the minimum and the maximum with two `custom_reduce_over_group` calls separated by a barrier. In the coverage build, the OpenCL CPU compiler intermittently corrupts its heap in `ReduceCrossBarrierValuesPass` while building this kernel (CMPLRLLVM-79305), which kills the coverage job. Fold both extrema in one tree over a local memory of twice the work-group size, with one barrier per step for both.
antonwolfy
requested review from
ndgrigorian and
vlad-perevezentsev
as code owners
November 18, 2026 12:48
Contributor
|
View rendered docs @ https://intelpython.github.io/dpnp/pull/3192/index.html |
Contributor
|
Array API standard conformance tests for dpnp=0.22.0dev2=np2py314h8d9cdd5_7 ran successfully. |
Collaborator
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes an intermittent crash of the OpenCL CPU compiler in the complex
dpnp.minmaxkernel, which has been failing theGenerate coveragejob sincedpnp.minmaxlanded in #3135 (e.g. this run). pytest dies at about 59% of the dpnp tests inTestMinMax::test_size, with a SIGABRT insidelibintelocl.soor a silent SIGALRM.Complex types can't use
sycl::reduce_over_groupwith dpnp's min/max operators, so they takeCustomMinMaxGroupReducer. It reduced the minimum and the maximum with twocustom_reduce_over_groupcalls on the same local memory, with agroup_barrierbetween them. In the coverage build (-O1 -g1plus device-side profiling forminmax.cpp), building this kernel corrupts the compiler's heap inReduceCrossBarrierValuesPass(malloc(): unsorted double linked list corruptedincollectDependencies). It is the same pass and the same kind of corruption as the radix sort crash in #3191 (CMPLRLLVM-79305).The barriers here are needed: work-items read local memory that others wrote, so they can't become fences. This PR instead folds both extrema in one tree over a local memory of twice the work-group size, with one barrier per step for both. That gives the kernel the barrier structure of
dpnp.maxon complex, which the coverage job builds without crashing. The local memory is at most 64 KB forcomplex128on a CPU (work-group capped at 2048) and 16 KB on a GPU (capped at 512).On a Panther Lake host with the coverage build and the 2026.2.0 OpenCL CPU runtime, the complex cases of
TestMinMax::test_sizeonopencl:cpucrashed in 5 of 20 runs before the change and in none of 20 after it, in alternating runs (17 of 48 vs 0 of 50 counting all runs). The Release build doesn't crash before the change either (0 of 70). The minmax tests oftest_statistics.py,test_sycl_queue.pyandtest_usm_type.pypass onopencl:cpuandlevel_zero:gpu. The existing complextest_sizecases are the reproducer. No changelog entry, sincedpnp.minmaxis not released yet.The change also speeds up the complex reduction. On a Panther Lake H host (Arc B390), with a Release build where only
_tensor_reductions_impldiffers, the median time per call with the fix divided by master over 9 alternating rounds (lower is faster):opencl:cpulevel_zero:gpu(1000000, 16),axis=1(10000000,),axis=None(4096, 4096),axis=0The shapes are 1-D of 1000, 100000 and 10000000 elements with
axis=None,(4096, 4096)withaxis=0andaxis=1,(16, 1000000)and(1000000, 16)withaxis=1. All results match NumPy.