[llvm-branch-commits] [openmp] fb1c528 - [OpenMP] Use c_int/c_size_t in Fortran target memory routine interface

Hansang Bae via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Jan 6 14:34:04 PST 2021


Author: Hansang Bae
Date: 2021-01-06T16:28:30-06:00
New Revision: fb1c52852690cb6ad6f7f2a7b5c35bf4d0c56e44

URL: https://github.com/llvm/llvm-project/commit/fb1c52852690cb6ad6f7f2a7b5c35bf4d0c56e44
DIFF: https://github.com/llvm/llvm-project/commit/fb1c52852690cb6ad6f7f2a7b5c35bf4d0c56e44.diff

LOG: [OpenMP] Use c_int/c_size_t in Fortran target memory routine interface

The Fortran interface is now in line with 5.1 specification.

Differential Revision: https://reviews.llvm.org/D94042

Added: 
    

Modified: 
    openmp/runtime/src/include/omp_lib.f90.var
    openmp/runtime/src/include/omp_lib.h.var

Removed: 
    


################################################################################
diff  --git a/openmp/runtime/src/include/omp_lib.f90.var b/openmp/runtime/src/include/omp_lib.f90.var
index 1bde868a505b..24f8a2af4c5e 100644
--- a/openmp/runtime/src/include/omp_lib.f90.var
+++ b/openmp/runtime/src/include/omp_lib.f90.var
@@ -512,59 +512,54 @@
           function omp_target_alloc(size, device_num) bind(c)
             use omp_lib_kinds
             type(c_ptr) omp_target_alloc
-            integer (kind=kmp_size_t_kind), value :: size
-            integer (kind=omp_integer_kind), value :: device_num
+            integer(c_size_t), value :: size
+            integer(c_int), value :: device_num
           end function omp_target_alloc
 
           subroutine omp_target_free(device_ptr, device_num) bind(c)
             use omp_lib_kinds
             type(c_ptr), value :: device_ptr
-            integer (kind=omp_integer_kind), value :: device_num
+            integer(c_int), value :: device_num
           end subroutine omp_target_free
 
           function omp_target_is_present(ptr, device_num) bind(c)
             use omp_lib_kinds
-            integer (kind=omp_integer_kind) omp_target_is_present
+            integer(c_int) omp_target_is_present
             type(c_ptr), value :: ptr
-            integer (kind=omp_integer_kind), value :: device_num
+            integer(c_int), value :: device_num
           end function omp_target_is_present
 
           function omp_target_memcpy(dst, src, length, dst_offset, src_offset, &
               dst_device_num, src_device_num) bind(c)
             use omp_lib_kinds
-            integer (kind=omp_integer_kind) omp_target_memcpy
+            integer(c_int) omp_target_memcpy
             type(c_ptr), value :: dst, src
-            integer (kind=kmp_size_t_kind), value :: length, dst_offset,       &
-                src_offset
-            integer (kind=omp_integer_kind), value :: dst_device_num,          &
-                src_device_num
+            integer(c_size_t), value :: length, dst_offset, src_offset
+            integer(c_int), value :: dst_device_num, src_device_num
           end function omp_target_memcpy
 
           function omp_target_memcpy_rect(dst, src, element_size, num_dims,    &
               volume, dst_offsets, src_offsets, dst_dimensions,                &
               src_dimensions, dst_device_num, src_device_num) bind(c)
             use omp_lib_kinds
-            integer (kind=omp_integer_kind) omp_target_memcpy_rect
+            integer(c_int) omp_target_memcpy_rect
             type(c_ptr), value :: dst, src
-            integer (kind=kmp_size_t_kind), value :: element_size
-            integer (kind=omp_integer_kind), value :: num_dims,                &
-                dst_device_num, src_device_num
-            integer (kind=kmp_size_t_kind), intent(in) :: volume(*),           &
-                dst_offsets(*), src_offsets(*), dst_dimensions(*),             &
-                src_dimensions(*)
+            integer(c_size_t), value :: element_size
+            integer(c_int), value :: num_dims, dst_device_num, src_device_num
+            integer(c_size_t), intent(in) :: volume(*), dst_offsets(*),        &
+                src_offsets(*), dst_dimensions(*), src_dimensions(*)
           end function omp_target_memcpy_rect
 
           function omp_target_memcpy_async(dst, src, length, dst_offset,       &
               src_offset, dst_device_num, src_device_num, depobj_count,        &
               depobj_list) bind(c)
             use omp_lib_kinds
