JuliaGPU / OpenCL.jl

OpenCL Julia bindings

Home Page:https://juliagpu.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CL_INVALID_VALUE

juliohm opened this issue · comments

After updating my packages, I started getting this error whenever I try to create a Context object:

OpenCL.Context(gpu)

ERROR: CLError(code=-30, CL_INVALID_VALUE)
in Context at /home/juliohm/.julia/v0.4/OpenCL/src/context.jl:74

Can someone please help me solve the issue?

From which version to which version have you updated? Did you also change your driver/system packages.

@vchuravy I did the Julia update this last week. I don't remember seeing any updates in the OS regarding the CL drivers though. How can I further debug this issue?

This is the output of clinfo:

Number of platforms 1
Platform Name Intel Gen OCL Driver
Platform Vendor Intel
Platform Version OpenCL 1.2 beignet 1.2 (git-b55060c)
Platform Profile FULL_PROFILE
Platform Extensions 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_byte_addressable_store cl_khr_3d_image_writes cl_khr_image2d_from_buffer cl_khr_spir cl_khr_icd cl_intel_accelerator cl_intel_motion_estimation cl_intel_subgroups
Platform Extensions function suffix Intel

Platform Name Intel Gen OCL Driver
Number of devices 1
Device Name Intel(R) HD Graphics Skylake ULT GT2
Device Vendor Intel
Device Vendor ID 0x8086
Device Version OpenCL 1.2 beignet 1.2 (git-b55060c)
Driver Version 1.2
Device OpenCL C Version OpenCL C 1.2 beignet 1.2 (git-b55060c)
Device Type GPU
Device Profile FULL_PROFILE
Max compute units 24
Max clock frequency 1000MHz
Device Partition (core)
Max number of sub-devices 1
Supported partition types None, None, None
Max work item dimensions 3
Max work item sizes 512x512x512
Max work group size 512
Preferred work group size multiple 16
Preferred / native vector sizes
char 16 / 8
short 8 / 8
int 4 / 4
long 2 / 2
half 0 / 8 (cl_khr_fp16)
float 4 / 4
double 0 / 2 (n/a)
Half-precision Floating-point support (cl_khr_fp16)
Denormals No
Infinity and NANs Yes
Round to nearest Yes
Round to zero No
Round to infinity No
IEEE754-2008 fused multiply-add No
Support is emulated in software No
Correctly-rounded divide and sqrt operations No
Single-precision Floating-point support (core)
Denormals No
Infinity and NANs Yes
Round to nearest Yes
Round to zero No
Round to infinity No
IEEE754-2008 fused multiply-add No
Support is emulated in software No
Correctly-rounded divide and sqrt operations No
Double-precision Floating-point support (n/a)
Address bits 32, Little-Endian
Global memory size 4115660800 (3.833GiB)
Error Correction support No
Max memory allocation 3085959168 (2.874GiB)
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 8192
Global Memory cache line 64 bytes
Image support Yes
Max number of samplers per kernel 16
Max size for 1D images from buffer 65536 pixels
Max 1D or 2D image array size 2048 images
Base address alignment for 2D image buffers 4096 bytes
Pitch alignment for 2D image buffers 1 bytes
Max 2D image size 8192x8192 pixels
Max 3D image size 8192x8192x2048 pixels
Max number of read image args 128
Max number of write image args 8
Local memory type Global
Local memory size 65536 (64KiB)
Max constant buffer size 134217728 (128MiB)
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 80ns
Execution capabilities
Run OpenCL kernels Yes
Run native kernels Yes
SPIR versions 1.2
printf() buffer size 1048576 (1024KiB)
Built-in kernels __cl_copy_region_align4;__cl_copy_region_align16;__cl_cpy_region_unalign_same_offset;__cl_copy_region_unalign_dst_offset;__cl_copy_region_unalign_src_offset;__cl_copy_buffer_rect;__cl_copy_image_1d_to_1d;__cl_copy_image_2d_to_2d;__cl_copy_image_3d_to_2d;__cl_copy_image_2d_to_3d;__cl_copy_image_3d_to_3d;__cl_copy_image_2d_to_buffer;__cl_copy_image_3d_to_buffer;__cl_copy_buffer_to_image_2d;__cl_copy_buffer_to_image_3d;__cl_fill_region_unalign;__cl_fill_region_align2;__cl_fill_region_align4;__cl_fill_region_align8_2;__cl_fill_region_align8_4;__cl_fill_region_align8_8;__cl_fill_region_align8_16;__cl_fill_region_align128;__cl_fill_image_1d;__cl_fill_image_1d_array;__cl_fill_image_2d;__cl_fill_image_2d_array;__cl_fill_image_3d;
Device Available Yes
Compiler Available Yes
Linker Available Yes
Device Extensions 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_byte_addressable_store cl_khr_3d_image_writes cl_khr_image2d_from_buffer cl_khr_spir cl_khr_icd cl_intel_accelerator cl_intel_motion_estimation cl_intel_subgroups cl_khr_fp16

NULL platform behavior
clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...) Intel Gen OCL Driver
clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...) Success [Intel]
clCreateContext(NULL, ...) [default] Success [Intel]
clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU) No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU) Success (1)
Platform Name Intel Gen OCL Driver
Device Name Intel(R) HD Graphics Skylake ULT GT2
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 Intel Gen OCL Driver
Device Name Intel(R) HD Graphics Skylake ULT GT2

