From 1f53fbea8f52c76c9f9901f03b08d64f106ef098 Mon Sep 17 00:00:00 2001 From: gandryey <56892148+gandryey@users.noreply.github.com> Date: Thu, 19 Aug 2021 00:59:23 -0400 Subject: [PATCH] SWDEV-295555 - Add coherency mode query (#2316) Add the new extension to HIP for quering coherency mode. The new enum hipMemRangeAttributeCoherencyMode can be used in hipMemRangeGetAttribute(s), which will return one of the following values: hipMemRangeCoherencyModeFineGrain, hipMemRangeCoherencyModeCoarseGrain, hipMemRangeCoherencyModeIndeterminate Change-Id: I8717873c254888ea69facc1178d3682e8747c3a7 --- include/hip/hip_runtime_api.h | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/include/hip/hip_runtime_api.h b/include/hip/hip_runtime_api.h index 6c443b5203..2aa438809b 100644 --- a/include/hip/hip_runtime_api.h +++ b/include/hip/hip_runtime_api.h @@ -635,9 +635,23 @@ typedef enum hipMemoryAdvise { ///< coherent operations between host and device, while ///< executing kernels. The coarse-grain can be used ///< for data that only needs to be coherent at dispatch - ///< boundaries for better performance. + ///< boundaries for better performance hipMemAdviseUnsetCoarseGrain = 101 ///< Restores cache coherency policy back to fine-grain } hipMemoryAdvise; +/* + * @brief HIP Coherency Mode + * @enum + * @ingroup Enumerations + */ +typedef enum hipMemRangeCoherencyMode { + hipMemRangeCoherencyModeFineGrain = 0, ///< Updates to memory with this attribute can be + ///< done coherently from all devices + hipMemRangeCoherencyModeCoarseGrain = 1, ///< Writes to memory with this attribute can be + ///< performed by a single device at a time + hipMemRangeCoherencyModeIndeterminate = 2 ///< Memory region queried contains subregions with + ///< both hipMemRangeCoherencyModeFineGrain and + ///< hipMemRangeCoherencyModeCoarseGrain attributes +} hipMemRangeCoherencyMode; /* * @brief HIP range attributes * @enum @@ -649,7 +663,10 @@ typedef enum hipMemRangeAttribute { hipMemRangeAttributePreferredLocation = 2, ///< The preferred location of the range hipMemRangeAttributeAccessedBy = 3, ///< Memory range has hipMemAdviseSetAccessedBy ///< set for the specified device - hipMemRangeAttributeLastPrefetchLocation = 4,///< The last location to where the range was prefetched + hipMemRangeAttributeLastPrefetchLocation = 4,///< The last location to where the range was + ///< prefetched + hipMemRangeAttributeCoherencyMode = 100, ///< Returns coherency mode + ///< @ref hipMemRangeCoherencyMode for the range } hipMemRangeAttribute; /* * @brief hipJitOption