Skip to content

Commit a864fb2

Browse files
author
Georgi Mirazchiyski
committed
Use the designated UR value for coarse-grain memory advise
1 parent d8fd5f0 commit a864fb2

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

source/adapters/hip/enqueue.cpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,15 @@ ur_result_t setHipMemAdvise(const void *DevPtr, const size_t Size,
8989
ur_usm_advice_flags_t URAdviceFlags,
9090
hipDevice_t Device) {
9191
// Handle unmapped memory advice flags
92-
// FIXME: Temporary use UR_USM_ADVICE_FLAG_SET_NON_ATOMIC_MOSTLY and
93-
// UR_USM_ADVICE_FLAG_CLEAR_NON_ATOMIC_MOSTLY for controlling coarse-grain
94-
// memory until we introduce a new flag more appropriately. Add them back to
95-
// unsupported when that happens.
9692
if (URAdviceFlags &
97-
(UR_USM_ADVICE_FLAG_BIAS_CACHED | UR_USM_ADVICE_FLAG_BIAS_UNCACHED)) {
93+
(UR_USM_ADVICE_FLAG_SET_NON_ATOMIC_MOSTLY |
94+
UR_USM_ADVICE_FLAG_CLEAR_NON_ATOMIC_MOSTLY |
95+
UR_USM_ADVICE_FLAG_BIAS_CACHED | UR_USM_ADVICE_FLAG_BIAS_UNCACHED
96+
#if !defined(__HIP_PLATFORM_AMD__)
97+
| UR_USM_ADVICE_FLAG_SET_NON_COHERENT_MEMORY |
98+
UR_USM_ADVICE_FLAG_CLEAR_NON_COHERENT_MEMORY
99+
#endif
100+
)) {
98101
return UR_RESULT_ERROR_INVALID_ENUMERATION;
99102
}
100103

@@ -120,9 +123,9 @@ ur_result_t setHipMemAdvise(const void *DevPtr, const size_t Size,
120123
std::make_pair(UR_USM_ADVICE_FLAG_CLEAR_ACCESSED_BY_DEVICE,
121124
hipMemAdviseUnsetAccessedBy),
122125
#if defined(__HIP_PLATFORM_AMD__)
123-
std::make_pair(UR_USM_ADVICE_FLAG_SET_NON_ATOMIC_MOSTLY,
126+
std::make_pair(UR_USM_ADVICE_FLAG_SET_NON_COHERENT_MEMORY,
124127
hipMemAdviseSetCoarseGrain),
125-
std::make_pair(UR_USM_ADVICE_FLAG_CLEAR_NON_ATOMIC_MOSTLY,
128+
std::make_pair(UR_USM_ADVICE_FLAG_CLEAR_NON_COHERENT_MEMORY,
126129
hipMemAdviseUnsetCoarseGrain),
127130
#endif
128131
};

0 commit comments

Comments
 (0)