[all-commits] [llvm/llvm-project] 32ed29: [OpenMP] Optimized stream selection by scheduling ...

Shilei Tian via All-commits all-commits at lists.llvm.org
Tue Apr 7 11:55:51 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 32ed29271fd8c56abee8616e5a16a3c9e58f4741
      https://github.com/llvm/llvm-project/commit/32ed29271fd8c56abee8616e5a16a3c9e58f4741
  Author: Shilei Tian <tianshilei1992 at gmail.com>
  Date:   2020-04-07 (Tue, 07 Apr 2020)

  Changed paths:
    M openmp/libomptarget/include/omptarget.h
    M openmp/libomptarget/include/omptargetplugin.h
    M openmp/libomptarget/plugins/cuda/src/rtl.cpp
    M openmp/libomptarget/plugins/exports
    M openmp/libomptarget/plugins/generic-elf-64bit/src/rtl.cpp
    M openmp/libomptarget/src/api.cpp
    M openmp/libomptarget/src/device.cpp
    M openmp/libomptarget/src/device.h
    M openmp/libomptarget/src/omptarget.cpp
    M openmp/libomptarget/src/private.h
    M openmp/libomptarget/src/rtl.cpp
    M openmp/libomptarget/src/rtl.h

  Log Message:
  -----------
  [OpenMP] Optimized stream selection by scheduling data mapping for the same target region into a same stream

Summary:
This patch introduces two things for offloading:
1. Asynchronous data transferring: those functions are suffix with `_async`. They have one more argument compared with their synchronous counterparts: `__tgt_async_info*`, which is a new struct that only has one field, `void *Identifier`. This struct is for information exchange between different asynchronous operations. It can be used for stream selection, like in this case, or operation synchronization, which is also used. We may expect more usages in the future.
2. Optimization of stream selection for data mapping. Previous implementation was using asynchronous device memory transfer but synchronizing after each memory transfer. Actually, if we say kernel A needs four memory copy to device and two memory copy back to host, then we can schedule these seven operations (four H2D, two D2H, and one kernel launch) into a same stream and just need synchronization after memory copy from device to host. In this way, we can save a huge overhead compared with synchronization after each operation.

Reviewers: jdoerfert, ye-luo

Reviewed By: jdoerfert

Subscribers: yaxunl, lildmh, guansong, openmp-commits

Tags: #openmp

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




More information about the All-commits mailing list