From patchwork Mon Dec 11 17:03:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Stubbs X-Patchwork-Id: 17859 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp7199049vqy; Mon, 11 Dec 2023 09:05:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IHMgg0yhjB/kj42pHrbWM0/Qk2b5ZKJmc/U+s8UIsfjrmlnJ6cxp2Pj/VpfNRox0TdC+71Z X-Received: by 2002:a05:6122:448d:b0:4b2:e214:4a9 with SMTP id cz13-20020a056122448d00b004b2e21404a9mr3637409vkb.20.1702314311242; Mon, 11 Dec 2023 09:05:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1702314311; cv=pass; d=google.com; s=arc-20160816; b=0PNZDJ/S2zzmo0aKjfDLRW5BE6WbE7oPZRaOJvA7sdYYceYDqiIyWnmu1vRwCRAhXw cnIcXgMgv2aRyvhkNglJO0J+XPfDNOS1O/H3CcHDU6gNVVXNIdL5sy2vJh5xrUkp0cuB TdzwZblqPhSAKjEhVEjhtnDpCnzRmRT0K/iBCmojHVMCc6MQtM6xkAfIowQul3pWCh5p mjZisVf3TonbA+QF2J1zyQqLwAEFAfxt5m83n40Ti6v/7G78evS7NrIEBpfVs7Mv1Lrn evvuSVuTDPMJ0Bish+3aVfbG9xj0USp3WDs1BjlCcgggqAhDD9MmXDmkAhvGN51byLXJ POAA== 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:content-transfer-encoding :mime-version:message-id:date:subject:to:from:ironport-sdr :arc-filter:dmarc-filter:delivered-to; bh=xGr2/6rNIo+IXbEYAiZZbX/YdyvnhL5xVycM0aX0lm0=; fh=gk9A5O7Gbglvz1MjrRQ4hZ2i3c68kYkpOZJg1emXh+g=; b=uVLYOm8hl0UH9gPGOXxJ9hjwQs3jJWbqX3gQ1k7SIHsNl5ypTSgoUVS6gkbU5nwVu+ c4hEiCtstUuNS9OkHbBBDyd0zMFK2FuFL9+0sXnKtKCFOnOIdp5egqylvOh+vulKuJYL jOgwVn3CKfZ7/3tJrKWNdlaqrSqUXDJKfdQtR0nlw9JtOD8Es9rU56f8jyokyb0He6C5 S89BPyHeCsl6FRUEUWZ/X0LHZ5lO260gtQDrsq694K28dy7fCf3U0lyV1+KyFsmjLPRD GViVzA4MgOvN0LApjcFkrv0i5ymbNaj0y1STGp5OwoEBB1Jx5zCyXCLmUlOuvwHB2FrW k9ng== 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 cp10-20020a056122430a00b004b285b10039si1683670vkb.100.2023.12.11.09.04.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 09:05:11 -0800 (PST) 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 29F353858010 for ; Mon, 11 Dec 2023 17:04:54 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa3.mentor.iphmx.com (esa3.mentor.iphmx.com [68.232.137.180]) by sourceware.org (Postfix) with ESMTPS id BB5593858D28 for ; Mon, 11 Dec 2023 17:04:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BB5593858D28 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 BB5593858D28 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=68.232.137.180 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702314268; cv=none; b=sk4S5+nn63RYNQW3G6Jgs33V++c6Khg8BT742YwsIxaDMnzaM6F5pq874rXasxvMgXy5bFHLi/FCGjX5qKHtPOKvfImPe4qQSdjPQtSH78PNFmEBDkwVx4v2JN0/MPvatNnxKzeDdo6m5XSED42J+mt0nTiMxvYpcuDok2YWcao= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702314268; c=relaxed/simple; bh=0iuE3KoGXOxEpyIydGgI1frMwapjzrWIlhJq+yBm5M0=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=Sgg6/OTb5cF5pItyKK6umt+smitWGBW16wr/o47PEo3cGN7mXgl8ayt4unERW98SVTNA6wk/fQ4X15covWx47TP3Yp3DfPGuJlv5pwwmDs/hL1PauGqdIC9KUgENrtIpF/HmZ9pkfh4ZJDr+ONXs1eGZPlzBYp36bQBpRLaY8ag= ARC-Authentication-Results: i=1; server2.sourceware.org X-CSE-ConnectionGUID: 0IGxXY0YRhSUutFv22ANCg== X-CSE-MsgGUID: EREQ+MJgSKWLOWuPXNE16Q== X-IronPort-AV: E=Sophos;i="6.04,268,1695715200"; d="scan'208";a="25008310" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa3.mentor.iphmx.com with ESMTP; 11 Dec 2023 09:04:25 -0800 IronPort-SDR: QLPVlccXEyJeBTA4CdtKQEhe6YP71r6uZHLHlwNDQ2RwyuU82jagqgZMMfuSDgYUEEBcYTR5W7 eZLMG4H395h1YXrV3PkjTSsmENTpQ2sFbRTQq9OWa3uNx1O0m9AVPlmSZagYjyK5plh5WFtLID MDvM+AbfwuDbadKV4J7wb4uZ0RcC6Pghnq2/Ac8iLLJvu5gTHcTtjEOark3QkN7qprdDIlMWbV A47qBNEC/7z/LuA86thBFVxj/pFl7T4iWV+uwlf/RT+Ns0mTaPS5a6BHOlxGxC1eDLDzegQGBM 12k= From: Andrew Stubbs To: Subject: [PATCH v3 0/6] libgomp: OpenMP pinned memory omp_alloc Date: Mon, 11 Dec 2023 17:03:59 +0000 Message-ID: <20231211170405.2538247-1-ams@codesourcery.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10) To svr-ies-mbx-11.mgc.mentorg.com (139.181.222.11) X-Spam-Status: No, score=-5.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no 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: 1785005931290625185 X-GMAIL-MSGID: 1785005931290625185 This patch series is a rework of the v2 series I posted in August: https://patchwork.sourceware.org/project/gcc/list/?series=23763&state=%2A&archive=both This version addresses most of the review comments from Tobias, but after discussion with Tobias and Thomas we've decided to skip the nice-to-have proposed initialization improvement in the interest of getting the job done, for now. Otherwise, some bugs have been fixed and few other clean-ups have been made, but the series retains the same purpose and structure. This series no longer has any out-of-tree dependencies, now that the low-latency allocator patch have been committed. An older, less compact, version of these patches is already applied to the devel/omp/gcc-13 (OG13) branch. OK for mainline? Andrew Andrew Stubbs (5): libgomp: basic pinned memory on Linux libgomp, openmp: Add ompx_pinned_mem_alloc openmp: Add -foffload-memory openmp: -foffload-memory=pinned libgomp: fine-grained pinned memory allocator Thomas Schwinge (1): libgomp, nvptx: Cuda pinned memory gcc/common.opt | 16 + gcc/coretypes.h | 7 + gcc/doc/invoke.texi | 16 +- gcc/omp-builtins.def | 3 + gcc/omp-low.cc | 66 ++++ libgomp/Makefile.am | 2 +- libgomp/Makefile.in | 7 +- libgomp/allocator.c | 95 ++++-- libgomp/config/gcn/allocator.c | 21 +- libgomp/config/linux/allocator.c | 243 +++++++++++++ libgomp/config/nvptx/allocator.c | 21 +- libgomp/libgomp-plugin.h | 2 + libgomp/libgomp.h | 14 + libgomp/libgomp.map | 1 + libgomp/libgomp.texi | 17 +- libgomp/libgomp_g.h | 1 + libgomp/omp.h.in | 1 + libgomp/omp_lib.f90.in | 2 + libgomp/plugin/plugin-nvptx.c | 42 +++ libgomp/target.c | 136 ++++++++ .../libgomp.c-c++-common/alloc-pinned-1.c | 28 ++ libgomp/testsuite/libgomp.c/alloc-pinned-1.c | 141 ++++++++ libgomp/testsuite/libgomp.c/alloc-pinned-2.c | 146 ++++++++ libgomp/testsuite/libgomp.c/alloc-pinned-3.c | 189 +++++++++++ libgomp/testsuite/libgomp.c/alloc-pinned-4.c | 184 ++++++++++ libgomp/testsuite/libgomp.c/alloc-pinned-5.c | 129 +++++++ libgomp/testsuite/libgomp.c/alloc-pinned-6.c | 128 +++++++ libgomp/testsuite/libgomp.c/alloc-pinned-7.c | 63 ++++ libgomp/testsuite/libgomp.c/alloc-pinned-8.c | 127 +++++++ .../libgomp.fortran/alloc-pinned-1.f90 | 16 + libgomp/usmpin-allocator.c | 319 ++++++++++++++++++ 31 files changed, 2127 insertions(+), 56 deletions(-) create mode 100644 libgomp/testsuite/libgomp.c-c++-common/alloc-pinned-1.c create mode 100644 libgomp/testsuite/libgomp.c/alloc-pinned-1.c create mode 100644 libgomp/testsuite/libgomp.c/alloc-pinned-2.c create mode 100644 libgomp/testsuite/libgomp.c/alloc-pinned-3.c create mode 100644 libgomp/testsuite/libgomp.c/alloc-pinned-4.c create mode 100644 libgomp/testsuite/libgomp.c/alloc-pinned-5.c create mode 100644 libgomp/testsuite/libgomp.c/alloc-pinned-6.c create mode 100644 libgomp/testsuite/libgomp.c/alloc-pinned-7.c create mode 100644 libgomp/testsuite/libgomp.c/alloc-pinned-8.c create mode 100644 libgomp/testsuite/libgomp.fortran/alloc-pinned-1.f90 create mode 100644 libgomp/usmpin-allocator.c