|
7 | 7 | *
|
8 | 8 | */
|
9 | 9 |
|
| 10 | +#include <stdbool.h> |
| 11 | + |
| 12 | +#ifndef _WIN32 |
| 13 | +#include <unistd.h> |
| 14 | +#endif |
| 15 | + |
10 | 16 | #include <umf/ipc.h>
|
11 | 17 | #include <umf/memory_pool.h>
|
12 | 18 | #include <umf/pools/pool_proxy.h>
|
|
22 | 28 | #include <umf/pools/pool_jemalloc.h>
|
23 | 29 | #endif
|
24 | 30 |
|
25 |
| -#include <stdbool.h> |
26 |
| - |
27 |
| -#ifndef _WIN32 |
28 |
| -#include <unistd.h> |
29 |
| -#endif |
30 |
| - |
31 |
| -#include "ubench.h" |
32 | 31 | #include "utils_common.h"
|
33 | 32 |
|
34 | 33 | #if (defined UMF_BUILD_GPU_TESTS)
|
35 | 34 | #include "utils_level_zero.h"
|
36 | 35 | #endif
|
37 | 36 |
|
| 37 | +// NOTE: with strict compilation flags, ubench compilation throws some |
| 38 | +// warnings. We disable them here because we do not want to change the ubench |
| 39 | +// code. |
| 40 | + |
| 41 | +// disable warning 6308:'realloc' might return null pointer: assigning null |
| 42 | +// pointer to 'failed_benchmarks', which is passed as an argument to 'realloc', |
| 43 | +// will cause the original memory block to be leaked. |
| 44 | +// disable warning 6001: Using uninitialized memory |
| 45 | +// '*ubench_state.benchmarks.name'. |
| 46 | +#if defined(_MSC_VER) |
| 47 | +#pragma warning(push) |
| 48 | +#pragma warning(disable : 6308) |
| 49 | +#pragma warning(disable : 6001) |
| 50 | +#endif // _MSC_VER |
| 51 | + |
| 52 | +#include "ubench.h" |
38 | 53 | // BENCHMARK CONFIG
|
39 | 54 | #define N_ITERATIONS 1000
|
40 | 55 | #define ALLOC_SIZE (util_get_page_size())
|
@@ -63,7 +78,7 @@ static void do_benchmark(alloc_t *array, size_t iters, malloc_t malloc_f,
|
63 | 78 | int i = 0;
|
64 | 79 | do {
|
65 | 80 | array[i].ptr = malloc_f(provider, Alloc_size, 0);
|
66 |
| - } while (array[i++].ptr != NULL && i < iters); |
| 81 | + } while (array[i++].ptr != NULL && i < (int)iters); |
67 | 82 |
|
68 | 83 | while (--i >= 0) {
|
69 | 84 | free_f(provider, array[i].ptr, Alloc_size);
|
@@ -110,14 +125,18 @@ UBENCH_EX(simple, glibc_malloc) {
|
110 | 125 |
|
111 | 126 | static umf_os_memory_provider_params_t UMF_OS_MEMORY_PROVIDER_PARAMS = {
|
112 | 127 | /* .protection = */ UMF_PROTECTION_READ | UMF_PROTECTION_WRITE,
|
113 |
| - /* .visibility */ UMF_MEM_MAP_PRIVATE, |
| 128 | + /* .visibility = */ UMF_MEM_MAP_PRIVATE, |
| 129 | + /* .shm_name = */ NULL, |
114 | 130 |
|
115 | 131 | // NUMA config
|
116 |
| - /* .nodemask = */ NULL, |
117 |
| - /* .maxnode = */ 0, |
| 132 | + /* .numa_list = */ NULL, |
| 133 | + /* .numa_list_len = */ 0, |
| 134 | + |
118 | 135 | /* .numa_mode = */ UMF_NUMA_MODE_DEFAULT,
|
| 136 | + /* .part_size = */ 0, |
119 | 137 |
|
120 |
| - // others |
| 138 | + /* .partitions = */ NULL, |
| 139 | + /* .partitions_len = */ 0, |
121 | 140 | };
|
122 | 141 |
|
123 | 142 | static void *w_umfMemoryProviderAlloc(void *provider, size_t size,
|
@@ -487,3 +506,7 @@ UBENCH_EX(ipc, disjoint_pool_with_level_zero_provider) {
|
487 | 506 | #endif /* (defined UMF_BUILD_LIBUMF_POOL_DISJOINT && defined UMF_BUILD_LEVEL_ZERO_PROVIDER && defined UMF_BUILD_GPU_TESTS) */
|
488 | 507 |
|
489 | 508 | UBENCH_MAIN()
|
| 509 | + |
| 510 | +#if defined(_MSC_VER) |
| 511 | +#pragma warning(pop) |
| 512 | +#endif // _MSC_VER |
0 commit comments