From patchwork Mon Dec 9 11:53:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 1206149 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-515504-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="AG33nl6H"; 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 47WhSC5QRJz9sP6 for ; Mon, 9 Dec 2019 22:54:18 +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; q=dns; s=default; b=UftfXc/JNsjEn1tBKzlvr2Z9zJvUk8MPuyuRmK8dwpy0otHvyD Sg8TNrnVK3leZDFaVW4uVPXcIW4Qe6i//LyJJ0FxxdAcwx4sBWa/C4KukEEjQalf LKobBGF/VjsV1nhSycz4e/3kE3xEdKkQLvKw8yqRL2+Pa0LIlntOSMoYI= 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; s= default; bh=dTW+Gm6TqeR7gqYMZdnnpkv4yp0=; b=AG33nl6HHq9QMBp961DA wnjCeyQiw0FiFpYRZyU4DTPjo9oEYfX50qSOxsepP6YFEKSa/j/bb1MIo1+cyDDh 5npYk9PQuwTA01SoI+Tv3HxKakY7AEP0YffZRy+JlRXmA7JSTNUJ18QB3sn5gx1r IubYa2wqcTvTPx39UvIGcqI= Received: (qmail 59002 invoked by alias); 9 Dec 2019 11:54:11 -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 58994 invoked by uid 89); 9 Dec 2019 11:54:11 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-18.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: esa4.mentor.iphmx.com Received: from esa4.mentor.iphmx.com (HELO esa4.mentor.iphmx.com) (68.232.137.252) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 09 Dec 2019 11:54:09 +0000 IronPort-SDR: yobPcUnJXC1jPnG5hgsraptMrx+ZBpFi8H3Qiff4mAsPTANHgNXuiAajbJzw6D3webwfVDTtyo cfwEUR20s1iVlBHpBrCXaHm5wNRhZVqSRASeu78EaRP0EOVvQbTAX56ga5vTmVnVM7NR5GrF+j Od7CSZrKImrxfcfMhCo/oNdl4KmtG2LpjvcE84/vfjUlPuWz/jI9L+GmHkxD4ohhzc7ktf/Gt5 ATgQA2rcqYO87H+yKGw7V73DIiW/CEg/c3EPdQdw3CCSTuotzU6eKKnmCElew+9Q+dPOTB1fdD Vps= Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa4.mentor.iphmx.com with ESMTP; 09 Dec 2019 03:54:08 -0800 IronPort-SDR: aiIKwgbhLA3qofjWQa5B+RPkidQcu4txWOZs4T65nJtNNvbWDcGOXaoIckPcTWHJy8YzWvIoDL 8TtunL+D8X3wnJQk5F2wp3eGKAKjfZ1eaWvgzGJYrc5GaIxezxFywkdC4ZKWyhJPHNttFjMMY3 J5QR/TfgmcjARw24RbS66ORuJ88X+e2Xk4TfOYKAxpcIXz8QJFsYnLtWO8ZpBGfb7tNMTNEx8U CWtY1axGZOE9igNQW+X7EyLx0RefWfsmGI8GwrZH7Ol3WgJe5tVwMn/ytGA/FhmN6sw6uSM8ty I/M= From: Thomas Schwinge To: CC: Julian Brown Subject: Add 'libgomp.oacc-c-c++-common/map-data-1.c' User-Agent: Notmuch/0.29.1+93~g67ed7df (https://notmuchmail.org) Emacs/26.1 (x86_64-pc-linux-gnu) Date: Mon, 9 Dec 2019 12:53:54 +0100 Message-ID: <87immp3eb1.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 Hi! See attached "Add 'libgomp.oacc-c-c++-common/map-data-1.c'", committed to trunk in r279121. Grüße Thomas From 524aec42ea4d0a98fd6a0815e7573bf94fa70ee3 Mon Sep 17 00:00:00 2001 From: tschwinge Date: Mon, 9 Dec 2019 11:40:27 +0000 Subject: [PATCH] Add 'libgomp.oacc-c-c++-common/map-data-1.c' libgomp/ * testsuite/libgomp.oacc-c-c++-common/map-data-1.c: New file. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@279121 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgomp/ChangeLog | 2 + .../libgomp.oacc-c-c++-common/map-data-1.c | 53 +++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/map-data-1.c diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index aac3b1887b0..51a00a3a46c 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,5 +1,7 @@ 2019-12-09 Thomas Schwinge + * testsuite/libgomp.oacc-c-c++-common/map-data-1.c: New file. + PR libgomp/92854 * testsuite/libgomp.oacc-c-c++-common/pr92854-1.c: New file. diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/map-data-1.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/map-data-1.c new file mode 100644 index 00000000000..d0781dd7f56 --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/map-data-1.c @@ -0,0 +1,53 @@ +/* Verify that 'acc_map_data' does not copy data to, and 'acc_unmap_data' does + not copy data from the device. */ + +/* { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } } */ + +#include +#include +#include + +int +main () +{ + const int c0 = 9; + const int c1 = 40; + const int c2 = 47; + + const size_t N = 256; + + unsigned char *h = (unsigned char *) malloc (N); + + void *d = acc_malloc (N); + + memset (h, c0, N); // H <- c0 + acc_memcpy_to_device (d, h, N); // D <- H = c0 + + memset (h, c1, N); // H <- c1 + acc_map_data (h, d, N); + for (size_t i = 0; i < N; ++i) + if (h[i] != c1) + abort (); + + acc_memcpy_from_device (h, d, N); // H <- D = c0 + for (size_t i = 0; i < N; ++i) + if (h[i] != c0) + abort (); + + memset (h, c2, N); // H <- c2 + acc_unmap_data (h); + for (size_t i = 0; i < N; ++i) + if (h[i] != c2) + abort (); + + acc_memcpy_from_device (h, d, N); // H <- D = c0 + for (size_t i = 0; i < N; ++i) + if (h[i] != c0) + abort (); + + acc_free (d); + + free (h); + + return 0; +} -- 2.17.1