Hi PA,
Paul-Antoine Arras wrote:
Hi Thomas,
Added libgomp/testsuite/libgomp.fortran/dispatch-1.f90.
I see this new test case FAIL (execution test SIGSEGV) for most (but not
all) offloading configurations, both GCN and nvptx:
+PASS: libgomp.fortran/dispatch-1.f90 -O (test for excess
errors)
+FAIL: libgomp.fortran/dispatch-1.f90 -O execution test
Thanks for pointing that out! The testcase missed an OpenMP target
directive. The attached patch should fix it.
…
--- libgomp/testsuite/libgomp.fortran/dispatch-1.f90
+++ libgomp/testsuite/libgomp.fortran/dispatch-1.f90
@@ -55,6 +55,7 @@ module procedures
call c_f_pointer(d_av, fp_av, [n])
! Perform operations on target
+ !$omp target is_device_ptr(fp_bv, fp_av)
do i = 1, n
fp_bv(i) = fp_av(i) * i
end do
I think the patch is okay in the sense that it works;
still, I think you should consider the following.
Using 'is_device_ptr' for for an argument that
is not a type(c_ptr) is deprecated since OpenMP 5.1 and
removed from the specification since OpenMP 6.0.
Thus, it would be a bit cleaner (and might avoid future
-Wdeprecated warnings) using
has_device_addr(fp_bv, fp_av) instead. (5.1 semantic states that this replacement
happens automatically when the is_device_ptr argument is not a C_PTR.)
Albeit it feels a bit cleaner to move the device pointer handling to the
device side, i.e. implicit none integer :: res, n, i type(c_ptr) :: d_bv
type(c_ptr) :: d_av !$omp target is_device_ptr(d_bv, d_av) block
real(8), pointer :: fp_bv(:), fp_av(:) ! Fortran pointers for array
access ! Associate C pointers with Fortran pointers call
c_f_pointer(d_bv, fp_bv, [n]) call c_f_pointer(d_av, fp_av, [n]) !
Perform operations on target do i = 1, n fp_bv(i) = fp_av(i) * i end do
end block However, as all variants work in practice, I don't feel strong
about it, with a small preference of a variant that does not use
deprecated features. (Both dispatch and the has_device_addr clause/the
deprecation are new with OpenMP 5.1) Tobias