public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Thomas Schwinge <thomas@codesourcery.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: <gcc-patches@gcc.gnu.org>,
	Tobias Burnus <tobias@codesourcery.com>,
	Marcel Vollweiler <marcel@codesourcery.com>
Subject: Re: [committed] openmp: Conforming device numbers and omp_{initial, invalid}_device
Date: Tue, 14 Jun 2022 18:41:37 +0200	[thread overview]
Message-ID: <87r13ri4e6.fsf@dem-tschwing-1.ger.mentorg.com> (raw)
In-Reply-To: <YqcoT+DzsyuZE0/p@tucnak>

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	other threads:[~2022-06-14 16:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-13 12:06 [committed] openmp: Conforming device numbers and omp_{initial,invalid}_device Jakub Jelinek
2022-06-14 16:41 ` Thomas Schwinge [this message]
2022-06-15  8:46   ` Jakub Jelinek
2022-06-15 20:58     ` Thomas Schwinge

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r13ri4e6.fsf@dem-tschwing-1.ger.mentorg.com \
    --to=thomas@codesourcery.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=marcel@codesourcery.com \
    --cc=tobias@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).