Repository: opencv
Issue: Run opencv_ test_ Core, test interrupt, and segment fault
Labels: category: ocl,category: 3rdparty

### System Information

Machine : Ubuntu 20.04
OpenCV version: 4.7.0-dev
OpenCV VCS version: 4.7.0-64-g9eb78eeb18
Build type: Debug
Compiler: /usr/bin/c++  (ver 9.3.0)

### Detailed description

 OpenCL.support_SPIR_programs

### Steps to reproduce

root@D2000-Ubuntu:~/opencv_work/opencv/build/bin# export OPENCV_TEST_DATA_PATH=/root/opencv_work/opencv_extra/testdata/
root@D2000-Ubuntu:~/opencv_work/opencv/build/bin# ./opencv_test_core 
[ INFO:0@0.095] global ocl.cpp:1186 haveOpenCL Initialize OpenCL runtime...
PVR: Hint: Setting CLDMA to 1
[ INFO:0@0.116] global ocl.cpp:1192 haveOpenCL OpenCL: found 1 platforms
[ INFO:0@0.116] global ocl.cpp:984 getInitializedExecutionContext OpenCL: initializing thread execution context
[ INFO:0@0.116] global ocl.cpp:994 getInitializedExecutionContext OpenCL: creating new execution context...
[ INFO:0@0.116] global ocl.cpp:1012 getInitializedExecutionContext OpenCL: device=PhytiumVR A-Series AXT-16-512
CTEST_FULL_OUTPUT
OpenCV version: 4.7.0-dev
OpenCV VCS version: 4.7.0-64-g9eb78eeb18
Build type: Debug
WARNING: build value differs from runtime: Release
Compiler: /usr/bin/c++  (ver 9.3.0)
[ INFO:0@0.155] global registry_parallel.impl.hpp:96 ParallelBackendRegistry core(parallel): Enabled backends(2, sorted by priority): TBB(1000); OPENMP(990)
[ INFO:0@0.155] global parallel_for.tbb.hpp:54 ParallelForBackend Initializing TBB parallel backend: TBB_INTERFACE_VERSION=11101
[ INFO:0@0.155] global parallel.cpp:77 createParallelForAPI core(parallel): using backend: TBB (priority=1000)
Parallel framework: tbb (nthreads=8)
CPU features: NEON FP16
OpenCL Platforms: 
    PhytiumVR
        iGPU: PhytiumVR A-Series AXT-16-512 (OpenCL 3.0 )
Current OpenCL device: 
    Type = iGPU
    Name = PhytiumVR A-Series AXT-16-512
    Version = OpenCL 3.0 
    Driver version = 1.16@6099580
    Address bits = 64
    Compute units = 2
    Max work group size = 1024
    Local memory size = 28 KB
    Max memory allocation size = 218 MB 923 KB
    Double support = No
    Half support = Yes
    Host unified memory = Yes
    Device extensions:
        cl_khr_icd
        cl_khr_fp16
        cl_img_spirv
        cles_khr_int64
        cl_img_yuv_image
        cl_khr_device_uuid
        cl_khr_depth_images
        cl_khr_priority_hints
        cl_img_generate_mipmap
        cl_khr_3d_image_writes
        cl_img_cached_allocations
        cl_khr_create_command_queue
        cl_img_mem_properties
        cl_img_mem_properties_relax_alloc_requirements
        cl_khr_extended_versioning
        cl_khr_image2d_from_buffer
        cl_khr_byte_addressable_store
        cl_khr_local_int32_base_atomics
        cl_khr_global_int32_base_atomics
        cl_khr_local_int32_extended_atomics
        cl_khr_global_int32_extended_atomics
        cl_khr_subgroups
        cl_khr_spir
        cl_khr_egl_image
        cl_arm_import_memory
        cl_arm_import_memory_dma_buf
        cl_img_protected_content
        cl_img_semaphore
        cl_img_external_semaphore
        cl_img_external_semaphore_sync_fd
    Has AMD Blas = No
    Has AMD Fft = No
    Preferred vector width char = 1
    Preferred vector width short = 1
    Preferred vector width int = 1
    Preferred vector width long = 1
    Preferred vector width float = 1
    Preferred vector width double = 0
    Preferred vector width half = 0
