YaccConstructor / Brahma.FSharp

F# quotation to OpenCL translator and respective runtime to utilize GPGPUs in F# applications.
http://yaccconstructor.github.io/Brahma.FSharp
Eclipse Public License 1.0
74 stars 17 forks source link

Ambiguous call of OpenCL math functions in some cases #130

Open dpanfilyonok opened 2 years ago

dpanfilyonok commented 2 years ago

Describe the bug OpenCL's compilation fails with error: call to 'max' is ambiguous on kernel

<@
    fun (range: Range1D) (buf: int16 clarray) ->
        buf.[0] <- max buf.[0] 1s
@>

which translates to

__kernel void brahmaKernel (__global short * buf)
{buf [0] = max (buf [0], 1) ;}

Expected behavior Compilation is successful.

gsvgit commented 2 years ago

Looks like we should carefully translate constant literals.