[all-commits] [llvm/llvm-project] 10c18c: [OpenMP] Fix support for device as host
Joel E. Denny via All-commits
all-commits at lists.llvm.org
Thu Mar 4 09:13:09 PST 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 10c18c69f2a8372c6a85e4654e00d11b479119aa
https://github.com/llvm/llvm-project/commit/10c18c69f2a8372c6a85e4654e00d11b479119aa
Author: Joel E. Denny <jdenny.ornl at gmail.com>
Date: 2021-03-04 (Thu, 04 Mar 2021)
Changed paths:
M openmp/libomptarget/src/interface.cpp
A openmp/libomptarget/test/offloading/host_as_target.c
A openmp/libomptarget/test/offloading/mandatory_but_no_devices.c
Log Message:
-----------
[OpenMP] Fix support for device as host
Without this patch, when the offload device is set to
`omp_get_initial_device()`, the runtime fails with an error diagnostic
when entering target regions or target data regions.
However, OpenMP 5.1, sec. 2.14.5 "target Construct", "Restrictions",
p. 203, L3-5 states:
> The device clause expression must evaluate to a non-negative integer
> value that is less than or equal to the value of
> omp_get_num_devices().
Sec. 3.7.7 "omp_get_initial_device", p. 412, L2-3 states:
> The value of the device number is the value returned by the
> omp_get_num_devices routine.
Similarly, OpenMP 5.0, sec. 2.12.5 "target Construct", "Restrictions",
p. 174 L30-32 states:
> The device clause expression must evaluate to a non-negative integer
> value less than the value of omp_get_num_devices() or to the value
> of omp_get_initial_device().
This patch fixes this behavior by changing the runtime to behave as if
offloading is disabled whenever it finds the offload device (either
from a `device` clause or the default device) is set to the host
device. In the case of mandatory offloading when
`omp_get_num_devices() == 0`, it incorporates the behavior proposed
for OpenMP 5.2 in OpenMP spec github issue 2669.
Reviewed By: grokos, RaviNarayanaswamy
Differential Revision: https://reviews.llvm.org/D97616
Commit: bfe5452b93a7d859f612bf7e8b46aa626c8c8e83
https://github.com/llvm/llvm-project/commit/bfe5452b93a7d859f612bf7e8b46aa626c8c8e83
Author: Joel E. Denny <jdenny.ornl at gmail.com>
Date: 2021-03-04 (Thu, 04 Mar 2021)
Changed paths:
M openmp/libomptarget/src/interface.cpp
A openmp/libomptarget/test/offloading/lone_target_exit_data.c
Log Message:
-----------
[OpenMP] Fix lone target exit data
Without this patch, an `omp target exit data` before the runtime is
initialized produces a runtime error. This patch fixes that by
changing `__tgt_target_data_end_mapper` to call `CheckDeviceAndCtors`
like many other runtime routines.
Discussed at
<https://lists.llvm.org/pipermail/openmp-dev/2021-March/003920.html>.
Reviewed By: grokos
Differential Revision: https://reviews.llvm.org/D97907
Commit: d0eb25a64345186c50c26d46d902b30e8719fd79
https://github.com/llvm/llvm-project/commit/d0eb25a64345186c50c26d46d902b30e8719fd79
Author: Joel E. Denny <jdenny.ornl at gmail.com>
Date: 2021-03-04 (Thu, 04 Mar 2021)
Changed paths:
M openmp/libomptarget/src/interface.cpp
M openmp/libomptarget/src/omptarget.cpp
M openmp/libomptarget/src/private.h
Log Message:
-----------
[OpenMP] Encapsulate more in checkDeviceAndCtors
This patch just encapsulates some repeated code. To do so, it
relocates some functions from interface.cpp to omptarget.cpp. It also
adjusts them to the LLVM coding style.
This patch is almost NFC except some `DP` messages are a bit
different. For example, messages like "Entering target region" are
now emitted even if offload is disabled, but a subsequent "Offload is
disabled" is then emitted.
Reviewed By: jdoerfert, grokos
Differential Revision: https://reviews.llvm.org/D97908
Compare: https://github.com/llvm/llvm-project/compare/9830901b341c...d0eb25a64345
More information about the All-commits
mailing list