[all-commits] [llvm/llvm-project] 9b2832: [OpenMP] Wait for kernel prior to memory deallocation

Shilei Tian via All-commits all-commits at lists.llvm.org
Wed Jul 22 19:55:53 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 9b2832c0897c1d39846eee0ad84bf787f05d2d4b
      https://github.com/llvm/llvm-project/commit/9b2832c0897c1d39846eee0ad84bf787f05d2d4b
  Author: Shilei Tian <tianshilei1992 at gmail.com>
  Date:   2020-07-22 (Wed, 22 Jul 2020)

  Changed paths:
    M openmp/libomptarget/src/omptarget.cpp

  Log Message:
  -----------
  [OpenMP] Wait for kernel prior to memory deallocation

Summary:
In the function `target`, memory deallocation and `target_data_end` is called
immediately returning from launching kernel. This might cause a race condition
that the corresponding memory is still being used by the kernel and a potential
issue that when the kernel starts to execute, its required data have already
been deallocated, especially when multiple kernels running concurrently. Since
nevertheless, we will block the thread issuing the target offloading at the end
of the target, we just move the synchronization ahead a little bit to make sure
the correctness.

Reviewers: jdoerfert

Reviewed By: jdoerfert

Subscribers: yaxunl, guansong, sstefan1, openmp-commits

Tags: #openmp

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




More information about the All-commits mailing list