[Openmp-commits] [openmp] [openmp][flang][offloading] Do not use fixed device IDs in checks (PR #78973)

Kareem Ergawy via Openmp-commits openmp-commits at lists.llvm.org
Mon Jan 22 06:01:45 PST 2024


https://github.com/ergawy created https://github.com/llvm/llvm-project/pull/78973

Fixes a small issues in an offloading test where the test dependec on the host and device being assigned certains numeric IDs. This however is not stable and fails in situations where any of the devices is assigned an ID different from the expected value. The fix just checks that offloading succeeded by making sure the IDs are different.

The test was failing locally for me.

>From 3e0a78903b253ad9e787c761adc720e1d891028b Mon Sep 17 00:00:00 2001
From: ergawy <kareem.ergawy at amd.com>
Date: Mon, 22 Jan 2024 07:58:15 -0600
Subject: [PATCH] [openmp][flang][offloading] Do not use fixed device IDs in
 checks

Fixes a small issues in an offloading test where the test dependec on
the host and device being assigned certains numeric IDs. This however is
not stable and fails in situations where any of the devices is assigned
an ID different from the expected value. The fix just checks that
offloading succeeded by making sure the IDs are different.

The test was failing locally for me.
---
 .../test/offloading/fortran/target_map_common_block1.f90      | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/openmp/libomptarget/test/offloading/fortran/target_map_common_block1.f90 b/openmp/libomptarget/test/offloading/fortran/target_map_common_block1.f90
index 35bbe511d9314d8..6aaa66d6449b6d7 100644
--- a/openmp/libomptarget/test/offloading/fortran/target_map_common_block1.f90
+++ b/openmp/libomptarget/test/offloading/fortran/target_map_common_block1.f90
@@ -20,9 +20,9 @@ program main
     devices(2) = omp_get_device_num()
   !$omp end target
   print *, "var1 after target = ", var1
-  print *, "devices: ", devices
+  print *, "devices are different? ", (devices(1) /= devices(2))
 end program
 
 ! CHECK: var1 before target =  10
 ! CHECK: var1 after target =  20
-! CHECK: devices:  1 0
+! CHECK: devices are different? T



More information about the Openmp-commits mailing list