Project

General

Profile

Task #1879

make the GROMACS OpenCL kernel work on Gallium

Added by Szilárd Páll almost 4 years ago. Updated about 1 year ago.

Status:
In Progress
Priority:
Low
Assignee:
-
Category:
mdrun
Target version:
Difficulty:
uncategorized
Close

Description

In order to provide a pure-OSS alternative, we should make sure that the GROMACS OpeCL kernels can be compiled with the Gallium LLVM back-end for relevant architectures. The discussion originally started here:
https://mailman-1.sys.kth.se/pipermail/gromacs.org_gmx-developers/2015-November/008793.html

Target architectures (for now) are: AMD devices supported by the radeonsi Mesa driver (high-end HD 7000 and GCN cards).

Current status is missing/buggy atomic_cmpxchg() which is required for the reduction.

vecAdd.c (8.25 KB) vecAdd.c Sample code to test the atomic support with. Szilárd Páll, 12/14/2015 06:10 PM

History

#1 Updated by Vedran Miletic over 3 years ago

Szilárd Páll wrote:

Current status is missing/buggy atomic_cmpxchg() which is required for the reduction.

Small update: this has now been implemented in LLVM git: https://github.com/llvm-mirror/llvm/commit/059753cf8e266f9a687b5c27593f5fb2b1f8b077

Current GROMACS git fails to compile with:

-- Used build options: -DWARP_SIZE_TEST=64 -D_AMD_SOURCE_ -DGMX_OCL_FASTGEN_ADD_TWINCUT -DEL_EWALD_ANA -DEELNAME=_ElecEw -DLJ_COMB_GEOM -DVDWNAME=_VdwLJCombGeom -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 -DIATYPE_SHMEM -I"/usr/local/gromacs/share/gromacs/opencl" 
--------------LOG START---------------
In file included from input.cl:59:
In file included from /usr/local/include/nbnxn_ocl_kernels_fastgen_add_twincut.clh:60:
/usr/local/include/nbnxn_ocl_kernel_utils.clh:154:1: error: OpenCL does not support the 'static' storage class specifier
---------------LOG END----------------

There are other issues, namely missing erf() function in libclc (erfc() can be used instread), and Clover's inability to handle structs correctly.

#2 Updated by Szilárd Páll over 3 years ago

I can't find it mentioned in the spec that static function qualifiers are not supported nor do any of the three compilers I tried complain about it. Have you found such info in the spec? Additionally, that error seems buggy because it refers to storage class specifiers even though this is a function.

#3 Updated by Vedran Miletic over 3 years ago

Szilárd Páll wrote:

I can't find it mentioned in the spec that static function qualifiers are not supported nor do any of the three compilers I tried complain about it. Have you found such info in the spec? Additionally, that error seems buggy because it refers to storage class specifiers even though this is a function.

According to [1], storage classes apply to functions as well. Other compilers do not complain because they probably compile OpenCL 1.2+. Mesa/Gallium/Clover uses OpenCL 1.1; page 194 of OpenCL 1.1 specification [2] claims "The extern, static, auto and register storage-class specifiers are not supported."

We should probably remove that static function qualifier if we want to target OpenCL 1.1.

[1] http://en.cppreference.com/w/cpp/language/storage_duration
[2] https://www.khronos.org/registry/cl/specs/opencl-1.1.pdf

P.S.
Strictly speaking, "OpenCL does not support 'static' storage class specifier" which Clang now outputs is not a true statement, so I submitted a patch to Clang to include OpenCL version in diagnostics: http://reviews.llvm.org/D19780

#4 Updated by Szilárd Páll about 1 year ago

Vedran, any update on this? Should we keep the issue open?

Also available in: Atom PDF