Hi Thomas,

Thomas Schwinge wrote:
The new test case 'libgomp.c-c++-common/target-link-2.c' generally PASSes
on one-GPU systems, but on a multi-GPU system (tested nvidia5):

After having debugged it, it became glaringly obvious, but could otherwise be missed …

The testcase checks that mapping an array – and then remapping a different stride works, but to see that it was really remapped, it changed the host value before.

The issue was that it has to be changed back to the original value for the next device as the value checks expect always the same value.

Committed as r15-2796-gaa689684d2bf58.

Thanks for the report!

Tobias

PS:

I first thought that maybe just:

     +      #pragma omp target exit data map(release:arr[3:10]) device(dev)
I was (and still am) torn between adding it (cleaner) or keeping it, as both have some merits for testing - and haven't cleaned up after the remapping. In any case, either testcase is fine (and should work).
commit aa689684d2bf58d1b7e7938a1392e7a260276d14
Author: Tobias Burnus <tbur...@baylibre.com>
Date:   Wed Aug 7 17:59:21 2024 +0200

    libgomp.c-c++-common/target-link-2.c: Fix test on multi-device systems
    
    libgomp/ChangeLog:
    
            * testsuite/libgomp.c-c++-common/target-link-2.c: Reset variable
            value to handle multi-device tests.
---
 libgomp/testsuite/libgomp.c-c++-common/target-link-2.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libgomp/testsuite/libgomp.c-c++-common/target-link-2.c b/libgomp/testsuite/libgomp.c-c++-common/target-link-2.c
index 15da1656ebf..b64fbde70e3 100644
--- a/libgomp/testsuite/libgomp.c-c++-common/target-link-2.c
+++ b/libgomp/testsuite/libgomp.c-c++-common/target-link-2.c
@@ -54,6 +54,9 @@ int main()
       for (int i = 0; i < 10; i++)
 	if (res[i] != (4 + i)*10)
 	  __builtin_abort ();
+
+      for (int i = 0; i < 15; i++) /* Reset. */
+	arr[i] /= 10;
     }
   return 0;
 }

Reply via email to