[all-commits] [llvm/llvm-project] ba93e4: [OpenMP][NFC] Add missing virtual destructor to si...

Johannes Doerfert via All-commits all-commits at lists.llvm.org
Mon Mar 28 20:34:25 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ba93e4e33ead8aaa20e762211facaf3fa7e1439f
      https://github.com/llvm/llvm-project/commit/ba93e4e33ead8aaa20e762211facaf3fa7e1439f
  Author: Johannes Doerfert <johannes at jdoerfert.de>
  Date:   2022-03-28 (Mon, 28 Mar 2022)

  Changed paths:
    M openmp/libomptarget/plugins/cuda/src/rtl.cpp

  Log Message:
  -----------
  [OpenMP][NFC] Add missing virtual destructor to silence warning


  Commit: b316126887d0e41a9e22717419d43af9d81b764c
      https://github.com/llvm/llvm-project/commit/b316126887d0e41a9e22717419d43af9d81b764c
  Author: Johannes Doerfert <johannes at jdoerfert.de>
  Date:   2022-03-28 (Mon, 28 Mar 2022)

  Changed paths:
    M openmp/libomptarget/include/device.h
    M openmp/libomptarget/src/device.cpp
    M openmp/libomptarget/src/omptarget.cpp
    A openmp/libomptarget/test/mapping/map_back_race.cpp

  Log Message:
  -----------
  [OpenMP][FIX] Avoid races in the handling of to be deleted mapping entries

If we decided to delete a mapping entry we did not act on it right away
but first issued and waited for memory copies. In the meantime some
other thread might reuse the entry. While there was some logic to avoid
colliding on the actual "deletion" part, there were two races happening:

1) The data transfer back of the thread deleting the entry and
   the data transfer back of the thread taking over the entry raced.
2) The update to the shadow map happened regardless if the entry was
   actually reused by another thread which left the shadow map in a
   inconsistent state.

To fix both issues we will now update the shadow map and delete the
entry only if we are sure the thread is responsible for deletion, hence
no other thread took over the entry and reused it. We also wait for a
potential former data transfer from the device to finish before we issue
another one that would race with it.

Fixes https://github.com/llvm/llvm-project/issues/54216

Differential Revision: https://reviews.llvm.org/D121058


Compare: https://github.com/llvm/llvm-project/compare/cd26190a10fc...b316126887d0


More information about the All-commits mailing list