diff --git a/projects/clr/hipamd/src/hip_memory.cpp b/projects/clr/hipamd/src/hip_memory.cpp index d540ab782b..e3823c504e 100644 --- a/projects/clr/hipamd/src/hip_memory.cpp +++ b/projects/clr/hipamd/src/hip_memory.cpp @@ -339,21 +339,25 @@ hipError_t hipHostMalloc(void** ptr, size_t sizeBytes, unsigned int flags) { hip_status = hipErrorInvalidValue; } else { auto device = ctx->getWriteableDevice(); - +#if (__hcc_workweek__ >= 19115) + //Avoid mapping host pinned memory to all devices by HCC + unsigned amFlags = amHostUnmapped; +#else unsigned amFlags = 0; +#endif if (flags & hipHostMallocCoherent) { - amFlags = amHostCoherent; + amFlags |= amHostCoherent; } else if (flags & hipHostMallocNonCoherent) { - amFlags = amHostNonCoherent; + amFlags |= amHostNonCoherent; } else { // depends on env variables: - amFlags = HIP_HOST_COHERENT ? amHostCoherent : amHostNonCoherent; + amFlags |= HIP_HOST_COHERENT ? amHostCoherent : amHostNonCoherent; } *ptr = hip_internal::allocAndSharePtr( (amFlags & amHostCoherent) ? "finegrained_host" : "pinned_host", sizeBytes, ctx, - (trueFlags & hipHostMallocPortable) /*shareWithAll*/, amFlags, flags, 0); + true /*shareWithAll*/, amFlags, flags, 0); if (sizeBytes && (*ptr == NULL)) { hip_status = hipErrorMemoryAllocation;