Khanattila / KNLMeansCL

An optimized OpenCL implementation of the Non-local means de-noising algorithm
GNU General Public License v3.0
107 stars 22 forks source link

oclUtilsGetPlaformDeviceIDs: CL_INVALID_VALUE #40

Open neobenedict opened 5 years ago

neobenedict commented 5 years ago

Being called as: dn = res.knlm.KNLMeansCL(a=2, h=0.25, d=3)

Script evaluation failed:
Python exception: knlm.KNLMeansCL: fatal error!
 (oclUtilsGetPlaformDeviceIDs: CL_INVALID_VALUE)

Traceback (most recent call last):
  File "src/cython/vapoursynth.pyx", line 1927, in vapoursynth.vpy_evaluateScript
  File "src/cython/vapoursynth.pyx", line 1928, in vapoursynth.vpy_evaluateScript
  File "boot.py", line 25, in <module>
    dn = res.knlm.KNLMeansCL(a=2, h=0.25, d=3)
  File "src/cython/vapoursynth.pyx", line 1833, in vapoursynth.Function.__call__
vapoursynth.Error: knlm.KNLMeansCL: fatal error!
 (oclUtilsGetPlaformDeviceIDs: CL_INVALID_VALUE)

y4m [error]: bad sequence header magic
x264 [error]: could not open input file `-'

Using pocl 1.2, debian 9.5, KNL from github master compiled CLInfo:

Number of platforms                               1
  Platform Name                                   Portable Computing Language
  Platform Vendor                                 The pocl project
  Platform Version                                OpenCL 1.2 pocl 1.2 RelWithDebInfo, LLVM 3.9.1, SLEEF, POCL_DEBUG
  Platform Profile                                FULL_PROFILE
  Platform Extensions                             cl_khr_icd
  Platform Extensions function suffix             POCL

  Platform Name                                   Portable Computing Language
Number of devices                                 1
  Device Name                                     pthread-Intel(R) Xeon(R) CPU E5-2690 v2 @ 3.00GHz
  Device Vendor                                   GenuineIntel
  Device Vendor ID                                0x6c636f70
  Device Version                                  OpenCL 1.2 pocl HSTR: pthread-x86_64-pc-linux-gnu-ivybridge
  Driver Version                                  1.2
  Device OpenCL C Version                         OpenCL C 1.2 pocl
  Device Type                                     CPU
  Device Profile                                  FULL_PROFILE
  Max compute units                               40
  Max clock frequency                             3000MHz
  Device Partition                                (core)
    Max number of sub-devices                     40
    Supported partition types                     equally, by counts
  Max work item dimensions                        3
  Max work item sizes                             4096x4096x4096
  Max work group size                             4096
  Preferred work group size multiple              8
  Preferred / native vector sizes
    char                                                16 / 16
    short                                               16 / 16
    int                                                  8 / 8
    long                                                 4 / 4
    half                                                 0 / 0        (n/a)
    float                                                8 / 8
    double                                               4 / 4        (cl_khr_fp64)
  Half-precision Floating-point support           (n/a)
  Single-precision Floating-point support         (core)
    Denormals                                     Yes
    Infinity and NANs                             Yes
    Round to nearest                              Yes
    Round to zero                                 Yes
    Round to infinity                             Yes
    IEEE754-2008 fused multiply-add               No
    Support is emulated in software               No
    Correctly-rounded divide and sqrt operations  Yes
  Double-precision Floating-point support         (cl_khr_fp64)
    Denormals                                     Yes
    Infinity and NANs                             Yes
    Round to nearest                              Yes
    Round to zero                                 Yes
    Round to infinity                             Yes
    IEEE754-2008 fused multiply-add               Yes
    Support is emulated in software               No
    Correctly-rounded divide and sqrt operations  Yes
  Address bits                                    64, Little-Endian
  Global memory size                              133018750976 (123.9GiB)
  Error Correction support                        No
  Max memory allocation                           34359738368 (32GiB)
  Unified memory for Host and Device              Yes
  Minimum alignment for any data type             128 bytes
  Alignment of base address                       1024 bits (128 bytes)
  Global Memory cache type                        Read/Write
  Global Memory cache size                        26214400
  Global Memory cache line                        64 bytes
  Image support                                   Yes
    Max number of samplers per kernel             16
    Max size for 1D images from buffer            2147483648 pixels
    Max 1D or 2D image array size                 2048 images
    Max 2D image size                             32768x32768 pixels
    Max 3D image size                             2048x2048x2048 pixels
    Max number of read image args                 128
    Max number of write image args                128
  Local memory type                               Global
  Local memory size                               16777216 (16MiB)
  Max constant buffer size                        16777216 (16MiB)
  Max number of constant args                     8
  Max size of kernel argument                     1024
  Queue properties
    Out-of-order execution                        No
    Profiling                                     Yes
  Prefer user sync for interop                    Yes
  Profiling timer resolution                      1ns
  Execution capabilities
    Run OpenCL kernels                            Yes
    Run native kernels                            Yes
  printf() buffer size                            16777216 (16MiB)
  Built-in kernels
  Device Available                                Yes
  Compiler Available                              Yes
  Linker Available                                Yes
  Device Extensions                               cl_khr_byte_addressable_store cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_3d_image_writes cl_khr_fp64 cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_fp64

NULL platform behavior
  clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...)  Portable Computing Language
  clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...)   Success [POCL]
  clCreateContext(NULL, ...) [default]            Success [POCL]
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU)  Success (1)
    Platform Name                                 Portable Computing Language
    Device Name                                   pthread-Intel(R) Xeon(R) CPU E5-2690 v2 @ 3.00GHz
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_ACCELERATOR)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CUSTOM)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_ALL)  Success (1)
    Platform Name                                 Portable Computing Language
    Device Name                                   pthread-Intel(R) Xeon(R) CPU E5-2690 v2 @ 3.00GHz

ICD loader properties
  ICD loader Name                                 OpenCL ICD Loader
  ICD loader Vendor                               OCL Icd free software
  ICD loader Version                              2.2.11
  ICD loader Profile                              OpenCL 2.1
sshiroi commented 2 years ago

I ran into the same issue. It seems to be caused by pocl's CL_PLATFORM_VERSION string being longer than 64 bytes. https://github.com/Khanattila/KNLMeansCL/blob/1ba48ce02d89c280537752234bcb0b14b7fac4f6/KNLMeansCL/shared/ocl_utils.cpp#L130 Changing it to 128 fixed this error for me. After that I also ran into other pocl internal errors, but thats probably not relevant for this issue .