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 1E9EF3858C62 for ; Fri, 8 Dec 2023 13:47:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1E9EF3858C62 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 1E9EF3858C62 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702043270; cv=none; b=H/GxWTJTtwEdBLn9vr6Mp9VBEXHK38EYo8pI+2Psg/qFfo+q3IBKO/YBON7lZNoobfXyvoJ5vo5OXKx/qVAqIcVkUBsAo5ecqmcxhIe3xnIO37bHzuJ0iQUd6/tb3IEfzXFA/H3MV4bLdsa70w/0frJGO2WZkXe6yVV+WsksCGQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702043270; c=relaxed/simple; bh=a+XaPhHZrJUD6F9a2dC2feTUXBRSM6vnMIUDZOQrqfM=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=Tqs8166lvUskAObyIIy4Z0RCYhwy38VwMQoxPirt1h0EBzhBrvh0DmSyro+JbipH0PjNZ0Gx1dDkz0LCV/CR5H6uaYSLM8pdZPnFdsak+vxHqDaP01JJzB5nq0y6IL0uCcNp9i/gEruVblUsSAg0eN6yadWOTPbghr0Cs1noFw4= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1702043268; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references; bh=o8nDfYEfx98RJK04/ZAvSuFHVcls3oQrvTpuAnzG2Tc=; b=cD72DbS3WUHB9gMWAec0T7QuKn7LEbIUizehC+OOsyOOiMHgp5hh/2Y2Csy4c8488rr5GI 2dk8jM365KMXrcTpF9KPQRX37FquCc6o7YfoDqBCwHFhDwFPJg7qohriZQauxo9gHpbxiW /kHLMfSi60sHeQpg2FSAt+zE2cyBV48= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-244-3OjLHuSeO9u0wVIJin1ziQ-1; Fri, 08 Dec 2023 08:47:45 -0500 X-MC-Unique: 3OjLHuSeO9u0wVIJin1ziQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6A7423C29A7E; Fri, 8 Dec 2023 13:47:45 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.195.157]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2DCCD202725B; Fri, 8 Dec 2023 13:47:44 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 3B8DlgfK2912276 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 8 Dec 2023 14:47:42 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 3B8DlfB32912275; Fri, 8 Dec 2023 14:47:41 +0100 Date: Fri, 8 Dec 2023 14:47:41 +0100 From: Jakub Jelinek To: Tobias Burnus Cc: gcc-patches , fortran Subject: Re: [Patch] OpenMP: Support acquires/release in 'omp require atomic_default_mem_order' Message-ID: Reply-To: Jakub Jelinek References: MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-3.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Tue, Nov 28, 2023 at 12:28:05PM +0100, Tobias Burnus wrote: > I stumbled over this omission when looking at Sandra's patch. It turned out that this is > a new OpenMP 5.2 feature - probably added to simplify/unify the syntax. I guess the reason > that release/acquire wasn't added before is that it cannot be universally be used - read/write > do only accept one of them. I thought when this was discussed that it was meant to behave right (choose some more appropriate memory model if one was not allowed), but reading 5.2 I think that is not what ended up in the spec, because [213:11-13] says that atomic_default_mem_order is as if the argument appeared on any atomic directive without explicit mem-order clause and atomic directive has the [314:9-10] restrictions. I'd bring this to omp-lang whether it was really meant that #pragma omp requires atomic_default_mem_order (release) int foo (int *p) { int t; #pragma omp atomic read t = *p; return t; } and #pragma omp requires atomic_default_mem_order (acquire) void bar (int *p) { #pragma omp atomic write *p = 0; } are meant to be invalid. Another comment, atomic_default_mem_order arguments aren't handled just in the requires parsing, but also in context selectors. So, the additions would need to be reflected in omp_check_context_selector and omp_context_selector_matches as well. Jakub