]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Miscellaneous clean-up re OpenMP 'ompx_unified_shared_mem_space', 'ompx_host_mem_space'
authorThomas Schwinge <thomas@codesourcery.com>
Tue, 14 Feb 2023 16:10:57 +0000 (17:10 +0100)
committerThomas Schwinge <thomas@codesourcery.com>
Thu, 16 Feb 2023 21:14:39 +0000 (22:14 +0100)
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.

libgomp/ChangeLog.omp
libgomp/config/linux/allocator.c
libgomp/config/nvptx/allocator.c
libgomp/libgomp.h

index b667c72b8ca8918ee721ba33988cbb5a82b2effb..1c4b1833c0b5d6e8a9cc4ec3e18893a3e2a4c033 100644 (file)
@@ -1,5 +1,11 @@
 2023-02-16  Thomas Schwinge  <thomas@codesourcery.com>
 
+       * 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.
 
index 07af3a2821a5c870f0ab84ba61b07213b2550b8a..8a9171c36df5a255beae8633475b82fad9e88232 100644 (file)
@@ -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);
index 7c2a7463bf7b1ec960dae58be8da4afbaf1d979f..cbf86b8a2ec920d90425b3911168a1f02a493590 100644 (file)
@@ -42,6 +42,7 @@
    chunks.  */
 
 #include "libgomp.h"
+#include <assert.h>
 #include <stdlib.h>
 
 #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);
 }
index d1e45cc584eab1f6c15c9ef1624fea572cba9dbb..c001b468252ac4d9442a2054100afc9109dafa19 100644 (file)
@@ -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;