public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tobias Burnus <tobias@codesourcery.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Hafiz Abid Qadeer <abidh@codesourcery.com>,
	<gcc-patches@gcc.gnu.org>, <fortran@gcc.gnu.org>
Subject: Re: [PATCH] [gfortran] Set omp_requires_mask for dynamic_allocators.
Date: Mon, 21 Feb 2022 19:47:22 +0100	[thread overview]
Message-ID: <a7dc28fe-9bc9-9cff-1077-7116c6a09eb3@codesourcery.com> (raw)
In-Reply-To: <YhPQQ1XtgsB3bjND@tucnak>

Hi Jakub,

On 21.02.22 18:47, Jakub Jelinek wrote:
> Where ME is involved is
> !$omp requires atomic_default_mem_order(whatever) vs.
> !$omp declare variant ...atomic_default_mem_order(whatever).

Ups, missed that case. (Also because there wasn't 'declare variant' when
implementing 'requires' in Fortran.)

Disclaimer to all of the following remarks: I do not understand context
selectors and their fineprint. Thus, my comments my be completely off:

> subroutine baz
> ...
>    interface
>      subroutine bar
>      end subroutine
>      !$omp declare variant (foo) &
>      !$omp & match (implementation={atomic_default_mem_order(seq_cst)})
>    end interface
>    call bar
> end subroutine baz

I concur that in this case, it needs to know the 'atomic_default_mem_order'
of baz. — But that seems to be not implementable using a module as

module m_foo
   !$omp requires atomic_default_mem_order(...)
contains
   subroutine foo
     ...
   end
end module m_bar
...
subroutine baz
   use m_foo, only: foo
   ...
end

seems to make the 'requires' available - such that it cannot be overridden
via a local 'require atomic_default_mem_order'. And having a 'use m_bar'
then has conflicting declarations. Similar probably with C++ modules,
unless the 'requires' does not propagate. (Does it?)

I find it odd to have only code which works when not using modules.
(Explicitly using the mem_order on 'omp atomic' still works.)


And for the other requires in context selectors, I do not really understand how they
are supposed to get used, either. If any 'unified_shared_memory' or 'dynamic_allocators'
appears (in linked-in code), it is in principle callable – the the run-time library
should then remove all devices which do not support it, possibly only keeping the
host device; for USM, it even has to be present in all compilation units. Thus, just
directly calling the dynamic_allocators/unified_shared_memory should have the same
effect at the end, shouldn't it?

Tobias

-----------------
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-02-21 18:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-21 14:24 Hafiz Abid Qadeer
2022-02-21 15:50 ` Jakub Jelinek
2022-02-21 17:02   ` Tobias Burnus
2022-02-21 17:47     ` Jakub Jelinek
2022-02-21 18:47       ` Tobias Burnus [this message]

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=a7dc28fe-9bc9-9cff-1077-7116c6a09eb3@codesourcery.com \
    --to=tobias@codesourcery.com \
    --cc=abidh@codesourcery.com \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.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).