| 7 | #include "test/rocm/utils.h" |
| 8 | |
| 9 | TEST_F(MegcoreROCM, DEVICE) { |
| 10 | for (int id = -1; id < std::min(nr_devices(), 2); ++id) { |
| 11 | megcoreDeviceHandle_t handle; |
| 12 | megcoreCreateDeviceHandle(&handle, megcorePlatformROCM, id, 0); |
| 13 | |
| 14 | int deviceID; |
| 15 | megcoreGetDeviceID(handle, &deviceID); |
| 16 | ASSERT_EQ(id, deviceID); |
| 17 | |
| 18 | megcorePlatform_t platform; |
| 19 | megcoreGetPlatform(handle, &platform); |
| 20 | ASSERT_EQ(megcorePlatformROCM, platform); |
| 21 | |
| 22 | unsigned int flags; |
| 23 | megcoreGetDeviceFlags(handle, &flags); |
| 24 | ASSERT_EQ(0u, flags); |
| 25 | |
| 26 | size_t memAlignmentInBytes; |
| 27 | megcoreGetMemAlignment(handle, &memAlignmentInBytes); |
| 28 | |
| 29 | megcoreActivate(handle); |
| 30 | |
| 31 | void* ptr; |
| 32 | megcoreMalloc(handle, &ptr, 256); |
| 33 | megcoreFree(handle, ptr); |
| 34 | |
| 35 | megcoreDestroyDeviceHandle(handle); |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | TEST_F(MegcoreROCM, ERROR_MSG) { |
| 40 | #if MEGDNN_ENABLE_EXCEPTIONS |
nothing calls this directly
no test coverage detected