From patchwork Sun Oct 15 10:42:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 152996 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp2867060vqb; Sun, 15 Oct 2023 03:43:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH93aDtfD8EWjn0sbo/D0IbQ4AIczqPCY6ovyB+617mB+Gi2NebjEs6YUUBsUvxPrFfwYpA X-Received: by 2002:a05:622a:2d4:b0:417:9962:4de9 with SMTP id a20-20020a05622a02d400b0041799624de9mr35908530qtx.1.1697366581266; Sun, 15 Oct 2023 03:43:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697366581; cv=pass; d=google.com; s=arc-20160816; b=Nw2FtzM0MwQMiEG8SWbxqnlMdVlfDcmeoK6mBNmJD2C4myas+BocYvxN6JhCZyZPes b02aO754sU5iRAC5HjJUYWCdDYLl0xLlllq4sXdLEXGq9QOSIvuxsmMLGlk+If1En4pF jUxAzw/69kuIT/aVZCOMtm1AAuKws6LmEhWKCYrmp6AExlX6d5wUWgOPhK4EsIxXXqLW lAfLYHkUWcTK/aQ91IJ37yDTvFKofyXQoSpHupTRBaTMfb/QNYgY/T8KQPygn/a9/wWj GK/kvvU/q1Tu2xUlbsx/uUaDAbyXXhP0/rpVuWbSCDG3ai3i4qQN/0sox6pV6Xiitkkv rPug== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :ironport-sdr:dmarc-filter:arc-filter:delivered-to; bh=+BqO3NLG8XCDo+N+TyjDyeIdHLMmDhtiZk/psceAAso=; fh=pid/OIeXqGt6tdY4kjdzxDeBaPN9LdG9OdUFQkdB2M4=; b=SOT6TzXduy698BhNRKRC4cF5xV/W9xEvWqGNFE9Q0osanu3pIXEly8/LIu59DT9v6S FlMn0MXo1Ayedodgur/Zr3jJ7fogHVtWLzlxF4d0Ve/jRulLsXkckDqm20iwjJGIt9L/ nk3vzFaXGPH0EBVEXG+V3hE3eFGmtZ3QGhnlxkb/CcQcGsxFZVzjzweKUsMv2dKwfDwO pxbLvfgN9rgooCRnf3SNLvA7EIW2r6IMohUJYGi5enEayE5Cupytl+MvdKmWUW6o8pM4 pu1W72IQQ0qlQhGCPORcYm9CJi1lcyvPNjZDHC3RUJfRLMZkd/QMSPHAZlw/9t5DXtba TnDw== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id p4-20020a05622a00c400b00419579dd7a8si3670569qtw.308.2023.10.15.03.43.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Oct 2023 03:43:01 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0D72D3858031 for ; Sun, 15 Oct 2023 10:43:01 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa2.mentor.iphmx.com (esa2.mentor.iphmx.com [68.232.141.98]) by sourceware.org (Postfix) with ESMTPS id CBCFD3858D33 for ; Sun, 15 Oct 2023 10:42:36 +0000 (GMT) ARC-Filter: OpenARC Filter v1.0.0 sourceware.org CBCFD3858D33 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=68.232.141.98 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1697366559; cv=none; b=VtHCqSaE9iTapBtQm8qoSH6FQggRTE3KvjiPu7pPmomgZVFCILCccRo8frNCGpxK+fOfS5LdG1Rc6R2kNqy+c1Is5Wwf4WutbyeZvlYy4D7N77Ds2QOSHJoQQtxmGhsjcuLxXafVYMJRHH9WuOKlW032wZ6xhNf1In87b0IiB0M= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1697366559; c=relaxed/simple; bh=Pt1zXRPXyKduGpjzBpMHwEZq3dDPDccGk0gY7pd1tUc=; h=Message-ID:Date:MIME-Version:Subject:To:From; b=xYorkTHVEperPD1CC4Idl61hod170mhqgrBBttXRZwPyMunZOyCqyC3uXQWAEo4jq9LSUnUErZXOxiWGQw0PUfK9NAmvZDAW9OfMnecFAQC98RvtocYswf3h0bZZfTuit+P4UzrfNFL/dQP/GtsdkmJmKegIhjdHnpHUyHSwXpA= ARC-Authentication-Results: i=1; server2.sourceware.org DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CBCFD3858D33 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com X-CSE-ConnectionGUID: aMQf4tF6Rpm0nQ9bvsN13w== X-CSE-MsgGUID: ExfyGH97RtaTMy5OBx4WXg== X-IronPort-AV: E=Sophos;i="6.03,226,1694764800"; d="diff'?scan'208";a="21910258" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa2.mentor.iphmx.com with ESMTP; 15 Oct 2023 02:42:35 -0800 IronPort-SDR: Pf0NO9PKAddHHAN74dEh/yYFYLyAU3h8hjxJoOXQpdXY1wXOZ8hDXZz0r7XERnbJstqObQSW6v 3Dc5kyDnitRXEetslRowb0TBY0rVntSqsA1wmrypauy7CYKm5WSWK1IfXEq8frpItNi6A5rG0j TAZfhTAbmO8arrEbXcAarV7KtYUOwkm4PkfK4jNZNa9jzkuqe/DJy6QOtmwGM/924kPJAHfM0f 43ua1gu58keSiGtqBnZK9+BMTSXtcjF8Ig6bw5ET+/z3LsQJkRy2iJlVXEty7h9GFWFgPGYCpS NBs= Message-ID: <7ad5aa88-5e52-490c-b414-f5d1430e5f18@codesourcery.com> Date: Sun, 15 Oct 2023 12:42:31 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [patch] libgomp.texi: Update "Enabling OpenMP" + OpenACC / invoke.texi: -fopenacc/-fopenmp update (was: Re: [patch] libgomp.texi: Update "Enabling OpenMP") Content-Language: en-US To: Sandra Loosemore , gcc-patches , Sandra Loosemore , Jakub Jelinek References: <507d6d48-1ca1-411a-a95d-45adb7a8f446@codesourcery.com> <6080749f-12c5-5e0a-aa59-fd084c00bea4@siemens.com> From: Tobias Burnus In-Reply-To: <6080749f-12c5-5e0a-aa59-fd084c00bea4@siemens.com> X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-14.mgc.mentorg.com (139.181.222.14) To svr-ies-mbx-12.mgc.mentorg.com (139.181.222.12) X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_SHORT, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779817860676928130 X-GMAIL-MSGID: 1779817860676928130 Hi Sandra and Jakub, I have now updated the patch; on the way, I found an issue in -fopenacc ('!$' is not OpenACC and no longer supported) and the same @code/@samp. I also updated invoke.texi for the same @code/@samp - and added both '!$' and mentioned the 'c$'/'*$' Fortran fixed-form variant. I think the most important bit is that '!$' is also supported by -fopenmp-simd as that's not covered by the OpenMP specification. Otherwise: On 14.10.23 23:46, Sandra Loosemore wrote: > On 10/14/23 13:43, Tobias Burnus wrote: >> The attached patch tries to improve this. Note that it talks about C and >> C++ attributes, even though C23's [[omp::]] support has not yet landed. >> (But is expected very soon.) > > Is somebody actively working on implementing that, and expecting to > get it in before Stage 1 closes? I don't think we should document > features that don't exist yet. Yes. But I have now sneaked in an 'in C++' which can also be easily removed once Jakub's patch is committed or as part of Jakub's patch. > This syntax for C also isn't even in the draft OpenMP 6.0 document so > at this point Well, it is in the git version, which will be released as TR12 in about a month (in time for SC23). It is very unlikely to get removed before OpenMP 6.0 as it is an obvious extension to C++11's attribute support, now that C supports attributes as well. > Other than that... > Use @option markup on options, not @command. Fixed. Was preexisting and I copied it once. I've now checked, the only other use in libgomp.texi was for an actual command (nvprof). > And I think all those @code markups should be @samp instead, or you > could just replace this whole blurb with something like "This flag > enables recognition of the directive syntax documented in the OpenMP > specification, and also arranges for automatic linking..." I think it is more user friendly to document the sentinels. However, I concur that @samp is better. > +OpenMP directives, which do not require the linking of neither the > > s/, which/ that/ I have now used it, but I think it sound odd: "enables *a* subset of OpenMP directives *that* do not require the linking" I concur that with "*the* subset ... *that*" makes sense but I want to avoid stating that *all* directives that do not require linking of libgomp/libpthread are supported. invoke.texi lists all supported directives, but I am not really fond of repeating that list. > s/neither/either/ The fun of whether double negation cancels or enforces the negation or .. ("not .. neither / nor"). Cf. https://en.wikipedia.org/wiki/Double_negative In German and English, both cancellation and enforcement seem to be possible, the latter especially with dialects - while the standard language tends to avoid double negation. Updated patch attached. Thanks, 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 libgomp.texi: Update "Enabling OpenMP" + OpenACC / invoke.texi: -fopenacc/-fopenmp update The OpenACC specification does not mention the '!$ ' sentinel for conditional compilation and the feature was removed in r11-5572-g1d6f6ac693a860 for PR fortran/98011. libgomp/ * libgomp.texi (Enabling OpenMP): Update for C/C++ attributes; improve wording especially for Fortran; mention -fopenmp-simd. (Enabling OpenACC): Minor cleanup; remove conditional compilation sentinel. gcc/ * doc/invoke.texi (-fopenacc, -fopenmp, -fopenmp-simd): Use @samp not @code; document more completely the supported Fortran sentinels. gcc/fortran * scanner.cc (skip_free_comments, skip_fixed_comments): Remove leftover 'OpenACC' from comments about OpenMP's conditional compilation sentinel. diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index fee659462ff..eb714d18511 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -2748,9 +2748,10 @@ Typical command lines are @opindex fopenacc @cindex OpenACC accelerator programming @item -fopenacc -Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and -@code{!$acc} in Fortran. When @option{-fopenacc} is specified, the -compiler generates accelerated code according to the OpenACC Application +Enable handling of OpenACC directives @samp{#pragma acc} in C/C++ and +@samp{!$acc} in free-form Fortran and @samp{!$acc}, @samp{c$acc} and +@samp{*$acc} in fixed-form Fortran. When @option{-fopenacc} is specified, +the compiler generates accelerated code according to the OpenACC Application Programming Interface v2.6 @w{@uref{https://www.openacc.org}}. This option implies @option{-pthread}, and thus is only supported on targets that have support for @option{-pthread}. @@ -2766,10 +2767,12 @@ can be omitted, to use a target-specific default value. @opindex fopenmp @cindex OpenMP parallel @item -fopenmp -Enable handling of OpenMP directives @code{#pragma omp} in C/C++, -@code{[[omp::directive(...)]]}, @code{[[omp::sequence(...)]]} and -@code{[[omp::decl(...)]]} in C++ and @code{!$omp} in Fortran. -When @option{-fopenmp} is specified, the +Enable handling of OpenMP directives @samp{#pragma omp} in C/C++, +@samp{[[omp::directive(...)]]}, @samp{[[omp::sequence(...)]]} and +@samp{[[omp::decl(...)]]} in C++ and @samp{!$omp} in Fortran. It +additionally enables the conditional compilation sentinel @samp{!$} in +Fortran. In fixed source form Fortran, the sentinels can also start with +@samp{c} or @samp{*}. When @option{-fopenmp} is specified, the compiler generates parallel code according to the OpenMP Application Program Interface v4.5 @w{@uref{https://www.openmp.org}}. This option implies @option{-pthread}, and thus is only supported on targets that @@ -2785,10 +2788,12 @@ Enable handling of OpenMP's @code{simd}, @code{declare simd}, and @code{loop} directive, and of combined or composite directives with @code{simd} as constituent with @code{#pragma omp} in C/C++, @code{[[omp::directive(...)]]}, @code{[[omp::sequence(...)]]} and -@code{[[omp::decl(...)]]} in C++ and @code{!$omp} in Fortran. -Other OpenMP directives are ignored. Unless @option{-fopenmp} is -additionally specified, the @code{loop} region binds to the current -task region, independent of the specified @code{bind} clause. +@code{[[omp::decl(...)]]} in C++ and @code{!$omp} in Fortran. It +additionally enables the conditional compilation sentinel @samp{!$} in +Fortran. In fixed source form Fortran, the sentinels can also start with +@samp{c} or @samp{*}. Other OpenMP directives are ignored. Unless +@option{-fopenmp} is additionally specified, the @code{loop} region binds +to the current task region, independent of the specified @code{bind} clause. @opindex fopenmp-target-simd-clone @cindex OpenMP target SIMD clone diff --git a/gcc/fortran/scanner.cc b/gcc/fortran/scanner.cc index 9f0d9a7dc5e..e2a25a1d465 100644 --- a/gcc/fortran/scanner.cc +++ b/gcc/fortran/scanner.cc @@ -877,7 +877,7 @@ skip_free_comments (void) /* If -fopenmp/-fopenacc, we need to handle here 2 things: 1) don't treat !$omp/!$acc as comments, but directives - 2) handle OpenMP/OpenACC conditional compilation, where + 2) handle OpenMP conditional compilation, where !$ should be treated as 2 spaces (for initial lines only if followed by space). */ if (at_bol) @@ -1106,7 +1106,7 @@ skip_fixed_comments (void) /* If -fopenmp/-fopenacc, we need to handle here 2 things: 1) don't treat !$omp/!$acc|c$omp/c$acc|*$omp / *$acc as comments, but directives - 2) handle OpenMP/OpenACC conditional compilation, where + 2) handle OpenMP conditional compilation, where !$|c$|*$ should be treated as 2 spaces if the characters in columns 3 to 6 are valid fixed form label columns characters. */ diff --git a/libgomp/libgomp.texi b/libgomp/libgomp.texi index 526d1be2955..e83010d378b 100644 --- a/libgomp/libgomp.texi +++ b/libgomp/libgomp.texi @@ -136,15 +136,22 @@ changed to GNU Offloading and Multi Processing Runtime Library. @node Enabling OpenMP @chapter Enabling OpenMP -To activate the OpenMP extensions for C/C++ and Fortran, the compile-time -flag @command{-fopenmp} must be specified. This enables the OpenMP directive -@code{#pragma omp} in C/C++ and @code{!$omp} directives in free form, -@code{c$omp}, @code{*$omp} and @code{!$omp} directives in fixed form, -@code{!$} conditional compilation sentinels in free form and @code{c$}, -@code{*$} and @code{!$} sentinels in fixed form, for Fortran. The flag also -arranges for automatic linking of the OpenMP runtime library +To activate the OpenMP extensions for C/C++ and Fortran, the compile-time +flag @option{-fopenmp} must be specified. For C and C++, this enables +the handling of the OpenMP directives using @code{#pragma omp} and, for C++, the +@code{[[omp::directive(...)]]}, @code{[[omp::sequence(...)]]} and +@code{[[omp::decl(...)]]} attributes. For Fortran, it enables for +free source form the @code{!$omp} sentinel for directives and the +@code{!$} conditional compilation sentinel and for fixed source form the +@code{c$omp}, @code{*$omp} and @code{!$omp} sentinels for directives and +the @code{c$}, @code{*$} and @code{!$} conditional compilation sentinels. +The flag also arranges for automatic linking of the OpenMP runtime library (@ref{Runtime Library Routines}). +The @option{-fopenmp-simd} flag can be used to enable a subset of +OpenMP directives that do not require the linking of either the +OpenMP runtime library or the POSIX threads library. + A complete description of all OpenMP directives may be found in the @uref{https://www.openmp.org, OpenMP Application Program Interface} manuals. See also @ref{OpenMP Implementation Status}. @@ -3697,12 +3704,10 @@ pools available and their worker threads run at priority four. To activate the OpenACC extensions for C/C++ and Fortran, the compile-time flag @option{-fopenacc} must be specified. This enables the OpenACC directive -@code{#pragma acc} in C/C++ and @code{!$acc} directives in free form, -@code{c$acc}, @code{*$acc} and @code{!$acc} directives in fixed form, -@code{!$} conditional compilation sentinels in free form and @code{c$}, -@code{*$} and @code{!$} sentinels in fixed form, for Fortran. The flag also -arranges for automatic linking of the OpenACC runtime library -(@ref{OpenACC Runtime Library Routines}). +@samp{#pragma acc} in C/C++ and, in Fortran, the @samp{!$acc} sentinel in free +source form and the @samp{c$acc}, @samp{*$acc} and @samp{!$acc} sentinels in +fixed source form. The flag also arranges for automatic linking of the OpenACC +runtime library (@ref{OpenACC Runtime Library Routines}). See @uref{https://gcc.gnu.org/wiki/OpenACC} for more information.