Merge pull request #489 from gargrahul/add_dev_prop_integrated

Add integrated device property
Αυτή η υποβολή περιλαμβάνεται σε:
Maneesh Gupta
2018-06-06 14:31:30 +05:30
υποβλήθηκε από GitHub
γονέας eab2c3f248 94f086e9cd
υποβολή cd20a370eb
5 αρχεία άλλαξαν με 16 προσθήκες και 0 διαγραφές
@@ -114,6 +114,7 @@ typedef struct hipDeviceProp_t {
int isMultiGpuBoard; ///< 1 if device is on a multi-GPU board, 0 if not.
int canMapHostMemory; ///< Check whether HIP can map host memory
int gcnArch; ///< AMD GCN Arch Value. Eg: 803, 701
int integrated; ///< APU vs dGPU
} hipDeviceProp_t;
@@ -289,6 +290,7 @@ typedef enum hipDeviceAttribute_t {
hipDeviceAttributeMaxSharedMemoryPerMultiprocessor, ///< Maximum Shared Memory Per
///< Multiprocessor.
hipDeviceAttributeIsMultiGpuBoard, ///< Multiple GPU devices.
hipDeviceAttributeIntegrated, ///< iGPU
} hipDeviceAttribute_t;
@@ -809,6 +809,9 @@ inline static hipError_t hipDeviceGetAttribute(int* pi, hipDeviceAttribute_t att
case hipDeviceAttributeIsMultiGpuBoard:
cdattr = cudaDevAttrIsMultiGpuBoard;
break;
case hipDeviceAttributeIntegrated:
cdattr = cudaDevAttrIntegrated;
break;
default:
cerror = cudaErrorInvalidValue;
break;
@@ -273,6 +273,9 @@ hipError_t ihipDeviceGetAttribute(int* pi, hipDeviceAttribute_t attr, int device
case hipDeviceAttributeIsMultiGpuBoard:
*pi = prop->isMultiGpuBoard;
break;
case hipDeviceAttributeIntegrated:
*pi = prop->integrated;
break;
default:
e = hipErrorInvalidValue;
break;
@@ -900,6 +900,13 @@ hipError_t ihipDevice_t::initProperties(hipDeviceProp_t* prop) {
prop->canMapHostMemory = 0;
}
#endif
// Get profile
hsa_profile_t agent_profile;
err = hsa_agent_get_info(_hsaAgent, HSA_AGENT_INFO_PROFILE, &agent_profile);
DeviceErrorCheck(err);
if(agent_profile == HSA_PROFILE_FULL) {
prop->integrated = 1;
}
return e;
}
@@ -108,5 +108,6 @@ int main(int argc, char* argv[]) {
test_hipDeviceGetAttribute(deviceId, hipDeviceAttributePciDeviceId, props.pciDeviceID)); //
CHECK(test_hipDeviceGetAttribute(deviceId, hipDeviceAttributeMaxSharedMemoryPerMultiprocessor,
props.maxSharedMemoryPerMultiProcessor));
CHECK(test_hipDeviceGetAttribute(deviceId, hipDeviceAttributeIntegrated, props.integrated));
passed();
};