|
3 | 3 | // See LICENSE.TXT |
4 | 4 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
5 | 5 |
|
6 | | -#include "ur_print.hpp" |
7 | 6 | #include "uur/fixtures.h" |
8 | | -#include "uur/raii.h" |
9 | 7 | #include "uur/utils.h" |
10 | 8 |
|
11 | | -#include <map> |
12 | | -#include <string> |
13 | | - |
14 | 9 | using urMemoryResidencyTest = uur::urMultiDeviceContextTestTemplate<1>; |
| 10 | +UUR_INSTANTIATE_PLATFORM_TEST_SUITE_P(urMemoryResidencyTest); |
15 | 11 |
|
16 | | -TEST_F(urMemoryResidencyTest, allocatingDeviceMemoryWillResultInOOM) { |
| 12 | +TEST_P(urMemoryResidencyTest, allocatingDeviceMemoryWillResultInOOM) { |
17 | 13 | static constexpr size_t allocSize = 1024 * 1024; |
18 | 14 |
|
19 | | - if (!uur::isPVC(uur::DevicesEnvironment::instance->devices[0])) { |
| 15 | + if (!uur::isPVC(devices[0])) { |
20 | 16 | GTEST_SKIP() << "Test requires a PVC device"; |
21 | 17 | } |
22 | 18 |
|
23 | 19 | size_t initialMemFree = 0; |
24 | | - ASSERT_SUCCESS( |
25 | | - urDeviceGetInfo(uur::DevicesEnvironment::instance->devices[0], |
26 | | - UR_DEVICE_INFO_GLOBAL_MEM_FREE, sizeof(size_t), |
27 | | - &initialMemFree, nullptr)); |
| 20 | + ASSERT_SUCCESS(urDeviceGetInfo(devices[0], UR_DEVICE_INFO_GLOBAL_MEM_FREE, |
| 21 | + sizeof(size_t), &initialMemFree, nullptr)); |
28 | 22 |
|
29 | 23 | if (initialMemFree < allocSize) { |
30 | 24 | GTEST_SKIP() << "Not enough device memory available"; |
31 | 25 | } |
32 | 26 |
|
33 | 27 | void *ptr = nullptr; |
34 | | - ASSERT_SUCCESS( |
35 | | - urUSMDeviceAlloc(context, uur::DevicesEnvironment::instance->devices[0], |
36 | | - nullptr, nullptr, allocSize, &ptr)); |
| 28 | + ASSERT_SUCCESS(urUSMDeviceAlloc(context, devices[0], nullptr, nullptr, |
| 29 | + allocSize, &ptr)); |
37 | 30 |
|
38 | 31 | size_t currentMemFree = 0; |
39 | | - ASSERT_SUCCESS( |
40 | | - urDeviceGetInfo(uur::DevicesEnvironment::instance->devices[0], |
41 | | - UR_DEVICE_INFO_GLOBAL_MEM_FREE, sizeof(size_t), |
42 | | - ¤tMemFree, nullptr)); |
| 32 | + ASSERT_SUCCESS(urDeviceGetInfo(devices[0], UR_DEVICE_INFO_GLOBAL_MEM_FREE, |
| 33 | + sizeof(size_t), ¤tMemFree, nullptr)); |
43 | 34 |
|
44 | 35 | // amount of free memory should decrease after making a memory allocation resident |
45 | 36 | ASSERT_LE(currentMemFree, initialMemFree); |
|
0 commit comments