-            integer (kind=omp_integer_kind) omp_target_memcpy_async
+            integer(c_int) omp_target_memcpy_async
             type(c_ptr), value :: dst, src
-            integer (kind=kmp_size_t_kind), value :: length, dst_offset,       &
-                src_offset
-            integer (kind=omp_integer_kind), value :: dst_device_num,          &
-                src_device_num, depobj_count
-            integer (kind=omp_depend_kind), optional :: depobj_list(*)
+            integer(c_size_t), value :: length, dst_offset, src_offset
+            integer(c_int), value :: dst_device_num, src_device_num,           &
+                depobj_count
+            integer(omp_depend_kind), optional :: depobj_list(*)
           end function omp_target_memcpy_async
 
           function omp_target_memcpy_rect_async(dst, src, element_size,        &
@@ -572,38 +567,37 @@
               src_dimensions, dst_device_num, src_device_num, depobj_count,    &
               depobj_list) bind(c)
             use omp_lib_kinds
-            integer (kind=omp_integer_kind) omp_target_memcpy_rect_async
+            integer(c_int) omp_target_memcpy_rect_async
             type(c_ptr), value :: dst, src
-            integer (kind=kmp_size_t_kind), value :: element_size
-            integer (kind=omp_integer_kind), value :: num_dims,                &
-                dst_device_num, src_device_num, depobj_count
-            integer (kind=kmp_size_t_kind), intent(in) :: volume(*),           &
-                dst_offsets(*), src_offsets(*), dst_dimensions(*),             &
-                src_dimensions(*)
-            integer (kind=omp_depend_kind), optional :: depobj_list(*)
+            integer(c_size_t), value :: element_size
+            integer(c_int), value :: num_dims, dst_device_num, src_device_num, &
+                depobj_count
+            integer(c_size_t), intent(in) :: volume(*), dst_offsets(*),        &
+                src_offsets(*), dst_dimensions(*), src_dimensions(*)
+            integer (omp_depend_kind), optional :: depobj_list(*)
           end function omp_target_memcpy_rect_async
 
           function omp_target_associate_ptr(host_ptr, device_ptr, size,        &
               device_offset, device_num) bind(c)
             use omp_lib_kinds
-            integer (kind=omp_integer_kind) omp_target_associate_ptr
+            integer(c_int) omp_target_associate_ptr
             type(c_ptr), value :: host_ptr, device_ptr
-            integer (kind=kmp_size_t_kind), value :: size, device_offset
-            integer (kind=omp_integer_kind), value :: device_num
+            integer(c_size_t), value :: size, device_offset
+            integer(c_int), value :: device_num
           end function omp_target_associate_ptr
 
           function omp_get_mapped_ptr(ptr, device_num) bind(c)
             use omp_lib_kinds
             type(c_ptr) omp_get_mapped_ptr
             type(c_ptr), value :: ptr
-            integer (kind=omp_integer_kind), value :: device_num
+            integer(c_int), value :: device_num
           end function omp_get_mapped_ptr
 
           function omp_target_disassociate_ptr(ptr, device_num) bind(c)
             use omp_lib_kinds
-            integer (kind=omp_integer_kind) omp_target_disassociate_ptr
+            integer(c_int) omp_target_disassociate_ptr
             type(c_ptr), value :: ptr
-            integer (kind=omp_integer_kind), value :: device_num
+            integer(c_int), value :: device_num
           end function omp_target_disassociate_ptr
 
 !         ***

diff  --git a/openmp/runtime/src/include/omp_lib.h.var b/openmp/runtime/src/include/omp_lib.h.var
index b649a8071e6f..05140b04f273 100644
--- a/openmp/runtime/src/include/omp_lib.h.var
+++ b/openmp/runtime/src/include/omp_lib.h.var
@@ -586,110 +586,97 @@
         end subroutine omp_display_env
 
         function omp_target_alloc(size, device_num) bind(c)
-          use, intrinsic :: iso_c_binding, only : c_ptr
-          import
+          use, intrinsic :: iso_c_binding, only : c_ptr, c_size_t, c_int
           type(c_ptr) omp_target_alloc
-          integer (kind=kmp_size_t_kind), value :: size
-          integer (kind=omp_integer_kind), value :: device_num
+          integer(c_size_t), value :: size
+          integer(c_int), value :: device_num
         end function omp_target_alloc
 
         subroutine omp_target_free(device_ptr, device_num) bind(c)
-          use, intrinsic :: iso_c_binding, only : c_ptr
-          import
+          use, intrinsic :: iso_c_binding, only : c_ptr, c_int
           type(c_ptr), value :: device_ptr
-          integer (kind=omp_integer_kind), value :: device_num
+          integer(c_int), value :: device_num
         end subroutine omp_target_free
 
         function omp_target_is_present(ptr, device_num) bind(c)
-          use, intrinsic :: iso_c_binding, only : c_ptr
-          import
-          integer (kind=omp_integer_kind) omp_target_is_present
+          use, intrinsic :: iso_c_binding, only : c_ptr, c_int
+          integer(c_int) omp_target_is_present
           type(c_ptr), value :: ptr
-          integer (kind=omp_integer_kind), value :: device_num
+          integer(c_int), value :: device_num
         end function omp_target_is_present
 
         function omp_target_memcpy(dst, src, length, dst_offset,                                                                    &
      &      src_offset, dst_device_num, src_device_num) bind(c)
-          use, intrinsic :: iso_c_binding, only : c_ptr
-          import
-          integer (kind=omp_integer_kind) omp_target_memcpy
+          use, intrinsic :: iso_c_binding, only : c_ptr, c_int, c_size_t
+          integer(c_int) omp_target_memcpy
           type(c_ptr), value :: dst, src
-          integer (kind=kmp_size_t_kind), value :: length, dst_offset,                                                              &
-     &        src_offset
-          integer (kind=omp_integer_kind), value :: dst_device_num,                                                                 &
-     &        src_device_num
+          integer(c_size_t), value :: length, dst_offset, src_offset
+          integer(c_int), value :: dst_device_num, src_device_num
         end function omp_target_memcpy
 
         function omp_target_memcpy_rect(dst, src, element_size,                                                                     &
      &      num_dims, volume, dst_offsets, src_offsets, dst_dimensions,                                                             &
      &      src_dimensions, dst_device_num, src_device_num) bind(c)
-          use, intrinsic :: iso_c_binding, only : c_ptr
-          import
-          integer (kind=omp_integer_kind) omp_target_memcpy_rect
+          use, intrinsic :: iso_c_binding, only : c_ptr, c_int, c_size_t
+          integer(c_int) omp_target_memcpy_rect
           type(c_ptr), value :: dst, src
-          integer (kind=kmp_size_t_kind), value :: element_size
-          integer (kind=omp_integer_kind), value :: num_dims,                                                                       &
-     &        dst_device_num, src_device_num
-          integer (kind=kmp_size_t_kind), intent(in) :: volume(*),                                                                  &
-     &        dst_offsets(*), src_offsets(*), dst_dimensions(*),                                                                    &
-     &        src_dimensions(*)
+          integer(c_size_t), value :: element_size
+          integer(c_int), value :: num_dims, dst_device_num,                                                                        &
+     &        src_device_num
+          integer(c_size_t), intent(in) :: volume(*), dst_offsets(*),                                                               &
+     &        src_offsets(*), dst_dimensions(*), src_dimensions(*)
         end function omp_target_memcpy_rect
 
         function omp_target_memcpy_async(dst, src, length, dst_offset,                                                              &
      &      src_offset, dst_device_num, src_device_num, depobj_count,                                                               &
      &      depobj_list) bind(c)
-          use, intrinsic :: iso_c_binding, only : c_ptr
+          use, intrinsic :: iso_c_binding, only : c_ptr, c_int, c_size_t
           import
-          integer (kind=omp_integer_kind) omp_target_memcpy_async
+          integer(c_int) omp_target_memcpy_async
           type(c_ptr), value :: dst, src
-          integer (kind=kmp_size_t_kind), value :: length, dst_offset,                                                              &
-     &        src_offset
-          integer (kind=omp_integer_kind), value :: dst_device_num,                                                                 &
-     &        src_device_num, depobj_count
-          integer (kind=omp_depend_kind), optional :: depobj_list(*)
+          integer(c_size_t), value :: length, dst_offset, src_offset
+          integer(c_int), value :: dst_device_num, src_device_num,                                                                  &
+     &        depobj_count
+          integer(omp_depend_kind), optional :: depobj_list(*)
         end function omp_target_memcpy_async
 
         function omp_target_memcpy_rect_async(dst, src, element_size,                                                               &
      &      num_dims, volume, dst_offsets, src_offsets, dst_dimensions,                                                             &
      &      src_dimensions, dst_device_num, src_device_num,                                                                         &
      &      depobj_count, depobj_list) bind(c)
-          use, intrinsic :: iso_c_binding, only : c_ptr
+          use, intrinsic :: iso_c_binding, only : c_ptr, c_int, c_size_t
           import
-          integer (kind=omp_integer_kind) omp_target_memcpy_rect_async
+          integer(c_int) omp_target_memcpy_rect_async
           type(c_ptr), value :: dst, src
-          integer (kind=kmp_size_t_kind), value :: element_size
-          integer (kind=omp_integer_kind), value :: num_dims,                                                                       &
-     &        dst_device_num, src_device_num, depobj_count
-          integer (kind=kmp_size_t_kind), intent(in) :: volume(*),                                                                  &
-     &        dst_offsets(*), src_offsets(*), dst_dimensions(*),                                                                    &
-     &        src_dimensions(*)
-          integer (kind=omp_depend_kind), optional :: depobj_list(*)
+          integer(c_size_t), value :: element_size
+          integer(c_int), value :: num_dims, dst_device_num,                                                                        &
+     &        src_device_num, depobj_count
+          integer(c_size_t), intent(in) :: volume(*), dst_offsets(*),                                                               &
+     &        src_offsets(*), dst_dimensions(*), src_dimensions(*)
+          integer(omp_depend_kind), optional :: depobj_list(*)
         end function omp_target_memcpy_rect_async
 
         function omp_target_associate_ptr(host_ptr, device_ptr, size,                                                               &
      &      device_offset, device_num) bind(c)
-          use, intrinsic :: iso_c_binding, only : c_ptr
-          import
-          integer (kind=omp_integer_kind) omp_target_associate_ptr
+          use, intrinsic :: iso_c_binding, only : c_ptr, c_size_t, c_int
+          integer(c_int) omp_target_associate_ptr
           type(c_ptr), value :: host_ptr, device_ptr
-          integer (kind=kmp_size_t_kind), value :: size, device_offset
-          integer (kind=omp_integer_kind), value :: device_num
+          integer(c_size_t), value :: size, device_offset
+          integer(c_int), value :: device_num
         end function omp_target_associate_ptr
 
         function omp_get_mapped_ptr(ptr, device_num) bind(c)
-          use, intrinsic :: iso_c_binding, only : c_ptr
-          import
+          use, intrinsic :: iso_c_binding, only : c_ptr, c_int
           type(c_ptr) omp_get_mapped_ptr
           type(c_ptr), value :: ptr
-          integer (kind=omp_integer_kind), value :: device_num
+          integer(c_int), value :: device_num
         end function omp_get_mapped_ptr
 
         function omp_target_disassociate_ptr(ptr, device_num) bind(c)
-          use, intrinsic :: iso_c_binding, only : c_ptr
-          import
-          integer (kind=omp_integer_kind) omp_target_disassociate_ptr
+          use, intrinsic :: iso_c_binding, only : c_ptr, c_int
+          integer(c_int) omp_target_disassociate_ptr
           type(c_ptr), value :: ptr
-          integer (kind=omp_integer_kind), value :: device_num
+          integer(c_int), value :: device_num
         end function omp_target_disassociate_ptr
 
 !       ***


        


More information about the llvm-branch-commits mailing list