Skip to content

Commit 6b03d2e

Browse files
committed
add pools and providers to the web docs
1 parent adc43a9 commit 6b03d2e

File tree

6 files changed

+146
-51
lines changed

6 files changed

+146
-51
lines changed

include/umf/memory_pool.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
*
3-
* Copyright (C) 2023 Intel Corporation
3+
* Copyright (C) 2023-2024 Intel Corporation
44
*
55
* Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
66
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
@@ -22,27 +22,28 @@ extern "C" {
2222
/// functions
2323
typedef struct umf_memory_pool_t *umf_memory_pool_handle_t;
2424

25-
struct umf_memory_pool_ops_t;
26-
2725
/// @brief This structure comprises function pointers used by corresponding umfPool*
2826
/// calls. Each memory pool implementation should initialize all function
2927
/// pointers.
3028
///
3129
typedef struct umf_memory_pool_ops_t umf_memory_pool_ops_t;
3230

3331
/// @brief Supported pool creation flags
34-
typedef uint32_t umf_pool_create_flags_t;
3532
typedef enum umf_pool_create_flag_t {
36-
UMF_POOL_CREATE_FLAG_NONE = 0,
33+
UMF_POOL_CREATE_FLAG_NONE =
34+
0, ///< Pool will be created with no additional flags
3735
UMF_POOL_CREATE_FLAG_OWN_PROVIDER =
3836
(1
39-
<< 0), ///< pool will own the specified provider and destroy it in umfPoolDestroy
37+
<< 0), ///< Pool will own the specified provider and destroy it in umfPoolDestroy
4038
/// @cond
4139
UMF_POOL_CREATE_FLAG_FORCE_UINT32 = 0x7fffffff
4240
/// @endcond
4341

4442
} umf_pool_create_flag_t;
4543

44+
/// @brief Type for combinations of pool creation flags
45+
typedef uint32_t umf_pool_create_flags_t;
46+
4647
///
4748
/// @brief Creates new memory pool.
4849
/// @param ops instance of umf_memory_pool_ops_t

include/umf/pools/pool_disjoint.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (C) 2023 Intel Corporation
1+
// Copyright (C) 2023-2024 Intel Corporation
22
// Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
33
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44

@@ -29,7 +29,7 @@ umfDisjointPoolSharedLimitsCreate(size_t MaxSize);
2929
void umfDisjointPoolSharedLimitsDestroy(
3030
umf_disjoint_pool_shared_limits_t *PoolLimits);
3131