ICD loader properties
ICD loader Name OpenCL ICD Loader
ICD loader Vendor OCL Icd free software
ICD loader Version 2.2.9
ICD loader Profile OpenCL 2.1

Did you update the kernel?

@yuyichao probably, what do you have in mind?

I've seen OpenCL initialization error if you updated the kernel and haven't restarted yet. (And in general, the kernel and graphic drivers are "opencl related")

@yuyichao I will restart the laptop and see if the error persists.

Restarted the laptop and the issue is still there. What else can I print or investigate to find the root of the issue?

Can you give me the exact version of OpenCL.jl that you are using Pkg.status("OpenCL")?
And maybe try the current master Pkg.checkout("OpenCL")

Sure, this is what I have:

Julia Version 0.4.7-pre+3
Commit eb322c0* (2016-07-10 08:08 UTC)
Platform Info:
System: Linux (x86_64-pc-linux-gnu)
CPU: Intel(R) Core(TM) i7-6500U CPU @ 2.50GHz
WORD_SIZE: 64
BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
LAPACK: libopenblas64_
LIBM: libopenlibm
LLVM: libLLVM-3.3

  • OpenCL 0.3.6

I am running a study on the CPU without OpenCL for now. Will try the master branch tomorrow after the run is finished. The GPU is something that I really need in my research, I appreciate if you can help.

Ok, the next step after that is to figure out what we are passing to OpenCL and why Beignet&Skylake seem to have a problem here.

You can add debug output around https://github.com/JuliaGPU/OpenCL.jl/blob/v0.3.6/src/context.jl#L71 to all the arguments we are passing.

Also just to make sure that I understand you correctly. You updated you Julia version to 0.4.7-pre and before that this worked on this computer? Do you remember which Julia version you were on before?

I updated Julia weeks ago. Everything was working fine with OpenCL and the GPU in 0.4.7-pre. Recently I updated the packages and the OS. Probably a Beignet issue?

I just installed beignet (from git with the same commit you have)

julia> cl.devices(:gpu)
1-element Array{OpenCL.Device,1}:
 OpenCL.Device(Intel(R) HD Graphics Haswell Ultrabook GT2 Mobile on Intel Gen OCL Driver @0x00007f18c0d967c0)

julia> cl.Context(cl.devices(:gpu))
OpenCL.Context(@0x00000000038ad660 on Intel(R) HD Graphics Haswell Ultrabook GT2 Mobile)

So it might be a Skylake+Beignet issue. We didn't update OpenCL.jl in a while so the most likely seems the OS update. You could try going back to an older version of beignet or update to the latest master.

Thank you, I will checkout OpenCL.jl, and play with the Beignet version later today. I will also print debug information around the section you suggested.

If I print the arguments passed to api.clCreateContext(), the output looks like the following:

    println(ctx_properties)
    println(n_devices)
    println(device_ids)
    println(ctx_callback_ptr)
    println(ctx_user_data)

Ptr{Void} @0x0000000000000000
1
[Ptr{Void} @0x00007fbe0c4b3660]
Ptr{Void} @0x0000000000000000
Base.RefValue{OpenCL._CtxErr}(OpenCL._CtxErr(Ptr{Void} @0x0000000002ad2040,Ptr{Int8} @0x0000000000000000,Ptr{Void} @0x0000000000000000,0x0000000000000000))

Anything strange? I tried checking out master, but it requires Julia v0.5.

ctx_callback_ptr is null which confused me initialiy and is a problem that we need to fix (precompilation is problematic here). But according to the spec that is fine https://www.khronos.org/registry/cl/sdk/1.2/docs/man/xhtml/clCreateContext.html.

Maybe try setting ctx_user_data = C_NULL

Also sorry about master. The code for v0.4 is on release-0.4.

You can also try if https://github.com/JuliaGPU/OpenCL.jl/tree/callbacks solves the problem for you.

Hi @vchuravy , I didn't understand, could you please elaborate? Is this a bug in OpenCL.jl? Why setting ctx_user_data = C_NULL?

OpenCL implementations are tricky. Some of them have problems with certain patterns and fail sometimes.

There is indeed a bug in OpenCL.jl, that we pass a null pointer instead of the actual cfunction to the Context creation, put the standard allows for passing a null pointer. Now it is weird to pass a null pointer as the callback and a meaningful data pointer and my thinking here is that they might have a check to see the if the callback pointer is null the payload most also be null.

I fixed the bug on the release-0.4 branch so you also check that out.

@vchuravy I can confirm the issue is gone in release-0.4. Will this receive a tag soon in METADATA?

Yes. Once I am back in front of a computer.

Good to hear that this solved your problem and thank you for your help
along the way.

On Fri, 12 Aug 2016, 23:42 Júlio Hoffimann Mendes, notifications@github.com
wrote:

@vchuravy https://github.com/vchuravy I can confirm the issue is gone
in release-0.4. Will this receive a tag soon in METADATA?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#112 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAI3ao_Qpsj__tyAvfroER-LuwPs81_Zks5qfT0igaJpZM4Jhv95
.