Add a note on early return in device buffer operations
authorArtem Zhmurov <zhmurov@gmail.com>
Sun, 11 Apr 2021 17:36:11 +0000 (20:36 +0300)
committerPaul Bauer <paul.bauer.q@gmail.com>
Mon, 12 Apr 2021 07:15:20 +0000 (07:15 +0000)
Functions that (re)allocate, clear and copy to or from
device buffer have an early return in case of zero operation
size. This is a safety mechnism that allows calling these
functions even if the buffers are not intialized, if the
size of the respective buffer is set to zero. A note is
added to the devicebuffer.h that explains why these early
returns are needed.

src/gromacs/gpu_utils/devicebuffer.h

index a13f0c62625315e7979c71e931e93b00924ea382..d3fc1c97d966230a1eafd426e3049e94fd43b2a2 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020,2021, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
 #define GMX_GPU_UTILS_DEVICEBUFFER_H
 
 /*! \libinternal \file
- *  \brief Implements the logic for handling of DeviceBuffer types in OpenCL/CUDA.
+ *  \brief Implements the logic for handling of DeviceBuffer types in OpenCL, CUDA and SYCL.
+ *
  *  Can only be included on GPU build paths.
  *
+ *  Note that most of the buffer operations have an early return, if the requested operation
+ *  size is zero. This allows for calling these functions with zero operation size even when
+ *  the underlying buffers were not properly intialized.
+ *
  *  \author Aleksei Iupinov <a.yupinov@gmail.com>
  *
  *  \inlibraryapi