From 32919a1ecbc1aeff7d164fd7446b096354a3c511 Mon Sep 17 00:00:00 2001
From: foreman
Date: Wed, 7 Aug 2019 11:30:59 -0400
Subject: [PATCH] P4 to Git Change 1979479 by cpaquot@cpaquot-ocl-lc-lnx on
2019/08/07 11:25:59
SWDEV-198424 - [HIP] Implemented missing fields for hipGetDeviceAttribute.
Affected files ...
... //depot/stg/opencl/drivers/opencl/api/hip/hip_device.cpp#21 edit
... //depot/stg/opencl/drivers/opencl/api/hip/hip_device_runtime.cpp#17 edit
[ROCm/hip commit: 042a4c2bb2188571784bac7dad8c7cb7145adc91]
---
projects/hip/api/hip/hip_device.cpp | 9 ++++++++
projects/hip/api/hip/hip_device_runtime.cpp | 24 +++++++++++++++++++++
2 files changed, 33 insertions(+)
diff --git a/projects/hip/api/hip/hip_device.cpp b/projects/hip/api/hip/hip_device.cpp
index 622ad150a1..dc63666876 100644
--- a/projects/hip/api/hip/hip_device.cpp
+++ b/projects/hip/api/hip/hip_device.cpp
@@ -195,6 +195,15 @@ hipError_t hipGetDeviceProperties ( hipDeviceProp_t* props, hipDevice_t device )
deviceProps.cooperativeLaunch = info.cooperativeGroups_;
deviceProps.cooperativeMultiDeviceLaunch = info.cooperativeMultiDeviceGroups_;
+ deviceProps.maxTexture1D = info.imageMaxBufferSize_;
+ deviceProps.maxTexture2D[0] = info.image2DMaxWidth_;
+ deviceProps.maxTexture2D[1] = info.image2DMaxHeight_;
+ deviceProps.maxTexture3D[0] = info.image3DMaxWidth_;
+ deviceProps.maxTexture3D[1] = info.image3DMaxHeight_;
+ deviceProps.maxTexture3D[2] = info.image3DMaxDepth_;
+ deviceProps.hdpMemFlushCntl = nullptr;
+ deviceProps.hdpRegFlushCntl = nullptr;
+
*props = deviceProps;
HIP_RETURN(hipSuccess);
}
diff --git a/projects/hip/api/hip/hip_device_runtime.cpp b/projects/hip/api/hip/hip_device_runtime.cpp
index eabf622f28..a039dced3e 100644
--- a/projects/hip/api/hip/hip_device_runtime.cpp
+++ b/projects/hip/api/hip/hip_device_runtime.cpp
@@ -241,6 +241,30 @@ hipError_t hipDeviceGetAttribute(int* pi, hipDeviceAttribute_t attr, int device)
case hipDeviceAttributeCooperativeMultiDeviceLaunch:
*pi = prop.cooperativeMultiDeviceLaunch;
break;
+ case hipDeviceAttributeMaxTexture1DWidth:
+ *pi = prop.maxTexture1D;
+ break;
+ case hipDeviceAttributeMaxTexture2DWidth:
+ *pi = prop.maxTexture2D[0];
+ break;
+ case hipDeviceAttributeMaxTexture2DHeight:
+ *pi = prop.maxTexture2D[1];
+ break;
+ case hipDeviceAttributeMaxTexture3DWidth:
+ *pi = prop.maxTexture3D[0];
+ break;
+ case hipDeviceAttributeMaxTexture3DHeight:
+ *pi = prop.maxTexture3D[1];
+ break;
+ case hipDeviceAttributeMaxTexture3DDepth:
+ *pi = prop.maxTexture3D[2];
+ break;
+ case hipDeviceAttributeHdpMemFlushCntl:
+ *reinterpret_cast(pi) = prop.hdpMemFlushCntl;
+ break;
+ case hipDeviceAttributeHdpRegFlushCntl:
+ *reinterpret_cast(pi) = prop.hdpRegFlushCntl;
+ break;
default:
HIP_RETURN(hipErrorInvalidValue);
}