Hi Jakub!

On 2022-06-13T14:06:39+0200, Jakub Jelinek via Gcc-patches 
<gcc-patches@gcc.gnu.org> wrote:
> OpenMP 5.2 changed once more what device numbers are allowed.

> libgomp/

>       * testsuite/libgomp.c-c++-common/target-is-accessible-1.c (main): Add
>       test with omp_initial_device.  Use -5 instead of -1 for negative value
>       test.
>       * testsuite/libgomp.fortran/target-is-accessible-1.f90 (main):
>       Likewise.  Reorder stop numbers.

In an offloading configuration, I'm seeing:

    PASS: libgomp.fortran/get-mapped-ptr-1.f90   -O  (test for excess errors)
    [-PASS:-]{+FAIL:+} libgomp.fortran/get-mapped-ptr-1.f90   -O  execution test

Does that one need similar treatment?

It FAILs in 'STOP 1'; 'libgomp.fortran/get-mapped-ptr-1.f90':

     1 program main
     2   use omp_lib
     3   use iso_c_binding
     4   implicit none (external, type)
     5   integer :: d, id
     6   type(c_ptr) :: p
     7   integer, target :: q
     8
     9   d = omp_get_default_device ()
    10   id = omp_get_initial_device ()
    11
    12   if (d < 0 .or. d >= omp_get_num_devices ()) &
    13     d = id
    14
    15   p = omp_target_alloc (c_sizeof (q), d)
    16   if (.not. c_associated (p)) &
    17     stop 0  ! okay
    18
    19   if (omp_target_associate_ptr (c_loc (q), p, c_sizeof (q), &
    20                                 0_c_size_t, d) == 0) then
    21
    22     if(c_associated (omp_get_mapped_ptr (c_loc (q), -1))) &
    23       stop 1
    [...]


Grüße
 Thomas


> --- libgomp/testsuite/libgomp.c-c++-common/target-is-accessible-1.c.jj        
> 2022-05-23 21:44:48.950848384 +0200
> +++ libgomp/testsuite/libgomp.c-c++-common/target-is-accessible-1.c   
> 2022-06-13 13:10:56.471535852 +0200
> @@ -17,7 +17,10 @@ main ()
>    if (!omp_target_is_accessible (p, sizeof (int), id))
>      __builtin_abort ();
>
> -  if (omp_target_is_accessible (p, sizeof (int), -1))
> +  if (!omp_target_is_accessible (p, sizeof (int), omp_initial_device))
> +    __builtin_abort ();
> +
> +  if (omp_target_is_accessible (p, sizeof (int), -5))
>      __builtin_abort ();
>
>    if (omp_target_is_accessible (p, sizeof (int), n + 1))
> --- libgomp/testsuite/libgomp.fortran/target-is-accessible-1.f90.jj   
> 2022-05-23 21:44:48.954848343 +0200
> +++ libgomp/testsuite/libgomp.fortran/target-is-accessible-1.f90      
> 2022-06-13 13:12:08.133819977 +0200
> @@ -19,12 +19,15 @@ program main
>    if (omp_target_is_accessible (p, c_sizeof (d), id) /= 1) &
>      stop 2
>
> -  if (omp_target_is_accessible (p, c_sizeof (d), -1) /= 0) &
> +  if (omp_target_is_accessible (p, c_sizeof (d), omp_initial_device) /= 1) &
>      stop 3
>
> -  if (omp_target_is_accessible (p, c_sizeof (d), n + 1) /= 0) &
> +  if (omp_target_is_accessible (p, c_sizeof (d), -5) /= 0) &
>      stop 4
>
> +  if (omp_target_is_accessible (p, c_sizeof (d), n + 1) /= 0) &
> +    stop 5
> +
>    ! Currently, a host pointer is accessible if the device supports shared
>    ! memory or omp_target_is_accessible is executed on the host. This
>    ! test case must be adapted when unified shared memory is avialable.
> @@ -35,14 +38,14 @@ program main
>      !$omp end target
>
>      if (omp_target_is_accessible (p, c_sizeof (d), d) /= shared_mem) &
> -      stop 5;
> +      stop 6;
>
>      if (omp_target_is_accessible (c_loc (a), 128 * sizeof (a(1)), d) /= 
> shared_mem) &
> -      stop 6;
> +      stop 7;
>
>      do i = 1, 128
>        if (omp_target_is_accessible (c_loc (a(i)), sizeof (a(i)), d) /= 
> shared_mem) &
> -        stop 7;
> +        stop 8;
>      end do
>
>    end do
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 
München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas 
Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht 
München, HRB 106955

Reply via email to