gcc/libgomp/testsuite/libgomp.fortran/map-alloc-comp-9-usm.f90
Tobias Burnus 9565076f9b libgomp.fortran/map-alloc-comp-9{,-usm}.f90: Add unified_shared_memory variant
When host memory is device accessible - independent whether mapping is done or
not (i.e. self map), the 'vtab' pointer becomes accessible, which stores the
dynamic type's type and size information.

In principle, we want to test: USM available but mapping is still done, but
as there is no simple + reliable not-crashing way to test for this, those
checks are skipped in the (pre)existing test file map-alloc-comp-9.f90.

Or rather: those are only active with self-maps, which is currently only true
for the host.

This commit adds map-alloc-comp-9-usm.f90 which runs the same test with
'omp requires unified_shared_memory'.  While OpenMP permits both actual
mapping and self maps with this flag, it in theory covers the missing cases.
However, currently, GCC always uses self maps with USM. Still, having a
device-run self-maps check is better than nothing, even if it misses the
most interesting case.

libgomp/ChangeLog:

	* testsuite/libgomp.fortran/map-alloc-comp-9.f90: Process differently
	when USE_USM_REQUIREMENT is set.
	* testsuite/libgomp.fortran/map-alloc-comp-9-usm.f90: New test.
2025-05-07 13:46:51 +02:00

11 lines
397 B
Fortran

! { dg-additional-options "-cpp -DUSE_USM_REQUIREMENT=1 -Wno-openmp" }
!
! We silence the warning:
! Mapping of polymorphic list item '...' is unspecified behavior [-Wopenmp]
!
! Ensure that polymorphic mapping is diagnosed as undefined behavior
! Ensure that static access to polymorphic variables works
! Run map-alloc-comp-9.f90 in unified-shared-memory mode
#include "map-alloc-comp-9.f90"