Bug 93375

Summary: unsupported call to function erf when running GROMACS with OpenCL
Product: Mesa Reporter: Vedran Miletić <vedran>
Component: Mesa coreAssignee: Vedran Miletić <vedran>
Status: RESOLVED FIXED QA Contact: mesa-dev
Severity: major    
Priority: medium    
Version: git   
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: GMX comment out atomics

Description Vedran Miletić 2015-12-14 19:13:27 UTC
Created attachment 120502 [details]
GMX comment out atomics

I'm running GROMACS [1] compiled with OpenCL support enabled and the attached patch applied. Running gives the following error:

Compilation of source file failed! 
-- Used build options: -DWARP_SIZE_TEST=64 -D_AMD_SOURCE_ -DGMX_OCL_FASTGEN_ADD_TWINCUT -DEL_EWALD_ANA -DEELNAME=_ElecEw -DVDWNAME=_VdwLJ -DCENTRAL=22 -DNBNXN_GPU_NCLUSTER_PER_SUPERCLUSTER=8 -DNBNXN_GPU_CLUSTER_SIZE=8 -DNBNXN_GPU_JGROUP_SIZE=4 -DNBNXN_AVOID_SING_R2_INC=1.0e-12f -I"/usr/local/gromacs/share/gromacs/opencl" 
--------------LOG START---------------
unsupported call to function erf in nbnxn_kernel_ElecEw_VdwLJ_VF_opencl---------------LOG END----------------

[1] http://www.gromacs.org/
Comment 1 Aaron Watry 2015-12-14 22:55:54 UTC
Looks like libclc does not yet implement the erf function.

erfc is implemented, but not plain erf.

The amd-builtins branch in libclc looks like there's an erf implementation that can be ported over:
https://llvm.org/svn/llvm-project/libclc/branches/amd-builtins/amd-builtins/math32/erfF.cl

The double implementation will need to be ported as well.

Note that it looks like the AMD implementation of erf requires doubles if subnormals are NOT supported... If that's an issue for someone, we'll need a workaround for that.
Comment 2 Vedran Miletić 2015-12-14 23:12:46 UTC
(In reply to Aaron Watry from comment #1)
> Looks like libclc does not yet implement the erf function.

Neat, the approach you suggest seems to be simpler than the one I had in mind, analogous to ldexp http://reviews.llvm.org/D14990

> Note that it looks like the AMD implementation of erf requires doubles if
> subnormals are NOT supported... If that's an issue for someone, we'll need a
> workaround for that.

erff() from GROMACS works without doubles: https://github.com/gromacs/gromacs/blob/fab0108c88e441d891d838bb81ca879ff9708317/src/gromacs/math/utilities.cpp

Not sure if it's usable in this form, I would have to look.
Comment 3 Vedran Miletić 2017-01-25 19:44:18 UTC
Fixed: http://lists.llvm.org/pipermail/libclc-dev/2016-May/002188.html

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.