[SWDEV-448077][SWDEV-448067] - Changes to Kernel Node Attribute related APIs
Change-Id: Ibbf773fd5f134a62b7ce04f6956b10c1086b1782
Этот коммит содержится в:
@@ -442,6 +442,9 @@ hipError_t hipDeviceGetAttribute(int* pi, hipDeviceAttribute_t attr, int device)
|
||||
case hipDeviceAttributeVirtualMemoryManagementSupported:
|
||||
*pi = static_cast<int>(g_devices[device]->devices()[0]->info().virtualMemoryManagement_);
|
||||
break;
|
||||
case hipDeviceAttributeAccessPolicyMaxWindowSize:
|
||||
*pi = prop.accessPolicyMaxWindowSize;
|
||||
break;
|
||||
default:
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
}
|
||||
|
||||
@@ -1422,6 +1422,9 @@ hipError_t hipGraphKernelNodeGetParams(hipGraphNode_t node, hipKernelNodeParams*
|
||||
pNodeParams == nullptr) {
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
}
|
||||
if (reinterpret_cast<hip::GraphNode*>(node)->GetType() != hipGraphNodeTypeKernel){
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
}
|
||||
reinterpret_cast<hip::GraphKernelNode*>(node)->GetParams(pNodeParams);
|
||||
HIP_RETURN(hipSuccess);
|
||||
}
|
||||
@@ -1433,6 +1436,9 @@ hipError_t hipGraphKernelNodeSetParams(hipGraphNode_t node,
|
||||
pNodeParams == nullptr || pNodeParams->func == nullptr) {
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
}
|
||||
if (reinterpret_cast<hip::GraphNode*>(node)->GetType() != hipGraphNodeTypeKernel){
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
}
|
||||
HIP_RETURN(reinterpret_cast<hip::GraphKernelNode*>(node)->SetParams(pNodeParams));
|
||||
}
|
||||
|
||||
@@ -1457,6 +1463,11 @@ hipError_t hipGraphKernelNodeSetAttribute(hipGraphNode_t hNode, hipKernelNodeAtt
|
||||
attr != hipLaunchAttributePriority) {
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
}
|
||||
|
||||
if (reinterpret_cast<hip::GraphNode*>(hNode)->GetType() != hipGraphNodeTypeKernel){
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
}
|
||||
|
||||
HIP_RETURN(reinterpret_cast<hip::GraphKernelNode*>(hNode)->SetAttrParams(attr, value));
|
||||
}
|
||||
|
||||
@@ -1471,6 +1482,11 @@ hipError_t hipGraphKernelNodeGetAttribute(hipGraphNode_t hNode, hipKernelNodeAtt
|
||||
attr != hipLaunchAttributePriority) {
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
}
|
||||
|
||||
if (reinterpret_cast<hip::GraphNode*>(hNode)->GetType() != hipGraphNodeTypeKernel){
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
}
|
||||
|
||||
HIP_RETURN(reinterpret_cast<hip::GraphKernelNode*>(hNode)->GetAttrParams(attr, value));
|
||||
}
|
||||
|
||||
|
||||
@@ -1070,7 +1070,12 @@ class GraphKernelNode : public GraphNode {
|
||||
}
|
||||
|
||||
hipError_t SetAttrParams(hipKernelNodeAttrID attr, const hipKernelNodeAttrValue* params) {
|
||||
constexpr int accessPolicyMaxWindowSize = 1024;
|
||||
hipDeviceProp_t prop = {0};
|
||||
hipError_t status = ihipGetDeviceProperties(&prop, ihipGetDevice());
|
||||
if (hipSuccess != status){
|
||||
return status;
|
||||
}
|
||||
int accessPolicyMaxWindowSize = prop.accessPolicyMaxWindowSize;
|
||||
// updates kernel attr params
|
||||
if (attr == hipKernelNodeAttributeAccessPolicyWindow) {
|
||||
if (params->accessPolicyWindow.hitRatio > 1 ||
|
||||
@@ -1087,7 +1092,7 @@ class GraphKernelNode : public GraphNode {
|
||||
|
||||
// need to check against accessPolicyMaxWindowSize from device
|
||||
// accessPolicyMaxWindowSize not implemented on the device side yet
|
||||
if (params->accessPolicyWindow.num_bytes >= accessPolicyMaxWindowSize) {
|
||||
if (params->accessPolicyWindow.num_bytes > accessPolicyMaxWindowSize) {
|
||||
return hipErrorInvalidValue;
|
||||
}
|
||||
|
||||
@@ -1099,6 +1104,10 @@ class GraphKernelNode : public GraphNode {
|
||||
} else if (attr == hipKernelNodeAttributeCooperative) {
|
||||
kernelAttr_.cooperative = params->cooperative;
|
||||
} else if (attr == hipLaunchAttributePriority) {
|
||||
if (params->priority < hip::Stream::Priority::Low ||
|
||||
params->priority > hip::Stream::Priority::High){
|
||||
return hipErrorInvalidValue;
|
||||
}
|
||||
kernelAttr_.priority = params->priority;
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user