From patchwork Fri Dec 14 21:16:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 1013714 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-492529-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="En73jv1O"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43GjzD3g2Mz9s3Z for ; Sat, 15 Dec 2018 08:16:40 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=rhSzGFZn78jkY8g6 C8E2DG8QIcDWr7PIuD14afKJq/lTeGsFMChLS+xpNohE2yjv4oW0ZAk/sWL/RrcJ HU6VBPg6sjW8XQufH3cFgOSdmozaogJhcMMHEuur5dEB6xmkL2lrIWEp4ZbpbuNj tjV1KAlMowpd0MuESedJ26eCBqc= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=6FTG9RVUcuKyC66sAP2X7/ 5NoPY=; b=En73jv1OJJ/dYtLj3QAazgADFT1g4OVAbMaAgNiqWYIfqr9BVAZzdG H2kfX5eWPoKC+8YXQcinhORisfawQS+JFdv+h5NTSA9dzYkNKd55DJAYamezBreu 2Plww0HpvfFVJJB19g/EZqboYxnkk783SHeqF52fKWTO8wD+plsv0= Received: (qmail 93671 invoked by alias); 14 Dec 2018 21:16:32 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 93644 invoked by uid 89); 14 Dec 2018 21:16:31 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=UD:openacc.async_wait_all_async_func, UD:async_wait_all_async_func X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 14 Dec 2018 21:16:28 +0000 Received: from svr-orw-mbx-03.mgc.mentorg.com ([147.34.90.203]) by relay1.mentorg.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-SHA384:256) id 1gXuos-0005w3-5i from Thomas_Schwinge@mentor.com for gcc-patches@gcc.gnu.org; Fri, 14 Dec 2018 13:16:26 -0800 Received: from svr-orw-mbx-03.mgc.mentorg.com (147.34.90.203) by svr-orw-mbx-03.mgc.mentorg.com (147.34.90.203) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Fri, 14 Dec 2018 13:16:24 -0800 Received: from tftp-cs (147.34.91.1) by svr-orw-mbx-03.mgc.mentorg.com (147.34.90.203) with Microsoft SMTP Server id 15.0.1320.4 via Frontend Transport; Fri, 14 Dec 2018 13:16:24 -0800 Received: by tftp-cs (Postfix, from userid 49978) id 5EA8CC2321; Fri, 14 Dec 2018 13:16:23 -0800 (PST) From: Thomas Schwinge To: CC: Chung-Lin Tang Subject: [PR88484] OpenACC wait directive without wait argument but with async clause User-Agent: Notmuch/0.9-125-g4686d11 (http://notmuchmail.org) Emacs/25.2.2 (x86_64-pc-linux-gnu) Date: Fri, 14 Dec 2018 22:16:12 +0100 Message-ID: <87k1kbreqr.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 Hi! Committed to trunk in r267151: commit 44b7d2b9c1b1a535212b8312c6dc76dd1570db45 Author: tschwinge Date: Fri Dec 14 20:42:50 2018 +0000 [PR88484] OpenACC wait directive without wait argument but with async clause We don't correctly handle "#pragma acc wait async (a)" for "a >= 0", handling as a no-op whereas it should enqueue the appropriate wait operations on "async (a)". libgomp/ PR libgomp/88484 * oacc-parallel.c (GOACC_wait): Correct handling for "async >= 0". * testsuite/libgomp.oacc-c-c++-common/asyncwait-nop-1.c: New file. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@267151 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgomp/ChangeLog | 4 ++ libgomp/oacc-parallel.c | 4 +- .../libgomp.oacc-c-c++-common/asyncwait-nop-1.c | 78 ++++++++++++++++++++++ 3 files changed, 84 insertions(+), 2 deletions(-) Grüße Thomas diff --git libgomp/ChangeLog libgomp/ChangeLog index c1f98d76e013..2914066f7532 100644 --- libgomp/ChangeLog +++ libgomp/ChangeLog @@ -1,5 +1,9 @@ 2018-12-14 Thomas Schwinge + PR libgomp/88484 + * oacc-parallel.c (GOACC_wait): Correct handling for "async >= 0". + * testsuite/libgomp.oacc-c-c++-common/asyncwait-nop-1.c: New file. + PR libgomp/88407 * plugin/plugin-nvptx.c (nvptx_async_test, nvptx_wait) (nvptx_wait_async): Unseen async-argument is a no-op. diff --git libgomp/oacc-parallel.c libgomp/oacc-parallel.c index 1e08af70b4da..89b6b6f6fc2b 100644 --- libgomp/oacc-parallel.c +++ libgomp/oacc-parallel.c @@ -630,8 +630,8 @@ GOACC_wait (int async, int num_waits, ...) } else if (async == acc_async_sync) acc_wait_all (); - else if (async == acc_async_noval) - goacc_thread ()->dev->openacc.async_wait_all_async_func (acc_async_noval); + else + acc_wait_all_async (async); } int diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/asyncwait-nop-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/asyncwait-nop-1.c new file mode 100644 index 000000000000..e4f627d38bc2 --- /dev/null +++ libgomp/testsuite/libgomp.oacc-c-c++-common/asyncwait-nop-1.c @@ -0,0 +1,78 @@ +/* Several of the async/wait combinations invoked here are no-ops -- they don't + effect anything, but are still valid. + + This doesn't verify that the asynchronous operations synchronize correctly, + but just verifies that we don't refuse any variants. */ + +#undef NDEBUG +#include +#include + +int values[] = { acc_async_sync, + acc_async_noval, + 0, + 1, + 2, + 36, + 1982, }; +const size_t values_n = sizeof values / sizeof values[0]; + +int +main () +{ + /* Explicitly initialize: it's not clear whether the following OpenACC + runtime library calls implicitly initialize; + . */ + acc_device_t d; +#if defined ACC_DEVICE_TYPE_nvidia + d = acc_device_nvidia; +#elif defined ACC_DEVICE_TYPE_host + d = acc_device_host; +#else +# error Not ported to this ACC_DEVICE_TYPE +#endif + acc_init (d); + + + for (size_t i = 0; i < values_n; ++i) + assert (acc_async_test (values[i]) == 1); + + + for (size_t i = 0; i < values_n; ++i) + { +#pragma acc parallel wait (values[i]) + ; +#pragma acc wait (values[i]) + acc_wait (values[i]); + } + + + for (size_t i = 0; i < values_n; ++i) + { + for (size_t j = 0; j < values_n; ++j) + { + if (values[i] == values[j]) + continue; + +#pragma acc parallel wait (values[i]) async (values[j]) + ; +#pragma acc wait (values[i]) async (values[j]) + acc_wait_async (values[i], values[j]); + } + } + + + for (size_t i = 0; i < values_n; ++i) + { +#pragma acc parallel wait async (values[i]) + ; +#pragma acc wait async (values[i]) + acc_wait_all_async (values[i]); + } + + + /* Clean up. */ + acc_wait_all (); + + return 0; +}