32-
/// Configuration of Disjoint Pool
32+
/// @brief Configuration of Disjoint Pool
3333
typedef struct umf_disjoint_pool_params_t {
3434
/// Minimum allocation size that will be requested from the system.
3535
/// By default this is the minimum allocation size of each memory type.

include/umf/providers/provider_level_zero.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ extern "C" {
1616

1717
/// @brief USM memory allocation type
1818
typedef enum umf_usm_memory_type_t {
19-
UMF_MEMORY_TYPE_UNKNOWN = 0,
20-
UMF_MEMORY_TYPE_HOST,
21-
UMF_MEMORY_TYPE_DEVICE,
22-
UMF_MEMORY_TYPE_SHARED,
19+
UMF_MEMORY_TYPE_UNKNOWN = 0, ///< The memory pointed to is of unknown type
20+
UMF_MEMORY_TYPE_HOST, ///< The memory pointed to is a host allocation
21+
UMF_MEMORY_TYPE_DEVICE, ///< The memory pointed to is a device allocation
22+
UMF_MEMORY_TYPE_SHARED, ///< The memory pointed to is a shared ownership allocation
2323
} umf_usm_memory_type_t;
2424

2525
/// @brief Level Zero Memory Provider settings struct

include/umf/providers/provider_os_memory.h

Lines changed: 41 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2022-2023 Intel Corporation
2+
* Copyright (C) 2022-2024 Intel Corporation
33
*
44
* Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
55
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
@@ -14,65 +14,78 @@
1414
extern "C" {
1515
#endif
1616

17+
/// @cond
1718
#define UMF_OS_RESULTS_START_FROM 1000
19+
/// @endcond
1820

1921
/// @brief Protection of the memory allocations
2022
typedef enum umf_mem_protection_flags_t {
2123
UMF_PROTECTION_NONE = (1 << 0), ///< Memory allocations can not be accessed
2224
UMF_PROTECTION_READ = (1 << 1), ///< Memory allocations can be read.
2325
UMF_PROTECTION_WRITE = (1 << 2), ///< Memory allocations can be written.
2426
UMF_PROTECTION_EXEC = (1 << 3), ///< Memory allocations can be executed.
25-
27+
/// @cond
2628
UMF_PROTECTION_MAX // must be the last one
29+
/// @endcond
2730
} umf_mem_protection_flags_t;
2831

2932
/// @brief Memory binding mode
30-
///
3133
/// Specifies how memory is bound to NUMA nodes on systems that support NUMA.
3234
/// Not every mode is supported on every system.
3335
typedef enum umf_numa_mode_t {
34-
UMF_NUMA_MODE_DEFAULT, ///< Default binding mode. Actual binding policy is system-specific.
35-
/// On linux this corresponds to MPOL_DEFAULT. If this mode is specified,
36-
/// nodemask must be NULL and maxnode must be 0.
37-
UMF_NUMA_MODE_BIND, ///< Restricts memory allocation to nodes specified in nodemask. Allocations
38-
/// might come from any of the allowed nodes. Nodemask must specify at least one node.
39-
UMF_NUMA_MODE_INTERLEAVE, ///< Interleaves memory allocations across the set of nodes specified in nodemask.
40-
/// Nodemask must specify at least one node.
41-
UMF_NUMA_MODE_PREFERRED, ///< Specifies preferred node for allocation. If allocation cannot be fulfilled,
42-
/// memory will be allocated from other nodes.
43-
UMF_NUMA_MODE_LOCAL, ///< The memory is allocated on the node of the CPU that triggered the allocation.
44-
/// If this mode is specified, nodemask must be NULL and maxnode must be 0.
45-
/// TODO: should this be a hint or strict policy?
36+
/// Default binding mode. Actual binding policy is system-specific. On
37+
/// linux this corresponds to MPOL_DEFAULT. If this mode is specified,
38+
/// nodemask must be NULL and maxnode must be 0.
39+
UMF_NUMA_MODE_DEFAULT,
40+
41+
/// Restricts memory allocation to nodes specified in nodemask. Allocations
42+
/// might come from any of the allowed nodes. Nodemask must specify at
43+
// least one node.
44+
UMF_NUMA_MODE_BIND,
45+
46+
/// Interleaves memory allocations across the set of nodes specified in
47+
/// nodemask. Nodemask must specify at least one node.
48+
UMF_NUMA_MODE_INTERLEAVE,
49+
50+
/// Specifies preferred node for allocation. If allocation cannot be
51+
/// fulfilled, memory will be allocated from other nodes.
52+
UMF_NUMA_MODE_PREFERRED,
53+
54+
/// The memory is allocated on the node of the CPU that triggered the
55+
/// allocation. If this mode is specified, nodemask must be NULL and
56+
/// maxnode must be 0.
57+
UMF_NUMA_MODE_LOCAL, // TODO: should this be a hint or strict policy?
4658
} umf_numa_mode_t;
4759

4860
/// @brief Memory provider settings struct
4961
typedef struct umf_os_memory_provider_params_t {
50-
/// combination of 'umf_mem_protection_flags_t' flags
62+
/// Combination of 'umf_mem_protection_flags_t' flags
5163
unsigned protection;
5264

5365
// NUMA config
54-
/// points to a bit mask of nodes containing up to maxnode bits, depending on
66+
/// Points to a bit mask of nodes containing up to maxnode bits, depending on
5567
/// selected numa_mode newly allocated memory will be bound to those nodes
5668
unsigned long *nodemask;
57-
/// max number of bits in nodemask
69+
/// Max number of bits in nodemask
5870
unsigned long maxnode;
59-
/// describes how nodemask is interpreted
71+
/// Describes how nodemask is interpreted
6072
umf_numa_mode_t numa_mode;
6173

6274
// others
63-
/// log level of debug traces
75+
/// Log level of debug traces
6476
int traces;
6577
} umf_os_memory_provider_params_t;
6678

79+
/// @brief OS Memory Provider operation results
6780
typedef enum umf_os_memory_provider_native_error {
68-
UMF_OS_RESULT_SUCCESS = UMF_OS_RESULTS_START_FROM,
69-
UMF_OS_RESULT_ERROR_ALLOC_FAILED,
70-
UMF_OS_RESULT_ERROR_ADDRESS_NOT_ALIGNED,
71-
UMF_OS_RESULT_ERROR_BIND_FAILED,
72-
UMF_OS_RESULT_ERROR_FREE_FAILED,
73-
UMF_OS_RESULT_ERROR_PURGE_LAZY_FAILED,
74-
UMF_OS_RESULT_ERROR_PURGE_FORCE_FAILED,
75-
UMF_OS_RESULT_ERROR_TOPO_DISCOVERY_FAILED,
81+
UMF_OS_RESULT_SUCCESS = UMF_OS_RESULTS_START_FROM, ///< Success
82+
UMF_OS_RESULT_ERROR_ALLOC_FAILED, ///< Memory allocation failed
83+
UMF_OS_RESULT_ERROR_ADDRESS_NOT_ALIGNED, ///< Allocated address is not aligned
84+
UMF_OS_RESULT_ERROR_BIND_FAILED, ///< Binding memory to NUMA node failed
85+
UMF_OS_RESULT_ERROR_FREE_FAILED, ///< Memory deallocation failed
86+
UMF_OS_RESULT_ERROR_PURGE_LAZY_FAILED, ///< Lazy purging failed
87+
UMF_OS_RESULT_ERROR_PURGE_FORCE_FAILED, ///< Force purging failed
88+
UMF_OS_RESULT_ERROR_TOPO_DISCOVERY_FAILED, ///< HWLOC topology discovery failed
7689
} umf_os_memory_provider_native_error_t;
7790

7891
umf_memory_provider_ops_t *umfOsMemoryProviderOps(void);

scripts/docs_config/api.rst

Lines changed: 91 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,103 @@ API Documentation
33
==========================================
44

55
Globals
6-
----------------------------------------------------------
6+
==========================================
77
.. doxygenfile:: base.h
8-
:sections: enum
8+
:sections: define enum
99

1010
Pools
11-
----------------------------------------------------------
12-
Disjoint Pool
13-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
14-
.. doxygenfile:: pool_disjoint.h
15-
:sections: enum typedef func var
11+
==========================================
12+
13+
The UMF memory pool is a combination of a pool allocator and a memory provider.
14+
The pool allocator controls the memory pool and handles fine-grained memory
15+
allocations memory allocations.
16+
17+
UMF includes predefined pool allocators. UMF can also work with user-defined
18+
pools which implement the memory pool API.
1619

1720
Memory Pool
18-
----------------------------------------------------------
21+
------------------------------------------
22+
23+
The memory pool API provides a malloc-like API for allocating and deallocating
24+
memory as well as functions that create, destroy and operate on the pool.
25+
1926
.. doxygenfile:: memory_pool.h
20-
:sections: enum typedef func var
27+
:sections: define enum typedef func var
28+
29+
Disjoint Pool
30+
------------------------------------------
31+
32+
The Disjoint Pool allocates user data using the configured provider, while also
33+
preserving metadata in DRAM.
34+
35+
.. doxygenfile:: pool_disjoint.h
36+
:sections: define enum typedef func var
37+
38+
Jemalloc Pool
39+
------------------------------------------
40+
41+
A jemalloc-based memory pool manager. More info about jemalloc could be found
42+
here: https://github.com/jemalloc/jemalloc.
43+
44+
.. doxygenfile:: pool_jemalloc.h
45+
:sections: define enum typedef func var
46+
47+
Proxy Pool
48+
------------------------------------------
49+
50+
Proxy Pool forwards all requests to the underlying memory provider. Currently
51+
umfPoolRealloc, umfPoolCalloc and umfPoolMallocUsableSize functions are not
52+
supported by the Proxy Pool.
53+
54+
.. doxygenfile:: pool_proxy.h
55+
:sections: define enum typedef func var
56+
57+
Scalable Pool
58+
------------------------------------------
59+
.. doxygenfile:: pool_scalable.h
60+
:sections: define enum typedef func var
61+
62+
Providers
63+
==========================================
64+
65+
The memory provider is responsible for coarse-grained memory allocations and
66+
memory page management.
67+
68+
UMF includes predefined providers, but can also work with providers which
69+
implement the memory provider API.
2170

2271
Memory Provider
23-
----------------------------------------------------------
72+
------------------------------------------
73+
74+
The memory provider API provides a functions for allocating, deallocating and
75+
manipulating coarse-grained memory as well as functions that create, destroy
76+
and operate on the provider.
77+
2478
.. doxygenfile:: memory_provider.h
79+
:sections: define enum typedef func var
80+
81+
OS Memory Provider
82+
------------------------------------------
83+
84+
A memory provider that provides memory from an operating system.
85+
86+
.. doxygenfile:: provider_os_memory.h
87+
:sections: define enum typedef func var
88+
89+
Level Zero Provider
90+
------------------------------------------
91+
92+
A memory provider that provides memory from L0 device.
93+
94+
.. doxygenfile:: provider_level_zero.h
95+
:sections: define enum typedef func var
96+
97+
Memspace
98+
==========================================
99+
100+
TODO: Add general information about memspaces.
101+
102+
Memspace
103+
------------------------------------------
104+
.. doxygenfile:: memspace.h
105+
:sections: define enum typedef func var

scripts/docs_config/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# -- Project information -----------------------------------------------------
1919

2020
project = "Intel Unified Memory Framework"
21-
copyright = "2023, Intel"
21+
copyright = "2023-2024, Intel"
2222
author = "Intel"
2323

2424
# The full version, including alpha/beta/rc tags

0 commit comments

Comments
 (0)