From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 4FAC33858408 for ; Mon, 21 Feb 2022 17:47:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4FAC33858408 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-384-bDPb-kDKMBK6TEkwV1ASyw-1; Mon, 21 Feb 2022 12:47:52 -0500 X-MC-Unique: bDPb-kDKMBK6TEkwV1ASyw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C6ECE1091DA1; Mon, 21 Feb 2022 17:47:51 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.125]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 421EB7E91B; Mon, 21 Feb 2022 17:47:51 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.16.1/8.16.1) with ESMTPS id 21LHlmdO2866442 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 21 Feb 2022 18:47:48 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.16.1/8.16.1/Submit) id 21LHllTk2866441; Mon, 21 Feb 2022 18:47:47 +0100 Date: Mon, 21 Feb 2022 18:47:47 +0100 From: Jakub Jelinek To: Tobias Burnus Cc: Hafiz Abid Qadeer , gcc-patches@gcc.gnu.org, fortran@gcc.gnu.org Subject: Re: [PATCH] [gfortran] Set omp_requires_mask for dynamic_allocators. Message-ID: Reply-To: Jakub Jelinek References: <20220221142440.3987700-1-abidh@codesourcery.com> MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: fortran@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Fortran mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Feb 2022 17:47:57 -0000 On Mon, Feb 21, 2022 at 06:02:06PM +0100, Tobias Burnus wrote: > I wonder whether there is a real problem in terms of the ME, but maybe > there is. > > For atomic_default_mem_order: That's purely handle by the FEs by > setting the default – and just using it when parsing the 'atomic' > directive, if there is no explicit mem_order. Well, for !$omp requires atomic_default_mem_order(whatever) vs. !$omp atomic that is handled purely in the FE and I hope we do it right. Where ME is involved is !$omp requires atomic_default_mem_order(whatever) vs. !$omp declare variant ...atomic_default_mem_order(whatever). That is handled in omp-generic.cc and right now that is done during gimplification of a function. My reading of what gfc_parse_file does is that if I have: subroutine foo !$omp requires atomic_default_mem_order(relaxed) end subroutine foo subroutine bar !$omp requires atomic_default_mem_order(acq_rel) end subroutine bar subroutine baz interface subroutine foo end subroutine end interface 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 then it will call foo because omp_requires in one function is OMP_MEMORY_ORDER_RELAXED aka 1 and in another one OMP_MEMORY_ORDER_ACQ_REL aka 4, and (1 | 4) == OMP_MEMORY_ORDER_SEQ_CST whenb no !$omp requires is in the baz program unit visible and so it should just call bar. And similarly with dynamic_allocators, if I have: subroutine qux !$omp requires dynamic_allocators end subroutine qux subroutine corge interface subroutine garply end subroutine !$omp declare variant (quux) & !$omp & match (implementation={dynamic_allocators}) end interface call garply end subroutine corge I think with the posted patch it would call quux which it should not. Jakub