TEST: Skip tests with tags: 'mem_6gb', 'verylong'
[==========] Running 11578 tests from 259 test cases.
[----------] Global test environment set-up.
[----------] 1 test from OCL_MeanStdDev_
[ RUN      ] OCL_MeanStdDev_.ZeroMask
[ INFO:0@0.159] global ocl.cpp:5370 __init_buffer_pools OpenCL: Initializing buffer pool for context@0 with max capacity: poolSize=0 poolSizeHostPtr=0
[ INFO:0@0.159] global ocl.cpp:410 OpenCLBinaryCacheConfigurator Successfully initialized OpenCL cache directory: /root/.cache/opencv/4.x-dev/opencl_cache/
[ INFO:0@0.159] global ocl.cpp:434 prepareCacheDirectoryForContext Preparing OpenCL cache configuration for context: Phytium_Information_Technologies--PhytiumVR_A-Series_AXT-16-512--1_16_6099580
[ INFO:0@0.168] global ts.cpp:857 testTearDown Memory_usage (OpenCL): 149 (base=0  current=149)
[       OK ] OCL_MeanStdDev_.ZeroMask (11 ms)
[----------] 1 test from OCL_MeanStdDev_ (11 ms total)

[----------] 1 test from OCL_Gemm
[ RUN      ] OCL_Gemm.small
[       OK ] OCL_Gemm.small (3 ms)
[----------] 1 test from OCL_Gemm (3 ms total)

[----------] 4 tests from Image2D
[ RUN      ] Image2D.createAliasEmptyUMat
[       OK ] Image2D.createAliasEmptyUMat (0 ms)
[ RUN      ] Image2D.createImage2DWithEmptyUMat
[       OK ] Image2D.createImage2DWithEmptyUMat (1 ms)
[ RUN      ] Image2D.createAlias
Impossible to create alias for selected image. Test skipped.
[ INFO:0@0.172] global ts.cpp:857 testTearDown Memory_usage (OpenCL): 16384 (base=0  current=0)
[       OK ] Image2D.createAlias (0 ms)
[ RUN      ] Image2D.turnOffOpenCL
[ INFO:0@0.172] global ts.cpp:857 testTearDown Memory_usage (OpenCL): 16384 (base=0  current=0)
[       OK ] Image2D.turnOffOpenCL (0 ms)
[----------] 4 tests from Image2D (1 ms total)

[----------] 4 tests from OpenCL
[ RUN      ] OpenCL.support_binary_programs
Program binary size: 8440 bytes
(4960) PVR:(Warning): PVRSRVFenceWaitI: 200ms timeout too short, using 5100ms [ pvrsrv_sync_fdsync.c:109 ]
Kernel time: 9.961 ms
(4960) PVR:(Warning): PVRSRVFenceWaitI: 200ms timeout too short, using 5100ms [ pvrsrv_sync_fdsync.c:109 ]
[ INFO:0@0.361] global ts.cpp:857 testTearDown Memory_usage (OpenCL): 16777216 (base=0  current=0)
[       OK ] OpenCL.support_binary_programs (189 ms)
[ RUN      ] OpenCL.support_SPIR_programs
Program SPIR size: 1700 bytes
(4960) PVR:(Fatal): Debug assertion failed! (false && "Unreachable. Binary should have been loaded with clCreateProgramWithBinary") [ program.c:1291 ]
Segmentation fault (core dumped)


### Issue submission checklist

- [X] I report the issue, it's not a question
- [X] I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
- [ ] I updated to the latest OpenCV version and the issue is still there
- [ ] There is reproducer code and related data files (videos, images, onnx, etc)