Skip to content

Commit f779a64

Browse files
[Flang][OpenMP] Fix GenASiS failure for USM mode
Dope vectors/ Fortran descriptors do not need to be updated if we run Fortran code compiled with the flag -fopenmp-force-usm and HSA_XNACK=1. Updating Fortran descriptors for GenASiS and the unified shared memory option leads to a segmentation fault.
1 parent a0dd2dd commit f779a64

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

offload/libomptarget/omptarget.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,9 @@ postProcessingTargetDataEnd(DeviceTy *Device,
600600
// TODO/FIXME: Look into a better longterm solution, such as a different
601601
// mapping combination for descriptors or performing a similar base
602602
// address skip that we've done elsewhere in the omptarget runtime.
603-
if (*ShadowPtr.HstPtrAddr == nullptr && ShadowPtr.IsDescriptorBaseAddr)
603+
bool isUSMMode = PM->getRequirements() & OMP_REQ_UNIFIED_SHARED_MEMORY;
604+
if ((*ShadowPtr.HstPtrAddr == nullptr || isUSMMode) &&
605+
ShadowPtr.IsDescriptorBaseAddr)
604606
return OFFLOAD_SUCCESS;
605607
*ShadowPtr.HstPtrAddr = ShadowPtr.HstPtrVal;
606608
DP("Restoring original host pointer value " DPxMOD " for host "
@@ -852,7 +854,9 @@ static int targetDataContiguous(ident_t *Loc, DeviceTy &Device, void *ArgsBase,
852854
// different mapping combination for descriptors or performing a
853855
// similar base address skip that we've done elsewhere in the
854856
// omptarget runtime.
855-
if (*ShadowPtr.HstPtrAddr == nullptr &&
857+
bool isUSMMode =
858+
PM->getRequirements() & OMP_REQ_UNIFIED_SHARED_MEMORY;
859+
if ((*ShadowPtr.HstPtrAddr == nullptr || isUSMMode) &&
856860
ShadowPtr.IsDescriptorBaseAddr)
857861
return OFFLOAD_SUCCESS;
858862
*ShadowPtr.HstPtrAddr = ShadowPtr.HstPtrVal;

0 commit comments

Comments
 (0)