From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1643) id 77AFA3858D33; Thu, 16 Feb 2023 21:20:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 77AFA3858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1676582406; bh=5Lz8gsmF/6CyN8ceZwsaOL6V/AJKnUwekZXn/+BTadY=; h=From:To:Subject:Date:From; b=dYzjshQ4Vd+K7G3TqaCG/uL6c3Iyb+75gs1rsUPTnhMsRGwHFyYvAU69pdRO3+BUz M8rxIIZS6xbGr4RKC/n4KTYphoF5WIeIayXSwFnZQstsIyiWjNY99wPtRQqqfdgANa eeQOkzu0jDujm5DxzytjKsjobg8ZMaA7kuq1ZzyE= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Thomas Schwinge To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/omp/gcc-12] Miscellaneous clean-up re OpenMP 'ompx_unified_shared_mem_space', 'ompx_host_mem_space' X-Act-Checkin: gcc X-Git-Author: Thomas Schwinge X-Git-Refname: refs/heads/devel/omp/gcc-12 X-Git-Oldrev: 6cc0e7bebf1b3ad6aacf75419e7f06942409f90c X-Git-Newrev: 23f52e49368d7b26a1b1a72d6bb903d31666e961 Message-Id: <20230216212006.77AFA3858D33@sourceware.org> Date: Thu, 16 Feb 2023 21:20:06 +0000 (GMT) List-Id: https://gcc.gnu.org/g:23f52e49368d7b26a1b1a72d6bb903d31666e961 commit 23f52e49368d7b26a1b1a72d6bb903d31666e961 Author: Thomas Schwinge Date: Tue Feb 14 17:10:57 2023 +0100 Miscellaneous clean-up re OpenMP 'ompx_unified_shared_mem_space', 'ompx_host_mem_space' Clean-up for og12 commit 84914e197d91a67b3d27db0e4c69a433462983a5 "openmp, nvptx: ompx_unified_shared_mem_alloc". No functional change. libgomp/ * config/linux/allocator.c (linux_memspace_calloc): Elide (innocuous) duplicate 'if' condition. * config/nvptx/allocator.c (nvptx_memspace_free): Explicitly handle 'memspace == ompx_host_mem_space'. * libgomp.h (gomp_is_usm_ptr): Remove. Diff: --- libgomp/ChangeLog.omp | 6 ++++++ libgomp/config/linux/allocator.c | 3 +-- libgomp/config/nvptx/allocator.c | 4 ++++ libgomp/libgomp.h | 1 - 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/libgomp/ChangeLog.omp b/libgomp/ChangeLog.omp index b667c72b8ca..1c4b1833c0b 100644 --- a/libgomp/ChangeLog.omp +++ b/libgomp/ChangeLog.omp @@ -1,5 +1,11 @@ 2023-02-16 Thomas Schwinge + * config/linux/allocator.c (linux_memspace_calloc): Elide + (innocuous) duplicate 'if' condition. + * config/nvptx/allocator.c (nvptx_memspace_free): Explicitly + handle 'memspace == ompx_host_mem_space'. + * libgomp.h (gomp_is_usm_ptr): Remove. + * basic-allocator.c (BASIC_ALLOC_YIELD): instead of '#deine', '#define' it. diff --git a/libgomp/config/linux/allocator.c b/libgomp/config/linux/allocator.c index 07af3a2821a..8a9171c36df 100644 --- a/libgomp/config/linux/allocator.c +++ b/libgomp/config/linux/allocator.c @@ -95,8 +95,7 @@ linux_memspace_calloc (omp_memspace_handle_t memspace, size_t size, int pin) memset (ret, 0, size); return ret; } - else if (memspace == ompx_unified_shared_mem_space - || pin) + else if (pin) return linux_memspace_alloc (memspace, size, pin); else return calloc (1, size); diff --git a/libgomp/config/nvptx/allocator.c b/libgomp/config/nvptx/allocator.c index 7c2a7463bf7..cbf86b8a2ec 100644 --- a/libgomp/config/nvptx/allocator.c +++ b/libgomp/config/nvptx/allocator.c @@ -42,6 +42,7 @@ chunks. */ #include "libgomp.h" +#include #include #define BASIC_ALLOC_PREFIX __nvptx_lowlat @@ -93,6 +94,9 @@ nvptx_memspace_free (omp_memspace_handle_t memspace, void *addr, size_t size) __nvptx_lowlat_free (shared_pool, addr, size); } + else if (memspace == ompx_host_mem_space) + /* Just verify what all allocator functions return. */ + assert (addr == NULL); else free (addr); } diff --git a/libgomp/libgomp.h b/libgomp/libgomp.h index d1e45cc584e..c001b468252 100644 --- a/libgomp/libgomp.h +++ b/libgomp/libgomp.h @@ -1133,7 +1133,6 @@ extern void gomp_target_rev (uint64_t, uint64_t, uint64_t, uint64_t, uint64_t, void *); extern void * gomp_usm_alloc (size_t size, int device_num); extern void gomp_usm_free (void *device_ptr, int device_num); -extern bool gomp_is_usm_ptr (void *ptr); /* Splay tree definitions. */ typedef struct splay_tree_node_s *splay_tree_node;