[Offload][OpenMP] Accept `omp_initial_device` for runtime calls (#205290) In OpenMP v5.2, the constant `omp_initial_device` was introduced, which was defined as a value of `-1`. Support for this value was added to Clang and Flang in 09cd2944821fa43d97d8259194b9a0c4fa22de16 and 3c14034c55a296306ad0ea4990f0f1b34e9e5d6e. However, runtime calls are not aware of this constant. As such, execution of a runtime function, passing `omp_initial_device` as the `device_num`, would abort with e.g.,: ``` omptarget fatal error -1: "invalid value" device number '-1' out of range, only 1 devices available ``` To fix this issue, also extend the host device checks in the API functions to also check for `omp_initial_device`. For testing, extend API tests using `omp_get_initial_device()` to also test `omp_initial_device` and extend `omp_device_uid.c` to check if the UID for `omp_initial_device` and `omp_get_initial_device()` matches. Partially addresses https://github.com/llvm/llvm-project/issues/192980 (see https://github.com/llvm/llvm-project/issues/192980#issuecomment-4404241994) --------- Signed-off-by: Jan André Reuter <j.reuter@fz-juelich.de> Signed-off-by: Jan André Reuter <jan@zyten.de>
Welcome to the LLVM project!
This repository contains the source code for LLVM, a toolkit for the construction of highly optimized compilers, optimizers, and run-time environments.
The LLVM project has multiple components. The core of the project is itself called “LLVM”. This contains all of the tools, libraries, and header files needed to process intermediate representations and convert them into object files. Tools include an assembler, disassembler, bitcode analyzer, and bitcode optimizer.
C-like languages use the Clang frontend. This component compiles C, C++, Objective-C, and Objective-C++ code into LLVM bitcode -- and from there into object files, using LLVM.
Other components include: the libc++ C++ standard library, the LLD linker, and more.
Consult the Getting Started with LLVM page for information on building and running LLVM.
For information on how to contribute to the LLVM project, please take a look at the Contributing to LLVM guide.
Join the LLVM Discourse forums, Discord chat, LLVM Office Hours or Regular sync-ups.
The LLVM project has adopted a code of conduct for participants to all modes of communication within the project.