-
Notifications
You must be signed in to change notification settings - Fork 40
The last CTL patch :) #1524
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?
The last CTL patch :) #1524
Conversation
629b379
to
2706166
Compare
Split between initialize and post-initialize function is necessary for properly handling CTL defaults.
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.
after all, this is super huge PR - I'd split this somehow, if easily done...
defaults changes global state, so using forks will isolate tests
94517a8
to
decb1fd
Compare
README.md
Outdated
|
||
UMF's experimental CTL API is showcased in the [CTL example](examples/ctl/ctl.c), | ||
which explores provider and pool statistics, and in the [custom CTL example](examples/ctl/custom_ctl.c), which wires CTL support into a bespoke memory | ||
provider. These examples rely on experimental headers whose interfaces may |
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.
whose
refer to people -> perhaps: ... experimental headers which may change ...
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.
done
sizeof(alloc_count), name, i); | ||
} | ||
|
||
Ensure that the types of wildcard arguments match the expected node types. |
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.
otherwise what? you get an error, a crash, ...?
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.
undefined behavior may happen
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.
undefined by C standard not our code.
docs/config/ctl.rst
Outdated
sizeof(capacity)); | ||
|
||
Every subsequently created disjoint pool will use ``16`` as its starting | ||
capacity overriding it's creation parameters. Defaults are keyed by the |
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.
it's
-> its
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.
done
docs/config/ctl.rst
Outdated
|
||
UMF_CONF="umf.logger.output=stdout;umf.logger.level=0" | ||
|
||
CTL options available through environment variables are limited—you can only |
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.
limited—you
misspell
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.
done?
docs/config/ctl.rst
Outdated
Within each subsystem the path continues with an addressing scheme followed by | ||
the module or leaf of interest. | ||
|
||
Reading this reference |
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.
consider renaming this section to Reading below sections
or dunno, something else ;d
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.
w/e done.
docs/config/ctl.rst
Outdated
:type:`umf_memory_provider_handle_t` argument to reach a specific provider. | ||
Providers can also be addressed by name through ``umf.provider.by_name.{provider}``; | ||
append ``.{index}`` to address specific provider when multiple providers share the same label. | ||
Defaults for future providers reside under ``umf.provider.default.{provider}`` and track the |
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.
not sure what you meant by ... and track the name ...
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.
done
=========== | ||
|
||
A ``{}`` in the path acts as a wildcard and is replaced with successive | ||
arguments of ``umfCtlGet``, ``umfCtlSet`` or ``umfCtlExec``. Wildcards can |
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.
set and get are explained, but umfCtlExec
wasn't
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.
TBH we do not explain set or get either. Do we need such section?
target_include_directories(${ EXAMPLE_NAME} PRIVATE ${ LIBUMF_INCLUDE_DIRS}) | ||
target_link_directories( | ||
${ | ||
EXAMPLE_NAME} |
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.
that's a weird formatting - can you make it like ${EXAMPLE_NAME}
...?
// fix below, as well pls
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.
not my faults - this is done by cmake format
src/ctl/ctl_defaults.c
Outdated
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
*/ | ||
|
||
#include "ctl_defaults.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.
move down to other internal includes
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.
done
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 consolidates final CTL (Control Interface) changes for version 1.0, including error code adjustments and comprehensive implementation of CTL functionality for providers and pools. The CTL system provides a hierarchical interface for configuring and querying UMF components.
Key changes:
- Introduced new error code
UMF_RESULT_ERROR_INVALID_CTL_PATH
for invalid CTL paths - Added comprehensive CTL parameter support for disjoint pools with default overrides
- Enhanced provider and pool initialization with post-initialization hooks
- Added extensive test coverage and examples for CTL functionality
Reviewed Changes
Copilot reviewed 49 out of 49 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
include/umf/base.h |
Added new error code UMF_RESULT_ERROR_INVALID_CTL_PATH |
test/utils/cpp_helpers.hpp |
Updated default error return from UMF_RESULT_ERROR_UNKNOWN to UMF_RESULT_ERROR_INVALID_CTL_PATH |
test/pools/disjoint_pool_ctl.cpp |
Added comprehensive CTL tests for disjoint pool parameters and defaults |
test/pools/disjoint_pool.cpp |
Added post-initialization CTL calls to existing tests |
src/pool/pool_disjoint.c |
Implemented extensive CTL parameter support with read/write handlers |
src/memory_provider.c |
Added provider CTL defaults system and post-initialization support |
src/memory_pool.c |
Enhanced pool creation with CTL defaults and post-initialization |
examples/ctl/ |
Added comprehensive CTL usage examples |
examples/ctl/custom_ctl.c
Outdated
int a; | ||
int b; | ||
int c; | ||
int m; // modulus value, optional |
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.
typedef struct ctl_provider_t {
int a, b, c, m;
} ctl_provider_t;
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.
done
examples/ctl/CMakeLists.txt
Outdated
PRIVATE | ||
${ | ||
LIBHWLOC_LIBRARY_DIRS}) | ||
target_link_libraries(${ EXAMPLE_NAME} PRIVATE ${LIBUMF_LIBRARIES} hwloc) |
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.
Is needed to keep those spaces in brackets?
I mean:
${hereEXAMPLE_NAME}
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.
done
void *provider, const void *ptr, | ||
umf_memory_property_id_t memory_property_id, void *property_value); | ||
|
||
/// |
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.
In memory_pool.h
you removed such line :)
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.
in this file all function has such line
src/ctl/ctl_defaults.c
Outdated
umf_ctl_query_type_t queryType) { | ||
(void)source; | ||
if (strstr(extra_name, "{}") != NULL) { | ||
LOG_ERR("%s, default setting do not support wildcard parameters {}", |
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.
do not -> does not?
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.
done
#include "umf.h" | ||
#include <gtest/gtest.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.
different header groups
No description provided.