From patchwork Tue Oct 31 14:00:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 160118 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b90f:0:b0:403:3b70:6f57 with SMTP id t15csp259342vqg; Tue, 31 Oct 2023 07:00:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE2Xaqo0I0XZqK0mT0rf7WjIZQTK1gdNy4k6+CvS5x99xmYj12jGYgqrgyc+d5a2TKHq5xF X-Received: by 2002:a05:6214:2a8a:b0:672:96e:cac with SMTP id jr10-20020a0562142a8a00b00672096e0cacmr6489340qvb.25.1698760843978; Tue, 31 Oct 2023 07:00:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1698760843; cv=pass; d=google.com; s=arc-20160816; b=fswuqjF2Co8b2eYZKzP1EmIxE9eEAsroxoi7mLZjqcs4GxK246W3fmyd8vkzeMh7Zx kYjsCDitVfu7iyYv6dfPKlJD9JOgU5MbOv+i6OdcaLSX9HJH1KZuWEWnFD8pBTSd4V/P FBwLIe2Ff/YW1rPhnhmvKjxyKvfxk1HqnEOaLBuCID9tVTHvRpgrb5v+BwX2tgy1dxA+ BfklVprI/8Xah56xNISj1aXOSv2pO150FYZbz4H94Ghisel5/Ys+L2jWST+Tbd50FKvt 8Aq+Dpah6jlW97t3X2EORY1RDvp3TmHrPSfj6qExdxES9XQgx2p5LMLEKQN7QTKbGw3D C25w== 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:mime-version:message-id:date :user-agent:references:in-reply-to:subject:cc:to:from:ironport-sdr :arc-filter:dmarc-filter:delivered-to; bh=j2trWYy5izrXmKKwgaRenoNymR5h5j3umyAGu8gkEno=; fh=KBzxfVOaIdmMCkDstiKjNryItx4eiG3nrhvxC33WSKI=; b=ssickeE8e2ee1zbSLn905yQcShyBtQdOy1IK1cO7ATHykwdhJVTMkyVXV5M+tjlLsa HqqsquWf2g4jG0sfZvTr2ouP9xHITdhj4FsUn5QkKuPG9USNXCJim1hzFHJs5P0Q5fO5 sjt56XaBiIRmw/lqnb31oeOi1hIrET/1jvsNMxPeGOgRCzsz3/Ek52Jjbwv015MUgma1 W2uM8dlD0D5L81yKGO8KvLT2QAmggEnZ1YRKemEfJe2QirLLFm8xOVGpXsaisC072ZQO uuH56RQU09aAqslcHf+Bo6l7JRISdA3Yucp+pTuC5D9mfRLtdegCAPvXeh4jXhuMoiEC m41g== 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 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id l13-20020ad4452d000000b00656304f4f1esi1113713qvu.421.2023.10.31.07.00.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 07:00:43 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; 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 2620:52:3:1:0:246e:9693:128c 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 277C2385800A for ; Tue, 31 Oct 2023 14:00:41 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa1.mentor.iphmx.com (esa1.mentor.iphmx.com [68.232.129.153]) by sourceware.org (Postfix) with ESMTPS id DAF1A3858D35 for ; Tue, 31 Oct 2023 14:00:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DAF1A3858D35 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org DAF1A3858D35 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=68.232.129.153 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698760818; cv=none; b=dmhLvqOYrztJMnrigJO0t97JvuMtfCJ7jAkPbojunQKSHTWutL2/ZGlN/DKjJkafLQSNjw4OBDdFigFFEyO9ueNEyy9Gbr7cTgXSx/bR8gDMUvbngVtBTRaBZ1KBYmwoDSVCPhpm5havaBOCzk5swmTjGJQa/ECRnRNLsFsCsCU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698760818; c=relaxed/simple; bh=oQncpuqXJ679S9g6nHSAGQ4V989AnRvEppGsO/yUICM=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=N9+VAUWzoGqYSm6P8T157EDunzwllWLb4rjhMdXeWusEp5dkbOEXTJAW854vPAT89kFuzFpz7iKQQhvEUOsqk3TD6YnplmA+pNn2TPn/VoGpnlcrrHdub6zxfUFH3audDNrgQ1Snhrka306C1PjQtncxvcFltZJYKJW/Khbi79A= ARC-Authentication-Results: i=1; server2.sourceware.org X-CSE-ConnectionGUID: 8z21/dHBSkm1ibqXBwQnnw== X-CSE-MsgGUID: qYtNY8aYTLqbZF65+89hmQ== X-IronPort-AV: E=Sophos;i="6.03,265,1694764800"; d="scan'208,223";a="24213495" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa1.mentor.iphmx.com with ESMTP; 31 Oct 2023 06:00:12 -0800 IronPort-SDR: S1SpczzL7dgNulrbTiDqhGWxHu6XmOqRYRle6nK8OqMPRPoSjnJba6BhaPQiKrIwTKI8h6kLU7 CF9JJVIXv7UQkQuCNbakmR5QX/1Z4v7+uldhKX1xYN3mbYvdv7yoLbLK7VPzBrR6+w+ZzAvLl0 FccBcj1I2nFzCPmUScNs/0fU14fDqoSV3TxfzTLfwXjIqa60osAyT2mYtGW3Ou75xaI4zuzLrc S8OKrqlhYMybPdC8hfxEnY2Ij9r3zg6JYUVe9Qh3QM9xk2ZdvZ8gEM5zcKRUwa036NyroW6FNk qDg= From: Thomas Schwinge To: CC: Julian Brown , Chung-Lin Tang Subject: Add OpenACC 'acc_map_data' variant to 'libgomp.oacc-c-c++-common/deep-copy-8.c' (was: [PATCH 11/13] OpenACC 2.6 deep copy: C and C++ execution tests) In-Reply-To: References: User-Agent: Notmuch/0.29.3+94~g74c3f1b (https://notmuchmail.org) Emacs/28.2 (x86_64-pc-linux-gnu) Date: Tue, 31 Oct 2023 15:00:03 +0100 Message-ID: <87r0lauc2k.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-12.mgc.mentorg.com (139.181.222.12) To svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10) X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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: 1781279850711791033 X-GMAIL-MSGID: 1781279850711791033 Hi! On 2019-12-17T22:04:54-0800, Julian Brown wrote: > This patch has been broken out of the "OpenACC 2.6 manual deep copy > support" patch, [...] > This part adds C and C++ execution tests to libgomp. Pushed to master branch commit 3e888f94624294d2b9b34ebfee0916768e5d9c3f "Add OpenACC 'acc_map_data' variant to 'libgomp.oacc-c-c++-common/deep-copy-8.c'", see attached. This will be helpful to detect (and then avoid) a regression due to an libgomp patch elsewhere. Grüße Thomas > .../testsuite/libgomp.oacc-c++/deep-copy-12.C | 72 +++++++++++++++ > .../testsuite/libgomp.oacc-c++/deep-copy-13.C | 72 +++++++++++++++ > .../libgomp.oacc-c-c++-common/deep-copy-1.c | 24 +++++ > .../libgomp.oacc-c-c++-common/deep-copy-10.c | 53 +++++++++++ > .../libgomp.oacc-c-c++-common/deep-copy-11.c | 72 +++++++++++++++ > .../libgomp.oacc-c-c++-common/deep-copy-14.c | 63 ++++++++++++++ > .../libgomp.oacc-c-c++-common/deep-copy-2.c | 29 +++++++ > .../libgomp.oacc-c-c++-common/deep-copy-4.c | 87 +++++++++++++++++++ > .../libgomp.oacc-c-c++-common/deep-copy-6.c | 59 +++++++++++++ > .../libgomp.oacc-c-c++-common/deep-copy-7.c | 45 ++++++++++ > .../libgomp.oacc-c-c++-common/deep-copy-8.c | 54 ++++++++++++ > .../libgomp.oacc-c-c++-common/deep-copy-9.c | 53 +++++++++++ ----------------- 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 From 3e888f94624294d2b9b34ebfee0916768e5d9c3f Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Mon, 30 Oct 2023 17:11:40 +0100 Subject: [PATCH] Add OpenACC 'acc_map_data' variant to 'libgomp.oacc-c-c++-common/deep-copy-8.c' libgomp/ * testsuite/libgomp.oacc-c-c++-common/deep-copy-8.c: Add OpenACC 'acc_map_data' variant. --- .../libgomp.oacc-c-c++-common/deep-copy-8.c | 29 +++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/deep-copy-8.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/deep-copy-8.c index 1b4cf2fb684..e705f78c311 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/deep-copy-8.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/deep-copy-8.c @@ -12,8 +12,8 @@ struct dc int *d; }; -int -main () +static void +test (unsigned variant) { int n = 100, i, j, k; struct dc v = { .a = 3 }; @@ -22,7 +22,16 @@ main () v.c = (int *) malloc (sizeof (int) * n); v.d = (int *) malloc (sizeof (int) * n); + if (variant & 1) + { #pragma acc enter data copyin(v) + } + else + { + void *v_d = acc_malloc (sizeof v); + acc_map_data (&v, v_d, sizeof v); + acc_memcpy_to_device (v_d, &v, sizeof v); + } for (k = 0; k < 16; k++) { @@ -46,9 +55,25 @@ main () assert (!acc_is_present (v.d, sizeof (int) * n)); } + if (variant & 1) + { #pragma acc exit data copyout(v) + } + else + { + void *v_d = acc_deviceptr (&v); + acc_unmap_data (&v); + acc_free (v_d); + } assert (!acc_is_present (&v, sizeof (v))); +} + +int +main () +{ + for (unsigned variant = 0; variant < 2; ++variant) + test (variant); return 0; } -- 2.34.1