-
Notifications
You must be signed in to change notification settings - Fork 37
add memory properties API #1301
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
92db71d
to
56573df
Compare
a5c357c
to
17f6335
Compare
a972d25
to
94a3476
Compare
94a3476
to
218fccf
Compare
4c40aae
to
b24d000
Compare
787d15d
to
845f2b4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a comprehensive memory properties API to the unified memory framework, enabling users to query various properties of allocated memory such as memory type, base address, size, and provider-specific information.
- Introduces memory properties API with two main functions:
umfGetMemoryPropertiesHandle
andumfGetMemoryProperty
- Extends memory provider operations with
ext_get_allocation_properties
function - Adds comprehensive test coverage for the new memory properties functionality
Reviewed Changes
Copilot reviewed 37 out of 38 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
include/umf/base.h | Defines memory property types and handle structures |
include/umf/experimental/memory_props.h | Public API for memory properties functionality |
src/memory_props.c | Core implementation of memory properties API |
src/provider/provider_tracking.c | Updates tracking provider to support memory properties |
test/props/ | Comprehensive test suite for memory properties API |
Various provider files | Updates all providers to support new allocation properties interface |
7166723
to
cfae388
Compare
55cd0ea
to
f0d0c8c
Compare
/// @param property_value [out] pointer to the value of the memory property | ||
/// which will be filled | ||
/// @return UMF_RESULT_SUCCESS on success or appropriate error code on failure | ||
umf_result_t umfGetMemoryProperty(umf_memory_properties_handle_t props_handle, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const handle?
@@ -144,3 +144,6 @@ EXPORTS | |||
umfJemallocPoolParamsDestroy | |||
umfJemallocPoolParamsSetNumArenas | |||
umfPoolGetName | |||
; Added in UMF_1.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm... should we bump VERSION
on top of this file?
// UMF specific | ||
UMF_MEMORY_PROPERTY_PROVIDER_HANDLE = | ||
0, ///< Handle to the memory provider (void*) | ||
UMF_MEMORY_PROPERTY_POOL_HANDLE = 1, ///< Handle to the memory pool (void*) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mention handle types, perhaps
/// @param memory_property_id ID of the memory property to get | ||
/// @param max_property_size size of the property value buffer | ||
/// @param property_value [out] pointer to the value of the memory property | ||
/// which will be filled |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps mention that value's type depends on the property (and link to enum umf_memory_property_id_t
)
|
||
#include <inttypes.h> | ||
|
||
#include <umf/experimental/memory_props.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe rename the file to memory_properties
instead of "props"
@@ -133,6 +133,17 @@ umfDefaultCtlHandle(void *provider, umf_ctl_query_source_t operationType, | |||
return UMF_RESULT_ERROR_NOT_SUPPORTED; | |||
} | |||
|
|||
static umf_result_t umfDefaultGetAllocationProperties( | |||
void *provider, const void *ptr, umf_memory_property_id_t propertyId, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps property_id
to match style of other names
sizeof(baseAddress), &baseAddress); | ||
ASSERT_EQ(result, UMF_RESULT_SUCCESS); | ||
ASSERT_EQ(baseAddress, ptr); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm missing an invalid test for umfGetMemoryProperty
with wrong mem_property_id
add memory properties API
https://reviewable.io/reviews/bratpiorka/unified-memory-framework/3
fixes #1263