From patchwork Fri Dec 1 14:38:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cesar Philippidis X-Patchwork-Id: 843526 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-468338-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="pwBeGD4b"; 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 3ypH292ZQfz9t9t for ; Sat, 2 Dec 2017 01:38:24 +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 :subject:to:message-id:date:mime-version:content-type; q=dns; s= default; b=yzC44fksfnuASmxsfi7poXjS7OEt0NhKShVDGoTvrHCzNM/EHp9J1 r0fulkPXnmf8BIDk6qxGe0dHLuTFM0wgJvqsej+aUy9FzNHn0gadWWuEXDxObhEX ZxaLZQ5IW5x25QgR5GQr2DNQqQ5sNv43ZLEjsYG41VFea7+gKJybnU= 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 :subject:to:message-id:date:mime-version:content-type; s= default; bh=nvMPvmH6m8Od6BdCU4NFPkgpgZA=; b=pwBeGD4bxWqim5W5dsmy uegIseDxCNV9MpZTQ63jk7gANg4Qpw1BDUw/qMrj50e31BvGNf38EYC3Edz2j9oh y1k1vQDSk6B7x1WxSeCqxc4WT/gX64S2FApta9m39OSzRXuWHnErwGrBPALJKSAS HcaRxCi6F1Ev+2EFTUi0eA4= Received: (qmail 96915 invoked by alias); 1 Dec 2017 14:38:17 -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 96906 invoked by uid 89); 1 Dec 2017 14:38:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KB_WAM_FROM_NAME_SINGLEWORD, RCVD_IN_DNSWL_NONE, SPF_PASS, URIBL_RED autolearn=ham version=3.3.2 spammy= 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, 01 Dec 2017 14:38:15 +0000 Received: from svr-orw-mbx-04.mgc.mentorg.com ([147.34.90.204]) by relay1.mentorg.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-SHA384:256) id 1eKmSC-00077b-Df from Cesar_Philippidis@mentor.com for gcc-patches@gcc.gnu.org; Fri, 01 Dec 2017 06:38:12 -0800 Received: from [127.0.0.1] (147.34.91.1) by SVR-ORW-MBX-04.mgc.mentorg.com (147.34.90.204) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Fri, 1 Dec 2017 06:38:10 -0800 From: Cesar Philippidis Subject: [patch] Fix bug in an OpenACC async test case To: "gcc-patches@gcc.gnu.org" Message-ID: Date: Fri, 1 Dec 2017 06:38:06 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 X-ClientProxiedBy: svr-orw-mbx-01.mgc.mentorg.com (147.34.90.201) To SVR-ORW-MBX-04.mgc.mentorg.com (147.34.90.204) This patch fixes a race condition bug in libgomp.oacc-c-c++-common/data-2-lib.c. That is an OpenACC test which exercises the runtime wait API, for use in conjunction with asynchronous OpenACC offloaded regions. I not sure why this problem went undetected for so long. Either the parallel region runs too fast on the GPU so that the copy'ed out data is correct, or the Nvidia's CUDA runtime blocks all device->host data transfers until the GPU is no longer processing the data. I suspect it's the former. I've applied this patch to trunk and og7 as obvious. Cesar 2017-12-01 Cesar Philippidis libgomp/ * testsuite/libgomp.oacc-c-c++-common/data-2-lib.c: Add missing call to acc_wait (1). diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/data-2-lib.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/data-2-lib.c index 1694f582363..f553d3d839c 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/data-2-lib.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/data-2-lib.c @@ -64,6 +64,8 @@ main (int argc, char **argv) for (i = 0; i < N; i++) b[i] = a[i]; + acc_wait (1); + acc_memcpy_from_device (a, d_a, nbytes); acc_memcpy_from_device (b, d_b, nbytes);