Fixed hipDeviceGetAttribute
1. Added negative test for hipDeviceGetAttribute 2. Fixed hipDeviceGetAttribute if int ptr input is null Change-Id: I0e31f50fa407701fddf96e4eb64a87a371ff5d95
Ta zmiana jest zawarta w:
%! (template.HTML=
Aditya Atluri)złożyło 2016-09-27 13:33:42 -05:00
1 rodzic
1b14393a85
złożenie
5b45c97a30
2 plików zmienionych
+26
Żadne pliki nie pasują do Twojego wyszukiwania
@@ -155,6 +155,8 @@ hipError_t hipDeviceGetAttribute(int* pi, hipDeviceAttribute_t attr, int device)
|
||||
|
||||
hipError_t e = hipSuccess;
|
||||
|
||||
if(pi != nullptr) {
|
||||
|
||||
auto * hipDevice = ihipGetDevice(device);
|
||||
hipDeviceProp_t *prop = &hipDevice->_props;
|
||||
if (hipDevice) {
|
||||
@@ -215,6 +217,9 @@ hipError_t hipDeviceGetAttribute(int* pi, hipDeviceAttribute_t attr, int device)
|
||||
} else {
|
||||
e = hipErrorInvalidDevice;
|
||||
}
|
||||
}else{
|
||||
e = hipErrorInvalidDevice;
|
||||
}
|
||||
return ihipLogStatus(e);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
#include<hip/hip_runtime.h>
|
||||
#include<hip/hip_runtime_api.h>
|
||||
#include"hipDeviceUtil.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
int pi;
|
||||
int attr = 0;
|
||||
// hipDeviceAttribute_t attr = hipDeviceAttributeMaxThreadsPerBlock;
|
||||
HIP_CHECK(hipDeviceGetAttribute(nullptr, hipDeviceAttribute_t(attr), 0), hipDeviceGetAttribute);
|
||||
HIP_CHECK(hipDeviceGetAttribute(&pi, hipDeviceAttribute_t(attr), 0), hipDeviceGetAttribute);
|
||||
attr = -1;
|
||||
HIP_CHECK(hipDeviceGetAttribute(nullptr, hipDeviceAttribute_t(attr), 0), hipDeviceGetAttribute);
|
||||
HIP_CHECK(hipDeviceGetAttribute(&pi, hipDeviceAttribute_t(attr), 0), hipDeviceGetAttribute);
|
||||
attr = 0;
|
||||
HIP_CHECK(hipDeviceGetAttribute(nullptr, hipDeviceAttribute_t(attr), -1), hipDeviceGetAttribute);
|
||||
HIP_CHECK(hipDeviceGetAttribute(&pi, hipDeviceAttribute_t(attr), -1), hipDeviceGetAttribute);
|
||||
attr = -1;
|
||||
HIP_CHECK(hipDeviceGetAttribute(nullptr, hipDeviceAttribute_t(attr), -1), hipDeviceGetAttribute);
|
||||
HIP_CHECK(hipDeviceGetAttribute(&pi, hipDeviceAttribute_t(attr), -1), hipDeviceGetAttribute);
|
||||
}
|
||||
Reference in new issue
Zablokuj użytkownika