[llvm] [Offload][OpenMP] Accept `omp_initial_device` for runtime calls (PR #205290)

Jan André Reuter via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 29 01:35:26 PDT 2026


================
@@ -6,7 +6,7 @@
 
 int main() {
   int d = omp_get_default_device();
-  int id = omp_get_initial_device();
+  int id = omp_initial_device;
----------------
Thyre wrote:

I generally agree that both values should be tested.

At the moment, we're checking `omp_get_initial_device()` already in a bunch of other tests, like [`omp_target_memcpy_async1.c`](https://github.com/llvm/llvm-project/blob/2d2a9815933dfa422c2858786f5ad76d1802c25c/offload/test/api/omp_target_memcpy_async1.c) and [`omp_target_memcpy_rect_async1.c`](https://github.com/llvm/llvm-project/blob/2d2a9815933dfa422c2858786f5ad76d1802c25c/offload/test/api/omp_target_memcpy_rect_async1.c).

Switching a few of these tests from `omp_get_initial_device()` to `omp_initial_device` should make sure that we're testing both cases, without introducing too much duplication.

`omp_target_memset.c` doesn't have a counterpart with `omp_get_initial_device()` at the moment.
That should probably be addressed.

If we want to extend all tests to test both `omp_initial_device` and `omp_get_initial_device()`, I can look into that. To reduce duplication, I'd then suggest to test both values per test file (e.g., `omp_target_memcpy_async2.c`).

https://github.com/llvm/llvm-project/pull/205290


More information about the llvm-commits mailing list