Kernel compile errors on Mesa OpenCL in 2.76 rc3
Closed, InvalidPublic

Description

Hi! I've tried to run Blender with Mesa OpenCL on a Radeon again and it still does not work :)

The kernel compile process first outputs the following error:

input.cl:2476:12: error: used type 'float' where floating point type is not allowed
...

This is caused by safe_normalize() where ((t) ? a/t : a) should be changed to ((t>0) ? a/t : a).

After fixing this problem, the output becomes:

input.cl:151:9: warning: 'NULL' macro redefined
/usr/include/clc/clctypes.h:89:9: note: previous definition is here
input.cl:21228:2: warning: implicit declaration of function 'vstore_half4' is invalid in C99
input.cl:726:40: note: expanded from macro 'float4_store_half'
input.cl:21868:62: warning: double precision constant requires cl_khr_fp64, casting to single precision
input.cl:1982:26: note: expanded from macro 'M_2PI_F'
input.cl:105:43: note: expanded from macro 'make_float4'
input.cl:21873:63: warning: double precision constant requires cl_khr_fp64, casting to single precision
input.cl:1982:26: note: expanded from macro 'M_2PI_F'
input.cl:105:43: note: expanded from macro 'make_float4'
input.cl:22061:14: warning: double precision constant requires cl_khr_fp64, casting to single precision
input.cl:1982:26: note: expanded from macro 'M_2PI_F'
input.cl:22095:14: warning: double precision constant requires cl_khr_fp64, casting to single precision
input.cl:1982:26: note: expanded from macro 'M_2PI_F'
input.cl:22112:14: warning: double precision constant requires cl_khr_fp64, casting to single precision
input.cl:1982:26: note: expanded from macro 'M_2PI_F'
input.cl:22127:14: warning: double precision constant requires cl_khr_fp64, casting to single precision
input.cl:1982:26: note: expanded from macro 'M_2PI_F'
input.cl:47612:15: warning: double precision constant requires cl_khr_fp64, casting to single precision
input.cl:1982:26: note: expanded from macro 'M_2PI_F'
input.cl:47795:21: warning: double precision constant requires cl_khr_fp64, casting to single precision
input.cl:1982:26: note: expanded from macro 'M_2PI_F'
input.cl:47878:21: warning: double precision constant requires cl_khr_fp64, casting to single precision
input.cl:1982:26: note: expanded from macro 'M_2PI_F'
input.cl:49055:52: warning: implicit declaration of function 'native_tan' is invalid in C99
input.cl:133:17: note: expanded from macro 'tanf'
input.cl:121:32: note: expanded from macro 'atanf'
input.cl:49084:10: warning: double precision constant requires cl_khr_fp64, casting to single precision
input.cl:1982:26: note: expanded from macro 'M_2PI_F'
input.cl:51727:25: warning: double precision constant requires cl_khr_fp64, casting to single precision
input.cl:1982:26: note: expanded from macro 'M_2PI_F'
input.cl:52138:58: warning: double precision constant requires cl_khr_fp64, casting to single precision
input.cl:1982:26: note: expanded from macro 'M_2PI_F'
input.cl:55237:32: warning: double precision constant requires cl_khr_fp64, casting to single precision
input.cl:1982:26: note: expanded from macro 'M_2PI_F'
input.cl:57639:12: warning: double precision constant requires cl_khr_fp64, casting to single precision
input.cl:1982:26: note: expanded from macro 'M_2PI_F'
unsupported initializer for address space in kernel_ocl_bake

If I comment out the line with kernel_bake_evaluate() call that error goes away O_o so the problem lies somewhere in that call... I think it's strange that only this kernel function fails to compile and others do not O_o. Also with that line removed there's another error:

unsupported call to function vstore_half4 in kernel_ocl_convert_to_half_float

It seems half floats (cl_khr_fp16 extension) are listed as optional in OpenCL specification, can you provide a way to use Blender without them?

Details

Type
Bug
Vitaliy Filippov (vitalif) updated the task description. (Show Details)
Vitaliy Filippov (vitalif) raised the priority of this task from to Needs Triage.
Bastien Montagne (mont29) claimed this task.

Thanks for the report, but Gallium OpenCL support is far from complete (http://dri.freedesktop.org/wiki/GalliumCompute/), if you want to use OCL on your AMD GPU you need to use their (latest!) proprietary drivers - and even then, only latest architectures are supported afaik…

I don't want to use proprietary drivers :) at least under Linux.

Can you at least fix the first bug ? (t>0) ?

And can you please tell what exactly Blender is missing from the Gallium OpenCL implementation? From the errors above I see that it's just half-precision floats (cl_khr_fp16). Is there something else?

It isn't a bug in the code, it's proper expression which could also happen in other areas of kernel. Blender requires full OpenCL 1.1 at least in order to function properly. For until it's officially supported in Mesa i don't really see reasoning trying to workaround issues caused by WIP nature of Mesa code.

For a more up-to-date discussion of this issue, see here:

https://developer.blender.org/T50522

short answer: it appears that GPU rendering with Mesa/openCL can now be made to work, if various Linux distributions will apply the known fixes for problems with libclc and LLVM, some of which are apparent above.