Added query of hipDeviceAttributeHdpMemFlushCntl and hipDeviceAttribu… (#1238)

* Added query of hipDeviceAttributeHdpMemFlushCntl and hipDeviceAttributeHdpRegFlushCntl

* Added NVCC blocker for the hip*FlushCntl test cases


[ROCm/hip commit: e7447d5809]
Этот коммит содержится в:
wkwchau
2019-08-01 12:03:35 -04:00
коммит произвёл Maneesh Gupta
родитель 87bc7183bf
Коммит c666fdaa08
4 изменённых файлов: 46 добавлений и 2 удалений
+6 -2
Просмотреть файл
@@ -117,10 +117,12 @@ typedef struct hipDeviceProp_t {
int integrated; ///< APU vs dGPU
int cooperativeLaunch; ///< HIP device supports cooperative launch
int cooperativeMultiDeviceLaunch; ///< HIP device supports cooperative launch on multiple devices
#if !__HIP_VDI__ // Temporarily disable the following three new fields for HIP/VDI runtime
#if !__HIP_VDI__ // Temporarily disable the following five new fields for HIP/VDI runtime
int maxTexture1D; ///< Maximum number of elements in 1D images
int maxTexture2D[2]; ///< Maximum dimensions (width, height) of 2D images, in image elements
int maxTexture3D[3]; ///< Maximum dimensions (width, height, depth) of 3D images, in image elements
unsigned int* hdpMemFlushCntl; ///< Addres of HDP_MEM_COHERENCY_FLUSH_CNTL register
unsigned int* hdpRegFlushCntl; ///< Addres of HDP_REG_COHERENCY_FLUSH_CNTL register
#endif
} hipDeviceProp_t;
@@ -306,8 +308,10 @@ typedef enum hipDeviceAttribute_t {
hipDeviceAttributeMaxTexture2DHeight, ///< Maximum dimension height of 2D images in image elements
hipDeviceAttributeMaxTexture3DWidth, ///< Maximum dimension width of 3D images in image elements
hipDeviceAttributeMaxTexture3DHeight, ///< Maximum dimensions height of 3D images in image elements
hipDeviceAttributeMaxTexture3DDepth ///< Maximum dimensions depth of 3D images in image elements
hipDeviceAttributeMaxTexture3DDepth, ///< Maximum dimensions depth of 3D images in image elements
hipDeviceAttributeHdpMemFlushCntl, ///< Address of the HDP_MEM_COHERENCY_FLUSH_CNTL register
hipDeviceAttributeHdpRegFlushCntl ///< Address of the HDP_REG_COHERENCY_FLUSH_CNTL register
} hipDeviceAttribute_t;
enum hipComputeMode {
+11
Просмотреть файл
@@ -293,6 +293,17 @@ hipError_t ihipDeviceGetAttribute(int* pi, hipDeviceAttribute_t attr, int device
break;
case hipDeviceAttributeMaxTexture3DDepth:
*pi = prop->maxTexture3D[2];
case hipDeviceAttributeHdpMemFlushCntl:
{
uint32_t** hdp = reinterpret_cast<uint32_t**>(pi);
*hdp = prop->hdpMemFlushCntl;
}
break;
case hipDeviceAttributeHdpRegFlushCntl:
{
uint32_t** hdp = reinterpret_cast<uint32_t**>(pi);
*hdp = prop->hdpRegFlushCntl;
}
break;
default:
e = hipErrorInvalidValue;
+9
Просмотреть файл
@@ -915,6 +915,15 @@ hipError_t ihipDevice_t::initProperties(hipDeviceProp_t* prop) {
err = hsa_agent_get_info(_hsaAgent, (hsa_agent_info_t)HSA_EXT_AGENT_INFO_IMAGE_3D_MAX_ELEMENTS,
prop->maxTexture3D);
DeviceErrorCheck(err);
// Get Agent HDP Flush Register Memory
hsa_amd_hdp_flush_t hdpinfo;
err = hsa_agent_get_info(_hsaAgent, (hsa_agent_info_t)HSA_AMD_AGENT_INFO_HDP_FLUSH, &hdpinfo);
DeviceErrorCheck(err);
prop->hdpMemFlushCntl = hdpinfo.HDP_MEM_FLUSH_CNTL;
prop->hdpRegFlushCntl = hdpinfo.HDP_REG_FLUSH_CNTL;
return e;
}
+20
Просмотреть файл
@@ -56,6 +56,22 @@ hipError_t test_hipDeviceGetAttribute(int deviceId, hipDeviceAttribute_t attr,
return hipSuccess;
}
hipError_t test_hipDeviceGetHdpAddress(int deviceId, hipDeviceAttribute_t attr,
uint32_t* expectedValue = (uint32_t*)0xdeadbeef) {
uint32_t* value = 0;
std::cout << "Test hipDeviceGetHdpAddress attribute " << attr;
if (expectedValue != (uint32_t*)0xdeadbeef) {
std::cout << " expected value " << expectedValue;
}
hipError_t e = hipDeviceGetAttribute((int*) &value, attr, deviceId);
std::cout << " actual value " << value << std::endl;
if ((expectedValue != (uint32_t*)0xdeadbeef) && value != expectedValue) {
std::cout << "fail" << std::endl;
return hipErrorInvalidValue;
}
return hipSuccess;
}
int main(int argc, char* argv[]) {
int deviceId;
CHECK(hipGetDevice(&deviceId));
@@ -116,5 +132,9 @@ int main(int argc, char* argv[]) {
CHECK(test_hipDeviceGetAttribute(deviceId, hipDeviceAttributeMaxTexture3DWidth, props.maxTexture3D[0]));
CHECK(test_hipDeviceGetAttribute(deviceId, hipDeviceAttributeMaxTexture3DHeight, props.maxTexture3D[1]));
CHECK(test_hipDeviceGetAttribute(deviceId, hipDeviceAttributeMaxTexture3DDepth, props.maxTexture3D[2]));
#ifndef __HIP_PLATFORM_NVCC__
CHECK(test_hipDeviceGetHdpAddress(deviceId, hipDeviceAttributeHdpMemFlushCntl, props.hdpMemFlushCntl));
CHECK(test_hipDeviceGetHdpAddress(deviceId, hipDeviceAttributeHdpRegFlushCntl, props.hdpRegFlushCntl));
#endif
passed();
};