From 1621668fe9bde465a52f842645b103b0cbc4d754 Mon Sep 17 00:00:00 2001 From: ROCm CI Service Account <66695075+rocm-ci@users.noreply.github.com> Date: Thu, 10 Mar 2022 16:47:03 +0530 Subject: [PATCH] SWDEV-318833 - Get and Set attribute for kernel nodes (#2533) Signed-off-by: sdashmiz Change-Id: Ieacd1fd9aa6d6e98a3a5574ba374c201f05d0e51 [ROCm/hip commit: c52a81e96f2039d606f5788cab16bb736714c7c8] --- projects/hip/include/hip/hip_runtime_api.h | 49 ++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/projects/hip/include/hip/hip_runtime_api.h b/projects/hip/include/hip/hip_runtime_api.h index 28f035a8b9..b34b4489b3 100644 --- a/projects/hip/include/hip/hip_runtime_api.h +++ b/projects/hip/include/hip/hip_runtime_api.h @@ -165,6 +165,31 @@ typedef enum hipMemoryType { hipMemoryTypeUnified ///< Not used currently } hipMemoryType; +/** + * @brief hipKernelNodeAttrID + * @enum + * + */ +typedef enum hipKernelNodeAttrID { + hipKernelNodeAttributeAccessPolicyWindow = 1, + hipKernelNodeAttributeCooperative = 2, +} hipKernelNodeAttrID; +typedef enum hipAccessProperty { + hipAccessPropertyNormal = 0, + hipAccessPropertyStreaming = 1, + hipAccessPropertyPersisting = 2, +} hipAccessProperty; +typedef struct hipAccessPolicyWindow { + void* base_ptr; + hipAccessProperty hitProp; + float hitRatio; + hipAccessProperty missProp; + size_t num_bytes; +} hipAccessPolicyWindow; +typedef union hipKernelNodeAttrValue { + hipAccessPolicyWindow accessPolicyWindow; + int cooperative; +} hipKernelNodeAttrValue; /** * Pointer attributes @@ -4887,6 +4912,30 @@ hipError_t hipGraphMemcpyNodeGetParams(hipGraphNode_t node, hipMemcpy3DParms* pN */ hipError_t hipGraphMemcpyNodeSetParams(hipGraphNode_t node, const hipMemcpy3DParms* pNodeParams); +/** + * @brief Sets a node attribute. + * + * @param [in] hNode - instance of the node to set parameters to. + * @param [in] attr - the attribute node is set to. + * @param [in] value - const pointer to the parameters. + * @returns #hipSuccess, #hipErrorInvalidValue + * @warning : This API is marked as beta, meaning, while this is feature complete, + * it is still open to changes and may have outstanding issues. + */ +hipError_t hipGraphKernelNodeSetAttribute(hipGraphNode_t hNode, hipKernelNodeAttrID attr, + const hipKernelNodeAttrValue* value); +/** + * @brief Gets a node attribute. + * + * @param [in] hNode - instance of the node to set parameters to. + * @param [in] attr - the attribute node is set to. + * @param [in] value - const pointer to the parameters. + * @returns #hipSuccess, #hipErrorInvalidValue + * @warning : This API is marked as beta, meaning, while this is feature complete, + * it is still open to changes and may have outstanding issues. + */ +hipError_t hipGraphKernelNodeGetAttribute(hipGraphNode_t hNode, hipKernelNodeAttrID attr, + hipKernelNodeAttrValue* value); /** * @brief Sets the parameters for a memcpy node in the given graphExec. *