From patchwork Wed Aug 23 14:14:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Stubbs X-Patchwork-Id: 13711 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a7d1:0:b0:3f2:4152:657d with SMTP id p17csp490350vqm; Wed, 23 Aug 2023 07:15:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGxcC0Z2uc1UTHOU5iIxYsp9C+3KxD8bsEkqCBxv/cqNYmPSe5ZH2L+sLhFzCqOJwPLebhm X-Received: by 2002:a2e:94ca:0:b0:2b5:7f93:b3b0 with SMTP id r10-20020a2e94ca000000b002b57f93b3b0mr8501881ljh.17.1692800158387; Wed, 23 Aug 2023 07:15:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692800158; cv=none; d=google.com; s=arc-20160816; b=q7rORj5iYxNn20Tjhf9Zjk/uAsN9ob2fIcvy81guy+ip7x+7Qn1mjdEB+EhhRZoMEx sc0bPhSiXajiNJ7G9OV0nBdBOo5TWMQBiEpNSHDFAbT1PQ9mfiRlz4aXnSZVvUmckBBj zVnYnM7mOuQ9D1LnCK12GcOlTxvh/Sb5nPHo0//OhW4Sifb7Sxwvo0vBxFC85rD0as24 jOyKw+wYBVJ+l2D/3LmzpYtyHUwO3AlDDO9UWqQ0Wj70+pLDV2PiPZPRW08I6HXyEPFy uQa+arrR+Wz+1UxAHWXSq1b7SwwDX4uBpv7/4LLcc5AVNmmPkDyMtnA8y++kRJ2Urain f8OQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender: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 :dmarc-filter:delivered-to; bh=6UhHOfjHwi9YhM5/ZUUrRBA4BeKoYBvJPEZdglLHCE8=; fh=9xD62naDDQ44CEuxrRV0ts5PrjZies6B3X/DCYdxTRw=; b=Xkc4blorPH2IMk3wpuNqg1O2WiOVhIhvG9w3TrrGOKq3Uh8nDh3xstzK/VDVJdPuzm aXbJJW8qP0KkjbXDB3l2UloShr2Bq42J+fGwana+/H5AdwM0+wQOyhVnHeP5X7TNF0vl mWBkRLCkunDBB37zzdkW6xeMlz8ifFzcLeBl0hWzS/229g6hHKknQ4t9RhOSg6YSLPgl Ud15EQ3SB/QSTF8PZ4/Tc99L6RqqPhe1T8NJAgaT6kBm5tEdJU8lqehuq+9WmcogPFhF 46G7cFVFnM6NfvECU8rCBn7M09j5/bE5ma4fkcu7hTJyCXo3GlKTE7h0PuFJs8qYDysL eG/A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id a19-20020a17090680d300b0099bd5fe0db3si9276559ejx.906.2023.08.23.07.15.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Aug 2023 07:15:58 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 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 1570D3850419 for ; Wed, 23 Aug 2023 14:15:08 +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 269AE3858C01 for ; Wed, 23 Aug 2023 14:14:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 269AE3858C01 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com X-IronPort-AV: E=Sophos;i="6.01,195,1684828800"; d="scan'208";a="17132433" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa1.mentor.iphmx.com with ESMTP; 23 Aug 2023 06:14:38 -0800 IronPort-SDR: i2nhh3s5h0XSow/vqwD4fNEfzSElOGw1d/28pykb6aP7BIbTjNT44McMzGo1+KA2qaunaQ2rq1 Y2ajZoSpqMpPyqFROLu/E0hJPVw7ciW2pKHnUw2GdRR8NV45AOnibwzw/4PB01Hzo99z8zivVP mQPGmEBba/CpYuwtwI4nLvrh4HfXXigZnlnEVwj8Dm4PcCSrgGQL7n1F1bNc7qL9Eyd5FnPAsK RZeBCQl70JFfj+Dg8e9FOjGi0qFygrysLgv9f/9RbrceL/zQScfA49SUlSaTaVafWpAranEP+A iCI= From: Andrew Stubbs To: Subject: [PATCH v2 0/6] libgomp: OpenMP pinned memory omp_alloc Date: Wed, 23 Aug 2023 15:14:20 +0100 Message-ID: <20230823141426.320160-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-15.mgc.mentorg.com (139.181.222.15) To svr-ies-mbx-11.mgc.mentorg.com (139.181.222.11) X-Spam-Status: No, score=-6.0 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP 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.29 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 Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1775029619135154340 X-GMAIL-MSGID: 1775029619135154340 This patch series is a rework of part of the series I posted about a year ago: https://patchwork.sourceware.org/project/gcc/list/?series=10748&state=%2A&archive=both The series depends on the low-latency patch series I posted a few weeks ago: https://patchwork.sourceware.org/project/gcc/list/?series=23045&state=%2A&archive=both I will post the Unified Shared Memory and allocator directive patches at a later time. This version of the patches implement the same basic features, rebased on the current sourcebase, plus a Cuda-specific allocator for improved performance with NVPTX offloading, and a custom allocator for better handling of small allocations. The whole series has been bug fixed and generally improved (mostly by Thomas :) ). 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 | 5 +- libgomp/allocator.c | 96 ++++-- libgomp/config/gcn/allocator.c | 17 +- libgomp/config/linux/allocator.c | 234 +++++++++++++ libgomp/config/nvptx/allocator.c | 17 +- libgomp/libgomp-plugin.h | 2 + libgomp/libgomp.h | 14 + libgomp/libgomp.map | 1 + libgomp/libgomp_g.h | 1 + libgomp/omp.h.in | 1 + libgomp/omp_lib.f90.in | 2 + libgomp/plugin/plugin-nvptx.c | 34 ++ libgomp/target.c | 136 ++++++++ .../libgomp.c-c++-common/alloc-pinned-1.c | 28 ++ libgomp/testsuite/libgomp.c/alloc-pinned-1.c | 134 ++++++++ libgomp/testsuite/libgomp.c/alloc-pinned-2.c | 139 ++++++++ libgomp/testsuite/libgomp.c/alloc-pinned-3.c | 174 ++++++++++ libgomp/testsuite/libgomp.c/alloc-pinned-4.c | 176 ++++++++++ libgomp/testsuite/libgomp.c/alloc-pinned-5.c | 128 +++++++ libgomp/testsuite/libgomp.c/alloc-pinned-6.c | 127 +++++++ 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 ++++++++++++++++++ 30 files changed, 2051 insertions(+), 50 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