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: 1857599 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SKWxV56Hpz1yQ5 for ; Wed, 1 Nov 2023 01:00:30 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9494C3858C2C for ; Tue, 31 Oct 2023 14:00:28 +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+incoming=patchwork.ozlabs.org@gcc.gnu.org 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