cogciprocate / ocl

OpenCL for Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error: Kernel argument type mismatch

kpp opened this issue · comments

commented

I switched from Beignet to intel-ocl and I got this error:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Kernel argument type mismatch. The argument named: 'in_points' at index: [0] should be a 'Point*' (ArgType { base_type: Int, cardinality: One, is_ptr: true }).', src/libcore/result.rs:997:5

I used .disable_arg_type_check() as a temporary solution however I'd like to know how to get rid of this error.

Project (67 lines): https://github.com/kpp/test_ocl/

Install intel-opencl:

sudo add-apt-repository ppa:intel-opencl/intel-opencl
sudo apt-get update
sudo apt-get install intel-opencl

Run the project:

cargo run -- 42

This is a bug in the type matching code used when creating a kernel. The fact that Point contains the substring int is causing the crude type string matching code to run awry (https://github.com/cogciprocate/ocl/blob/master/ocl/src/standard/kernel.rs#L1628). Type names returned from a call to clGetKernelArgInfo (with CL_KERNEL_ARG_TYPE_NAME) are simply string matched using str::contains. The reason I used contains must have been that different implementations used different formats in the type name result but I can't remember. Will need to find a more robust way to parse the type name string.

I'll try to come up with a fix as soon as I have time but feel free to take a look yourself.