Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Kernel argument type mismatch #146

Open
kpp opened this issue Jun 8, 2019 · 1 comment
Open

Error: Kernel argument type mismatch #146

kpp opened this issue Jun 8, 2019 · 1 comment

Comments

@kpp
Copy link
Contributor

kpp commented Jun 8, 2019

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
@c0gent
Copy link
Member

c0gent commented Jun 8, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants