Skip to content

OpenCL: libmath functions explode for float64 #631

@jamesavery

Description

@jamesavery

Both bh107 and bohrium explode when applying libmath functions (sin, cos, tanh, exp, etc.) to float64 data in OpenCL mode.

In [1]: import bohrium as bh                                                                                                                                                                                       
In [2]: A = bh.random.random((10))                                                                                                                                                                                 
In [3]: A.dtype                                                                                                                                                                                                    
Out[3]: dtype('float64')
In [4]: B = bh.tanh(A)                                                                                                                                                                                             
In [5]: bh.flush()                                                                                                                                                                                                 
Error code: -11
Error building: 
stringInput.cl:18:20: error: call to 'tanh' is ambiguous
/usr/lib/x86_64-linux-gnu/beignet/include/ocl_math.h:34:20: note: candidate function
/usr/lib/x86_64-linux-gnu/beignet/include/ocl_math.h:133:19: note: candidate function
/usr/lib/x86_64-linux-gnu/beignet/include/ocl_math.h:1457:21: note: candidate function
/usr/lib/x86_64-linux-gnu/beignet/include/ocl_math.h:1458:21: note: candidate function
/usr/lib/x86_64-linux-gnu/beignet/include/ocl_math.h:1459:21: note: candidate function
/usr/lib/x86_64-linux-gnu/beignet/include/ocl_math.h:1460:21: note: candidate function
/usr/lib/x86_64-linux-gnu/beignet/include/ocl_math.h:1461:22: note: candidate function
/usr/lib/x86_64-linux-gnu/beignet/include/ocl_math.h:1462:20: note: candidate function
/usr/lib/x86_64-linux-gnu/beignet/include/ocl_math.h:1463:20: note: candidate function
/usr/lib/x86_64-linux-gnu/beignet/include/ocl_math.h:1464:20: note: candidate function
/usr/lib/x86_64-linux-gnu/beignet/include/ocl_math.h:1465:20: note: candidate function
/usr/lib/x86_64-linux-gnu/beignet/include/ocl_math.h:1466:21: note: candidate function

terminate called after throwing an instance of 'cl::Error'
  what():  clBuildProgram
Aborted

bh107 does exactly the same. However, for float32 it works:

In [1]: import bohrium as bh                                                                                                                                                                                       
In [2]: A = bh.random.random((10)).astype(bh.float32)                                                                                                                                                              
In [3]: B = bh.tanh(A)                                                                                                                                                                                             
In [5]: bh.flush()                                                                                                                                                                                                 
In [6]: print(B)                                                                                                                                                                                                   
[0.7571309  0.37564066 0.19148484 0.27567866 0.7203832  0.5446466
 0.28313637 0.7497538  0.64565045 0.31858957]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions