[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
This commit is contained in:
Hansang Bae 2021-01-06 16:14:37 -06:00
parent efd05040e1
commit fb1c528526
2 changed files with 73 additions and 92 deletions

View File

@ -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
! ***

View File

@ -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
! ***