aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineOperand.cpp
diff options
context:
space:
mode:
authorJoel E. Denny <jdenny.ornl@gmail.com>2021-03-04 11:15:58 -0500
committerJoel E. Denny <jdenny.ornl@gmail.com>2021-03-04 12:03:42 -0500
commit10c18c69f2a8372c6a85e4654e00d11b479119aa (patch)
treef2232173735082667cbb7f4b2ff95e8db7bbc4e5 /llvm/lib/CodeGen/MachineOperand.cpp
parent9830901b341cfb884cdef00e0335c6e3e62d107a (diff)
downloadllvm-10c18c69f2a8372c6a85e4654e00d11b479119aa.zip
llvm-10c18c69f2a8372c6a85e4654e00d11b479119aa.tar.gz
llvm-10c18c69f2a8372c6a85e4654e00d11b479119aa.tar.bz2
[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
Diffstat (limited to 'llvm/lib/CodeGen/MachineOperand.cpp')
0 files changed, 0 insertions, 0 deletions