Syncleus / aparapi

The New Official Aparapi: a framework for executing native Java and Scala code on the GPU.
http://aparapi.com
Apache License 2.0
465 stars 59 forks source link

Failed to translate Kernel #147

Open PtrMan opened 5 years ago

PtrMan commented 5 years ago

Either the kernel is written in a wrong way or this lib is bugged.

It prints these(and more) errors to the console

clBuildProgram failed
************************************************
C:\Users\R0B3\AppData\Local\Temp\\OCL21676T0.cl:11:20: error: expected member name or ';' after declaration specifiers
   __global float *kernel;
   ~~~~~~~~~~~~~~  ^
C:\Users\R0B3\AppData\Local\Temp\\OCL21676T0.cl:11:20: error: expected ';' at end of declaration list
   __global float *kernel;
                   ^
                   ;
C:\Users\R0B3\AppData\Local\Temp\\OCL21676T0.cl:20:156: error: expected ')'
double org_opennars_applications_cv_Conv__conv4( __global int* imgArr, int imgWidth, int imgHeight, int kernelCenterX, int kernelCenterY,  __global float* kernel, int kernelSize){
                                                                                                                                                           ^
C:\Users\R0B3\AppData\Local\Temp\\OCL21676T0.cl:20:48: note: to match this '('
double org_opennars_applications_cv_Conv__conv4( __global int* imgArr, int imgWidth, int imgHeight, int kernelCenterX, int kernelCenterY,  __global float* kernel, int kernelSize){
                                               ^
C:\Users\R0B3\AppData\Local\Temp\\OCL21676T0.cl:20:156: error: parameter name omitted
double org_opennars_applications_cv_Conv__conv4( __global int* imgArr, int imgWidth, int imgHeight, int kernelCenterX, int kernelCenterY,  __global float* kernel, int kernelSize){
                                                                                                                                                           ^
C:\Users\R0B3\AppData\Local\Temp\\OCL21676T0.cl:22:19: error: use of undeclared identifier 'kernelSize'
   for (int dy = -kernelSize / 2; dy<(kernelSize / 2); dy++){
                  ^

when compiling

https://pastebin.com/Dmtj3758

PtrMan commented 5 years ago

Ah, the driver doesn't like the variable name "kernel" - so it craps out

PtrMan commented 5 years ago

Maybe this lib should add a prefix to all variable names, this way this BS can't happen

grfrost commented 5 years ago

Sadly (but no surprisingly) kernel is a reserved word in OpenCL