Files
rocm-systems/tests/src/Functional/Negative/Device/hipDeviceGetAttribute.cpp
T
Aditya Atluri 5b45c97a30 Fixed hipDeviceGetAttribute
1. Added negative test for hipDeviceGetAttribute
2. Fixed hipDeviceGetAttribute if int ptr input is null

Change-Id: I0e31f50fa407701fddf96e4eb64a87a371ff5d95
2016-09-27 13:33:42 -05:00

22 строки
1.0 KiB
C++

#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);
}