From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa3.mentor.iphmx.com (esa3.mentor.iphmx.com [68.232.137.180]) by sourceware.org (Postfix) with ESMTPS id C0E713858010 for ; Tue, 29 Jun 2021 23:42:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C0E713858010 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com IronPort-SDR: 3yWdBg/0qd1/3lO4zoMVNmLT/KHkq1F4u2lFdqgeeYyeyvoklCSbpLodbCmfoQ2SwFQ7ZAiVn8 9tjSHMId2TWXNew59TYYf2LSqo3LWlHTQ61kip2Wbe/+i9WrtZGpE0x1gLIgBK2SuVAHIFvEIW DiKWZPR2pulGrlYc0DpL56QPL4A/ZYav9foZzgneJWrMkiEprsRaZhO8vUEuQKsbyjHI8MC0vv wEGiXUnjHvAIy5zU31BKUS6ZSDYdypFJfZsF1Qd2vJozzwaHg5+1qfUbR1yFx5pLiPPVtpc4ZV 38Y= X-IronPort-AV: E=Sophos;i="5.83,310,1616486400"; d="scan'208";a="62949879" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa3.mentor.iphmx.com with ESMTP; 29 Jun 2021 15:42:19 -0800 IronPort-SDR: qc5zAbdwtgKdm5gpMbnrjfKozFxDhW9QcGgm1tYfMoT2gWFSD/sSFUtIl9YzIsn73VX0CIk5Dj 66ncCkvAwDXRK5JTR4PzsgI3NjpJnpMprE+YodkFQBufr9rLT/BxLhnIdymYZW0xawTWFuYDmj fk/cp3LwcLa3GibSm5Vb55jXaPggAtMKKL1keizjCKAziLv7aCcdsEP6h+xk92FHFW97irowsC 64HSCfl39Hq8YXUQMNqhyQ6NSXxGfcwOucnJHlY5agbkNDAyqkEXKcZsATqy/8x2XV26Q2IGnt oB8= From: Julian Brown To: CC: Thomas Schwinge , Jakub Jelinek , Chung-Lin Tang Subject: [PATCH 1/4] openacc: Async fix for lib-94 testcase Date: Tue, 29 Jun 2021 16:42:01 -0700 Message-ID: <60ddcd128d7c3a63e0c1bec07287a944ad735c4f.1624987598.git.julian@codesourcery.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) To SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jun 2021 23:42:21 -0000 The test case performs an asynchronous host-to-device copy and then immediately clobbers the data on the host via "memset", leading to a race condition. This patch moves the memset after an acc_wait call instead. Tested with offloading to AMD GCN. I can probably self-approve this as a testcase change only, unless anyone objects. Thanks, Julian 2021-06-29 Julian Brown libgomp/ * testsuite/libgomp.oacc-c-c++-common/lib-94.c: Fix race condition. --- libgomp/testsuite/libgomp.oacc-c-c++-common/lib-94.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-94.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-94.c index 54497237b0c..baa3ac83f04 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-94.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-94.c @@ -22,10 +22,10 @@ main (int argc, char **argv) acc_copyin_async (h, N, async); - memset (h, 0, N); - acc_wait (async); + memset (h, 0, N); + acc_copyout_async (h, N, async + 1); acc_wait (async + 1); -- 2.29.2