mirror of
https://github.com/cp2k/cp2k.git
synced 2026-07-29 06:35:28 -04:00
DBM: OpenCL implementation (#3375)
* There are three main implementations 1. DBM_MULTIPLY_SPLIT=1: default kernel with smallest LOC-number uses private/register-backed buffer. This implementation is simple and performs best even on different vendor's GPUs. There is moderate unrolling/code-bloat leveraging macros. Though, there is no "old school GPU" like copy-into SLM; if there is re-use, it leverage existing caches between registers and global memory. 2. DBM_MULTIPLY_SPLIT=2..N with DBM_MULTIPLY_SPLIT=8 matching the CUDA implementation using shared/local memory. This implementation matches the existing CUDA implementation and perform equal and reasonable across GPUs. There is moderate unrolling/code-bloat leveraging macros; heuristics are revised/different from CUDA implementation (less cases). 3. DBM_MULTIPLY_GEN=1: uses https://github.com/intel/tiny-tensor-compiler and IR describing DBM's input format. The IR-file (https://github.com/hfp/cp2k/blob/master/src/dbm/dbm_multiply_opencl.ir) is not part of PR. The generated kernel-code is not yet competitive. * The amount of code in the OpenCL-kernel and and C based glue-code can be *significantly* reduced (fraction of LOC) when removing for instance implementation 2 and 3 (above mentioned). Reducing the number of LOC can be part of a future cleanup (and once code is settled). * check_file_properties.py: support C-comments, and omit checking OpenCL source code (it is usually compiled at runtime, i.e., machine-driven rather than user-controlled).
This commit is contained in:
parent
17d3be3016
commit
25edd69807
3 changed files with 332 additions and 98 deletions
|
|
@ -23,7 +23,7 @@ FLAG_EXCEPTIONS = (
|
|||
r"CUDA_VERSION",
|
||||
r"DBM_LIBXSMM_PREFETCH",
|
||||
r"DBM_VALIDATE_AGAINST_DBCSR",
|
||||
r"OPENCL_DBM_SOURCE_MULTIPLY_OPENCL",
|
||||
r"OPENCL_DBM_SOURCE_MULTIPLY",
|
||||
r"FD_DEBUG",
|
||||
r"GRID_DO_COLLOCATE",
|
||||
r"INTEL_MKL_VERSION",
|
||||
|
|
@ -212,7 +212,8 @@ def check_file(path: pathlib.Path) -> List[str]:
|
|||
if line.split()[0] not in ("#if", "#ifdef", "#ifndef", "#elif"):
|
||||
continue
|
||||
|
||||
line = line.split("//", 1)[0]
|
||||
line = line.split("/*", 1)[0] # C comment
|
||||
line = line.split("//", 1)[0] # C++ comment
|
||||
line_continuation = line.rstrip().endswith("\\")
|
||||
line = OP_RE.sub(" ", line)
|
||||
line = line.replace("defined", " ")
|
||||
|
|
@ -228,6 +229,8 @@ def check_file(path: pathlib.Path) -> List[str]:
|
|||
flags = {flag for flag in flags if not FLAG_EXCEPTIONS_RE.match(flag)}
|
||||
|
||||
for flag in sorted(flags):
|
||||
if fn_ext == ".cl": # usually compiled at RT (no direct user-control)
|
||||
continue
|
||||
if flag == "_OMP_H" and fn_ext == ".cu":
|
||||
continue
|
||||
if flag not in get_install_txt():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue